| Summary: | snake_saver and star_saver fail to compile with -Wall -Werror | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | gordont <gordont> | ||||
| Component: | kern | Assignee: | yokota <yokota> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | Unspecified | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
gordont@bluemtn.net wrote: [..] > similar to PR 22709. Was bored at work and thought I would do something very > minorly constructive. > > -gordon > - sc_vtb_putc(&scp->scr, savs[0], sc->scr_map[*save], > + sc_vtb_putc(&scp->scr, savs[0], sc->scr_map[(int) *save Actually, this is quite incorrect.. All you are doing is hiding the problem instead of fixing it. If you have 0x80 (-128 decimal), then casting it to an int ends up with (int) -128, which is still a negative array offset. sc->scr_map[(unsigned char)*save]; would work, because you end up with a positive index value in all cases. I'm one of these crazy people that likes to compile things with switches like -funsigned-char. :-) Cheers, -Peter -- Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au "All of this is for nothing if we don't go to the stars" - JMS/B5 Responsible Changed From-To: gnats-admin->yokota Over to Mr. syscons... Kazutaka, can you please look at the patches and commit them if appropriate? On Thu, 9 Nov 2000, Peter Wemm wrote:
> sc->scr_map[(unsigned char)*save];
>
> would work, because you end up with a positive index value in all cases.
>
> I'm one of these crazy people that likes to compile things with
> switches like -funsigned-char. :-)
Well, it would probably be better to use the cast since that makes it
explicit. It's been a while since I've done C, which is why I wanted to
work on something small to begin with.
Also, compiling with switches -Wall -Werror -funsigned-char still causes
the make to error-out.
-gordon
State Changed From-To: open->closed Fixed by nyan in both 5.0-CURRENT and RELENG_4. |
Compiling snake_saver.ko and star_saver.ko with -Wall -Werror produces an error about array indices being of type 'char' Fix: similar to PR 22709. Was bored at work and thought I would do something very minorly constructive. -gordon How-To-Repeat: (Again, assuming Bourne Shell) cd /usr/src/sys/modules/syscons/{snake,star} CC='cc -Wall -Werror' make