[Bug c/97206] [11 Regression] internal compiler error: in composite_type, at c/c-typeck.c:447 since r11-3303-g6450f07388f9fe57

2020-09-30 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97206

Martin Sebor  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #9 from Martin Sebor  ---
Fixed in r11-3570.

[Bug c/97206] [11 Regression] internal compiler error: in composite_type, at c/c-typeck.c:447 since r11-3303-g6450f07388f9fe57

2020-09-30 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97206

--- Comment #8 from CVS Commits  ---
The master branch has been updated by Martin Sebor :

https://gcc.gnu.org/g:e808f3fdfa8f31066da19011b55acb8c0446c72d

commit r11-3570-ge808f3fdfa8f31066da19011b55acb8c0446c72d
Author: Martin Sebor 
Date:   Wed Sep 30 09:31:29 2020 -0600

PR c/97206 - ICE in composite_type on declarations of a similar array types

gcc/ChangeLog:

PR c/97206
* attribs.c (attr_access::array_as_string): Avoid modifying a
shared
type in place and use build_type_attribute_qual_variant instead.

gcc/testsuite/ChangeLog:

PR c/97206
* gcc.dg/Warray-parameter-7.c: New test.
* gcc.dg/Warray-parameter-8.c: New test.
* gcc.dg/Wvla-parameter-5.c: New test.

[Bug c/97206] [11 Regression] internal compiler error: in composite_type, at c/c-typeck.c:447 since r11-3303-g6450f07388f9fe57

2020-09-29 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97206

Martin Sebor  changed:

   What|Removed |Added

   Keywords||ice-on-valid-code, patch

--- Comment #7 from Martin Sebor  ---
Patch: https://gcc.gnu.org/pipermail/gcc-patches/2020-September/555125.html

[Bug c/97206] [11 Regression] internal compiler error: in composite_type, at c/c-typeck.c:447 since r11-3303-g6450f07388f9fe57

2020-09-29 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97206

--- Comment #6 from Martin Sebor  ---
Testing this fix:

diff --git a/gcc/attribs.c b/gcc/attribs.c
index abc75368e6c..262e4b8f7b9 100644
--- a/gcc/attribs.c
+++ b/gcc/attribs.c
@@ -2278,7 +2278,7 @@ attr_access::array_as_string (tree type) const
   else  if (minsize)
index_type = build_index_type (size_int (minsize - 1));

-  artype = build_array_type (eltype, index_type);
+  artype = build_nonshared_array_type (eltype, index_type);

   if (static_p || vla_p)
{

[Bug c/97206] [11 Regression] internal compiler error: in composite_type, at c/c-typeck.c:447 since r11-3303-g6450f07388f9fe57

2020-09-28 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97206

Martin Sebor  changed:

   What|Removed |Added

 CC||jsm28 at gcc dot gnu.org

--- Comment #5 from Martin Sebor  ---
Joseph, any idea what might be causing this?  The test case in comment #4 has
me stumped.

[Bug c/97206] [11 Regression] internal compiler error: in composite_type, at c/c-typeck.c:447 since r11-3303-g6450f07388f9fe57

2020-09-25 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97206

--- Comment #4 from Martin Sebor  ---
A different/simpler test case that doesn't involve a call to
handle_access_attribute():

$ cat pr97206.c && gcc -O2 -S -Wall pr97206.c
void a (char *);
void a (char [restrict]);

extern const char b[];
extern const char b[1];
pr97206.c:5:19: error: conflicting type qualifiers for ‘b’
5 | extern const char b[1];
  |   ^
pr97206.c:4:19: note: previous declaration of ‘b’ was here
4 | extern const char b[];
  |   ^

[Bug c/97206] [11 Regression] internal compiler error: in composite_type, at c/c-typeck.c:447 since r11-3303-g6450f07388f9fe57

2020-09-25 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97206

Martin Sebor  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |msebor at gcc dot 
gnu.org

--- Comment #3 from Martin Sebor  ---
Hmm, this one is strange.  Somehow the qualifiers on the pointer argument (but
not the type it points to) in the function argument list are ending up in the
type of the array with unspecified bound.  The error is then issued in
diagnose_mismatched_decls when verifying that the qualifiers on the array type
are the same between the two declarations of b.

Something about the change to handle_access_attribute in r11-3303 is causing
the restrict qualifier (or any other qualifier on the pointer argument,
including const and volatile) to be set on the type of the array.

Another test case that reproduces it is:

$ cat pr97206.c && gcc -O2 -S -Wall pr97206.c
void a (char * volatile);
__attribute__((__access__ (__read_only__, 1))) void a (char *volatile);

extern const char b[];
extern const char b[1];
pr97206.c:5:19: error: conflicting type qualifiers for ‘b’
5 | extern const char b[1];
  |   ^
pr97206.c:4:19: note: previous declaration of ‘b’ was here
4 | extern const char b[];
  |   ^

[Bug c/97206] [11 Regression] internal compiler error: in composite_type, at c/c-typeck.c:447 since r11-3303-g6450f07388f9fe57

2020-09-25 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97206

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |11.0

[Bug c/97206] [11 Regression] internal compiler error: in composite_type, at c/c-typeck.c:447 since r11-3303-g6450f07388f9fe57

2020-09-25 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97206

Martin Liška  changed:

   What|Removed |Added

  Known to work||10.2.0
   Last reconfirmed||2020-09-25
Summary|[11-regression]  internal   |[11 Regression]  internal
   |compiler error: in  |compiler error: in
   |composite_type, at  |composite_type, at
   |c/c-typeck.c:447|c/c-typeck.c:447 since
   ||r11-3303-g6450f07388f9fe57
 Status|UNCONFIRMED |NEW
  Known to fail||11.0
 CC||marxin at gcc dot gnu.org,
   ||msebor at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #2 from Martin Liška  ---
Confirmed, started with r11-3303-g6450f07388f9fe57.

[Bug c/97206] [11-regression] internal compiler error: in composite_type, at c/c-typeck.c:447

2020-09-25 Thread slyfox at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97206

--- Comment #1 from Sergei Trofimovich  ---
Testcase 2: something related happens to wavpack-5.3.2 package where gcc
stopped typechecking array declarations:

  char *a(char *__restrict, int);
  __attribute__((__access__(__write_only__, 1))) char *a(char *, int);
  extern const char b[6];
  extern const char b[];

$ gcc-10.2.0 -c a.c -o a.o
$ gcc-11.0.0 -c a.c -o a.o
a.c:4:19: error: conflicting type qualifiers for 'b'
4 | extern const char b[];
  |   ^
a.c:3:19: note: previous declaration of 'b' was here
3 | extern const char b[6];
  |   ^

Note: presence of seemingly unrelated 'a' declaration affects 'b' typechecking.