Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#3750 closed defect (fixed)

Nagra issue on build with gcc 4.9 found

Reported by: Gorgone Impertinence Owned by:
Priority: minor Component: General
Severity: low Keywords:
Cc: Sensitive: no

Description

reader-nagra.c: In function 'nagra2_do_ecm':
reader-nagra.c:1098:33: warning: iteration 4u invokes undefined behavior [-Waggressive-loop-optimizations]
       if(reader->ecmcommandcache[t] == er->ecm[3]) { matchfound++; }
                                 ^
reader-nagra.c:1096:11: note: containing loop
      while(t < 5)
           ^

Change History (6)

comment:1 by Gorgone Impertinence, 10 years ago

Resolution: fixed
Status: newclosed

fixed in #9750

is defined as

uchar ecmcommandcache[4];


Last edited 10 years ago by Gorgone Impertinence (previous) (diff)

comment:2 by DaMulda, 10 years ago

@Gorgone:

If you don't know what you're doing, don't touch the code: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57199

In this case it's also a bogus warning, because t never reaches 5 or rather we get not in touch with the 5th bound of ecmcommandcache because of while(t < 5)!

Last edited 10 years ago by DaMulda (previous) (diff)

comment:3 by DaMulda, 10 years ago

Resolution: fixed
Status: closedreopened

comment:4 by Gorgone Impertinence, 10 years ago

Resolution: fixed
Status: reopenedclosed

DaMulda shut up

the default array is defined to have 4 elements the count begins @ 0 so 4th = 5
so the loop fails with error
the compiler cant know if its possible or not !!!

Last edited 10 years ago by Gorgone Impertinence (previous) (diff)

comment:5 by DaMulda, 10 years ago

Sorry for that, you'r right.

I haven't switch the way of thinking, from my work today. My colleagues love it to start the bounds at 1 within our LotusScript projects.

comment:6 by Gorgone Impertinence, 10 years ago

no problem but please first think before howl around

Note: See TracTickets for help on using tickets.