[Bug middle-end/89288] ICE in tree_code_size, at tree.c:865

2019-04-12 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89288

--- Comment #5 from Martin Sebor  ---
Author: msebor
Date: Fri Apr 12 22:37:12 2019
New Revision: 270331

URL: https://gcc.gnu.org/viewcvs?rev=270331=gcc=rev
Log:
Commit a change missed in r270326:

gcc/c-family/ChangeLog:

PR c/88383
PR c/89288
PR c/89798
PR c/89797
* c-attribs.c (type_valid_for_vector_size): Detect excessively
large sizes.
(validate_attribute): Handle DECLs and expressions.
(has_attribute): Handle types referenced by expressions.
Avoid considering array attributes in ARRAY_REF expressions .


Modified:
trunk/gcc/c-family/c-attribs.c

[Bug middle-end/89288] ICE in tree_code_size, at tree.c:865

2019-04-12 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89288
Bug 89288 depends on bug 88383, which changed state.

Bug 88383 Summary: ICE calling _builtin_has_attribute with an expression
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88383

   What|Removed |Added

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

[Bug middle-end/89288] ICE in tree_code_size, at tree.c:865

2019-04-12 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89288

--- Comment #4 from Martin Sebor  ---
Author: msebor
Date: Fri Apr 12 19:01:17 2019
New Revision: 270326

URL: https://gcc.gnu.org/viewcvs?rev=270326=gcc=rev
Log:
PR c/88383 - ICE calling __builtin_has_attribute on a reference
PR c/89288 - ICE in tree_code_size, at tree.c:865
PR c/89798 - excessive vector_size silently accepted and truncated
PR c/89797 - ICE on a vector_size (1LU << 33) int variable

gcc/ChangeLog:

PR c/89797
* targhooks.c (default_vector_alignment): Avoid assuming
argument fits in SHWI.
* tree.h (TYPE_VECTOR_SUBPARTS): Avoid sign overflow in
a shift expression.
* doc/extend.texi (__builtin_has_attribute): Add a clarifying note.

gcc/c-family/ChangeLog:

PR c/88383
PR c/89288
PR c/89798
PR c/89797
* c-attribs.c (type_valid_for_vector_size): Detect excessively
large sizes.
(validate_attribute): Handle DECLs and expressions.
(has_attribute): Handle types referenced by expressions.
Avoid considering array attributes in ARRAY_REF expressions .

gcc/cp/ChangeLog:

PR c/88383
PR c/89288
* parser.c (cp_parser_has_attribute_expression): Handle assignment
expressions.

gcc/testsuite/ChangeLog:

PR c/88383
PR c/89288
PR c/89798
PR c/89797
* c-c++-common/attributes-1.c: Adjust.
* c-c++-common/builtin-has-attribute-6.c: New test.
* c-c++-common/builtin-has-attribute-7.c: New test.
* c-c++-common/builtin-has-attribute-4.c: Adjust expectations.
* c-c++-common/builtin-has-attribute-6.c: New test.
* c-c++-common/pr71574.c: Adjust.
* gcc.dg/pr25559.c: Adjust.
* gcc.dg/attr-vector_size.c: New test.


Added:
trunk/gcc/testsuite/c-c++-common/builtin-has-attribute-6.c
trunk/gcc/testsuite/c-c++-common/builtin-has-attribute-7.c
trunk/gcc/testsuite/gcc.dg/attr-vector_size.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/parser.c
trunk/gcc/targhooks.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/c-c++-common/attributes-1.c
trunk/gcc/testsuite/c-c++-common/builtin-has-attribute-4.c
trunk/gcc/testsuite/c-c++-common/pr71574.c
trunk/gcc/testsuite/gcc.dg/pr25559.c
trunk/gcc/tree.h

[Bug middle-end/89288] ICE in tree_code_size, at tree.c:865

2019-04-11 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89288

Richard Biener  changed:

   What|Removed |Added

   Priority|P1  |P3
   Target Milestone|9.0 |---
Summary|[9 Regression] ICE in   |ICE in tree_code_size, at
   |tree_code_size, at  |tree.c:865
   |tree.c:865  |

--- Comment #3 from Richard Biener  ---
Hmm, we don't seem to get consensus here.  I also don't see how this is
a regression, my GCC 8 compiler doesn't know __builtin_has_attribute.

So, removing the regression marker.

Can we, for GCC 9, simply say

 sorry ("unsupported argument to __builtin_has_attribute");

instead of ICEing and/or extending the specification in some ways?

For reference, GCC 8 says

t.c:1:22: warning: implicit declaration of function ‘__builtin_has_attribute’;
did you mean ‘__builtin_va_start’? [-Wimplicit-function-declaration]
 typedef int Assert [(__builtin_has_attribute (1, target("sse")) == 1)];
  ^~~
  __builtin_va_start
t.c:1:50: warning: implicit declaration of function ‘target’
[-Wimplicit-function-declaration]
 typedef int Assert [(__builtin_has_attribute (1, target("sse")) == 1)];
  ^~
t.c:1:13: error: variably modified ‘Assert’ at file scope
 typedef int Assert [(__builtin_has_attribute (1, target("sse")) == 1)];
 ^~