[Bug tree-optimization/66974] -Warray-bounds false positive with -O3

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Nov 15 00:28:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66974

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org

--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to Ganesh Ajjanagadde from comment #2)

For what it's worth, telling gcc that the argument is constrained to the
limited range of values either by converting it like so:

    order = ((struct { unsigned order: 2; }){ order }).order;

or by declaring the function to take an argument of that type eliminates the
warnings and results in far simpler object code.


More information about the Gcc-bugs mailing list