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

            Bug ID: 108522
           Summary: [Regression 12/13] ICE in tree-object-size when struct
                    has VLA
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: siddhesh at gcc dot gnu.org
  Target Milestone: ---

Reproducer:

__SIZE_TYPE__ foo (unsigned int n)
{
 struct {
  unsigned char a[n];
  unsigned char b;
 } s;

 return __builtin_dynamic_object_size (&s.b, 1);
}

$ gcc/cc1 -quiet ../repro.cc -O2 -Wall -o -
        .file   "repro.cc"
        .text
during GIMPLE pass: objsz
../repro.cc: In function ‘foo’:
../repro.cc:1:15: internal compiler error: in execute_todo, at passes.cc:2140
    1 | __SIZE_TYPE__ foo (unsigned int n)
      |               ^~~
0x72216f execute_todo
        ../../gcc/passes.cc:2140
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Looks like getting the size of object for a pointer right after a VLA in a
struct results in an ICE.  I'm on it.

Reply via email to