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

            Bug ID: 109334
           Summary: tree-object-size: Improve size computation in
                    arguments
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: siddhesh at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org, marxin at gcc dot gnu.org,
                    msebor at gcc dot gnu.org, muecker at gwdg dot de,
                    siddhesh at gcc dot gnu.org
        Depends on: 104970
  Target Milestone: ---

The fix for bug 104970 is too restrictive, size computation should also work
for VLA bounds and also cases where it could work without attributes in simple
cases, e.g.

size_t
__attribute__ ((noinline))
test_parmsz_internal3 (size_t sz1, size_t sz2, double obj[sz1][sz2])
{
  return __builtin_dynamic_object_size (obj, 0);
}

or

__attribute__ ((noinline, access (read_only, 2, 1)))
int foo(int n, int buf[n])
{
    buf[n] = 1;
    return __builtin_dynamic_object_size(buf, 0);
}

int main() {
    int n = 10;
    int buf[n];
    return foo(n, buf);
}


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104970
[Bug 104970] [12 Regression] ICE in execute_todo, at passes.cc:2133 since
r12-6480-gea19c8f33a3a8d2b

Reply via email to