https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64294
Sebastian Andrzej Siewior <gcc at breakpoint dot cc> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |---
--- Comment #5 from Sebastian Andrzej Siewior <gcc at breakpoint dot cc> ---
I re-open it. This time I attached the whole .i twice:
- "macro" contains the second CLI_ISCONTAINED() invocation as a macro
- "static" contains the second CLI_ISCONTAINED() as a static function
The first one (macro) segfaults, the second one (static) works as a expected.
The only obvious change I made in the static version is that the size argument
is not signed but unsigned. Changing the type of sb_size to signed int results
in the segfault again.
I saw this problem with gcc-4.8 and 4.9. gcc 4.7 seems not to miss compile it.
Comparing the disassemble between those two .i I see:
- macro
+ static
<label>:
- 8b 44 24 44 mov 0x44(%esp),%eax
- 89 c1 mov %eax,%ecx
+ 8b 44 24 20 mov 0x20(%esp),%eax
+ 85 c0 test %eax,%eax
+ 0f 84 8c fb ff ff je 3f0 <petite_inflate2x_1to9+0x3f0>
+ 8b 4c 24 58 mov 0x58(%esp),%ecx
+ 8b 44 24 20 mov 0x20(%esp),%eax
For me as a no-compiler guy it looks like the zero check has been removed
because for
some reason the size argument has to be != 0.
I'm not sure if this is related but #26763 fixed a problem with the same macro.
Sebastian