Opened 3 years ago
Closed 4 months ago
#276 closed defect (fixed)
rijndael.c makes gcc 4.4 very sad
| Reported by: | salcock | Owned by: | salcock |
|---|---|---|---|
| Priority: | minor | Milestone: | libtrace3 |
| Component: | tools | Version: | |
| Keywords: | Cc: |
Description
We do a crapload of nasty-looking casting in rijndael.c between uint8_t * and uint32_t *.
This tends to make new gcc's strict-aliasing warning go nuts, but actually fixing this is going to be more than a little tricky. Not just in terms of replacing the casts, but doing so in a way that won't actually break the code.
For example, it's not enough to do most of the casts once at the start of the function, because the pointer that they were cast from often gets incremented during the function. As a result, you need to redo the cast.
For now, I've disabled that warning for the traceanon tool. This is far from ideal, but hopefully this is just a case of gcc being whiny. At some point, though, the casting should be fixed and the warning re-instated.
Change History (2)
comment:1 Changed 3 years ago by anonymous
comment:2 Changed 4 months ago by salcock
- Resolution set to fixed
- Status changed from new to closed
Finally fixed in r1791. Seems to work well in testing - comparing the output of traceanon using the old rijndael code with the output from using the new code results in no difference.

Try keeping the original in void *'s and only cast as necessary. ((uint8_t*)x)+=4 is the same as ((uint32_t*)x)+=1;