[Bug c/108375] New: [10/11/12/13 Regression] Some variably modified types not detected as such

jsm28 at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jan 11 18:44:04 GMT 2023


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

            Bug ID: 108375
           Summary: [10/11/12/13 Regression] Some variably modified types
                    not detected as such
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jsm28 at gcc dot gnu.org
  Target Milestone: ---

variably_modified_type_p fails to detect an array type as variably modified if
the array and its element type are of constant size but the element type is
variably modified. For example, the following code should be diagnosed as
invalid, but is not (similar rejects-valid or wrong-code examples could no
doubt be constructed as well).

void
f (int a)
{
  typedef int A[a];
  goto x;
  A *p[2];
  x : ;
}

This is a regression in 4.2 and later relative to older versions, I think
introduced by g:2e3b8fe7b5405a94d86bfa323c0e80e83c58d784 .

commit 2e3b8fe7b5405a94d86bfa323c0e80e83c58d784
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Wed May 17 13:11:09 2006 +0000

    tree.c (variably_modified_type_p): Return true if the element type is
variably modified without recursing.

            * tree.c (variably_modified_type_p) <ARRAY_TYPE>: Return true
            if the element type is variably modified without recursing.

    From-SVN: r113858


More information about the Gcc-bugs mailing list