[Bug c/84600] New: function inlining is confused by char * type cast

popinet at basilisk dot fr gcc-bugzilla@gcc.gnu.org
Tue Feb 27 17:26:00 GMT 2018


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

            Bug ID: 84600
           Summary: function inlining is confused by char * type cast
           Product: gcc
           Version: 6.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: popinet at basilisk dot fr
  Target Milestone: ---

Created attachment 43521
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43521&action=edit
test.c

The attached code fails when run using:

gcc -Wall -Wextra -O2 test.c -o test && ./test

using -O1 or -fno-strict-aliasing or not using inlining fixes the problem.
Switching to gcc versions < 6 or to clang 3.8.1 also fixes the problem, as do
the various modifications suggested as comments in the code.

The fact that uncommenting the (always true) condition fixes the problem is
particularly curious.

Thank you for your attention.


More information about the Gcc-bugs mailing list