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

            Bug ID: 122012
           Summary: Internal compiler error in check_for_plus_in_loops on
                    aarch64 with -Os
           Product: gcc
           Version: 15.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: j.ne at posteo dot net
  Target Milestone: ---

The following C program causes an internal compiler error in GCC 15.2.0 and
16.0.0 20250919, when compiling for aarch64 with -Os:

// -------------------------------------- //
void bar();
extern inline int foo(char * s) {
        if (__builtin_object_size(s, 2))
                bar();
}
void loop() {
        int n;
        while (1) {
                char *t;
                t += foo(t);
                if (n)
                        continue;
        }
}
// -------------------------------------- //

$ gcc --version
gcc (Alpine 15.2.0) 15.2.0
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gcc -Os -freport-bug file.c
during GIMPLE pass: objsz
file.c: In function 'loop':
file.c:7:6: internal compiler error: in check_for_plus_in_loops, at
tree-object-size.cc:2158
    7 | void loop() {
      |      ^~~~
0xffff7be7e6cf libc_start_main_stage2
        src/env/__libc_start_main.c:95
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <https://gitlab.alpinelinux.org/alpine/aports/-/issues> for instructions.
Preprocessed source stored into /tmp/cccaABhC.out file, please attach this to
your bugreport.

Reply via email to