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

            Bug ID: 121722
           Summary: wrong code generated with -O1 for a program using
                    _BitInt()
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kdudka at redhat dot com
  Target Milestone: ---

Created attachment 62235
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62235&action=edit
reproducer

The attached program (originally provided by Petr Peringer) misbehaves when
compiled with -O1 or higher:

using 129 bit numbers
fib(10) = 2 (should be 55)

I am able to reproduce it with gcc trunk.

Appending -fno-tree-coalesce-vars on the compiler command line makes the
problem go away.

The following bugs seem related:
bug #113372 - wrong code with _BitInt() arithmetics at -O1
bug #119808 - wrong code with _BitInt() and -ftree-coalesce-vars
-fstack-protector-strong
bug #119728 - wrong code with _BitInt() and -O2 -floop-nest-optimize
-fno-tree-dominator-opts -fno-tree-loop-distribute-patterns
-fno-tree-scev-cprop

Reply via email to