public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94955] New: ICE in to_wide
@ 2020-05-05 15:18 hubicka at gcc dot gnu.org
2020-05-05 15:37 ` [Bug c++/94955] [10 regression] " mpolacek at gcc dot gnu.org
` (13 more replies)
0 siblings, 14 replies; 15+ messages in thread
From: hubicka at gcc dot gnu.org @ 2020-05-05 15:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94955
Bug ID: 94955
Summary: ICE in to_wide
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: hubicka at gcc dot gnu.org
Target Milestone: ---
Created attachment 48454
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48454&action=edit
proposed patch
This was reported to me by Mark Williams (who also did the testcase and
proposed patch)
% g++ -std=gnu++17 bug.ii -S -o bug.s
bug.ii: In function �void d()�:
bug.ii:6:32: internal compiler error: in sign_mask, at wide-int.h:855
6 | void d() { short e = e >> b::c(); }
| ^
0xa56be2 generic_wide_int<wide_int_ref_storage<false, false> >::sign_mask()
const
/home/engshare/third-party2/gcc/9.x/src/gcc-10.x/gcc/wide-int.h:855
0xa56be2 bool wi::neg_p<generic_wide_int<wide_int_ref_storage<false, false> >
>(generic_wide_int<wide_int_ref_storage<false, false> > const&, signop)
/home/engshare/third-party2/gcc/9.x/src/gcc-10.x/gcc/wide-int.h:1836
0xa56be2 tree_int_cst_sgn(tree_node const*)
/home/engshare/third-party2/gcc/9.x/src/gcc-10.x/gcc/tree.c:7386
0x1065e85 cp_build_binary_op(op_location_t const&, tree_code, tree_node*,
tree_node*, int)
/home/engshare/third-party2/gcc/9.x/src/gcc-10.x/gcc/cp/typeck.c:5613
0xfa9629 build_new_op_1
/home/engshare/third-party2/gcc/9.x/src/gcc-10.x/gcc/cp/call.c:6501
0xfa931d build_new_op(op_location_t const&, tree_code, int, tree_node*,
tree_node*, tree_node*, tree_node**, int)
/home/engshare/third-party2/gcc/9.x/src/gcc-10.x/gcc/cp/call.c:6547
0x106267f build_x_binary_op(op_location_t const&, tree_code, tree_node*,
tree_code, tree_node*, tree_code, tree_node**, int)
/home/engshare/third-party2/gcc/9.x/src/gcc-10.x/gcc/cp/typeck.c:4248
0x10162f0 cp_parser_binary_expression
/home/engshare/third-party2/gcc/9.x/src/gcc-10.x/gcc/cp/parser.c:9684
0x10157a4 cp_parser_assignment_expression
/home/engshare/third-party2/gcc/9.x/src/gcc-10.x/gcc/cp/parser.c:9824
0x1015380 cp_parser_constant_expression
/home/engshare/third-party2/gcc/9.x/src/gcc-10.x/gcc/cp/parser.c:10118
0x1015380 cp_parser_initializer_clause
/home/engshare/third-party2/gcc/9.x/src/gcc-10.x/gcc/cp/parser.c:23148
0x1015380 cp_parser_initializer
/home/engshare/third-party2/gcc/9.x/src/gcc-10.x/gcc/cp/parser.c:23086
0x1008ab0 cp_parser_init_declarator
/home/engshare/third-party2/gcc/9.x/src/gcc-10.x/gcc/cp/parser.c:20780
0x1006144 cp_parser_simple_declaration
/home/engshare/third-party2/gcc/9.x/src/gcc-10.x/gcc/cp/parser.c:13689
0x101df42 cp_parser_declaration_statement
/home/engshare/third-party2/gcc/9.x/src/gcc-10.x/gcc/cp/parser.c:13121
0x101a67c cp_parser_statement
/home/engshare/third-party2/gcc/9.x/src/gcc-10.x/gcc/cp/parser.c:11434
0x101a38a cp_parser_statement_seq_opt
/home/engshare/third-party2/gcc/9.x/src/gcc-10.x/gcc/cp/parser.c:11800
0x101a38a cp_parser_compound_statement
/home/engshare/third-party2/gcc/9.x/src/gcc-10.x/gcc/cp/parser.c:11750
0x101a0f9 cp_parser_function_body
/home/engshare/third-party2/gcc/9.x/src/gcc-10.x/gcc/cp/parser.c:22992
0x101a0f9 cp_parser_ctor_initializer_opt_and_function_body
/home/engshare/third-party2/gcc/9.x/src/gcc-10.x/gcc/cp/parser.c:23043
The problem was that it had previously used fold_for_warn to find an
INTEGER_CST, and assumed the cp_fold_rvalue would too. But fold_for_warn
handles some edge cases that cp_fold_rvalue does not, and in this case we end
up with a NOP_EXPR instead of the INTEGER_CST
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/94955] [10 regression] ICE in to_wide
2020-05-05 15:18 [Bug c++/94955] New: ICE in to_wide hubicka at gcc dot gnu.org
@ 2020-05-05 15:37 ` mpolacek at gcc dot gnu.org
2020-05-05 16:13 ` mpolacek at gcc dot gnu.org
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-05-05 15:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94955
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Can you provide the .ii file too?
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/94955] [10 regression] ICE in to_wide
2020-05-05 15:18 [Bug c++/94955] New: ICE in to_wide hubicka at gcc dot gnu.org
2020-05-05 15:37 ` [Bug c++/94955] [10 regression] " mpolacek at gcc dot gnu.org
@ 2020-05-05 16:13 ` mpolacek at gcc dot gnu.org
2020-05-05 16:15 ` hubicka at gcc dot gnu.org
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-05-05 16:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94955
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2020-05-05
Status|UNCONFIRMED |WAITING
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/94955] [10 regression] ICE in to_wide
2020-05-05 15:18 [Bug c++/94955] New: ICE in to_wide hubicka at gcc dot gnu.org
2020-05-05 15:37 ` [Bug c++/94955] [10 regression] " mpolacek at gcc dot gnu.org
2020-05-05 16:13 ` mpolacek at gcc dot gnu.org
@ 2020-05-05 16:15 ` hubicka at gcc dot gnu.org
2020-05-05 16:16 ` hubicka at gcc dot gnu.org
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: hubicka at gcc dot gnu.org @ 2020-05-05 16:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94955
--- Comment #2 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Created attachment 48455
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48455&action=edit
testcase
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/94955] [10 regression] ICE in to_wide
2020-05-05 15:18 [Bug c++/94955] New: ICE in to_wide hubicka at gcc dot gnu.org
` (2 preceding siblings ...)
2020-05-05 16:15 ` hubicka at gcc dot gnu.org
@ 2020-05-05 16:16 ` hubicka at gcc dot gnu.org
2020-05-05 16:33 ` [Bug c++/94955] [10/11 Regression] " mpolacek at gcc dot gnu.org
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: hubicka at gcc dot gnu.org @ 2020-05-05 16:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94955
Jan Hubicka <hubicka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/94955] [10/11 Regression] ICE in to_wide
2020-05-05 15:18 [Bug c++/94955] New: ICE in to_wide hubicka at gcc dot gnu.org
` (3 preceding siblings ...)
2020-05-05 16:16 ` hubicka at gcc dot gnu.org
@ 2020-05-05 16:33 ` mpolacek at gcc dot gnu.org
2020-05-06 19:20 ` mpolacek at gcc dot gnu.org
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-05-05 16:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94955
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |10.2
Summary|[10 regression] ICE in |[10/11 Regression] ICE in
|to_wide |to_wide
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r10-6527-gaaa26bf496a646778ac861aed124d960b5bf549f. I can take a
look.
I've set the target to 10.2, but someone might disagree.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/94955] [10/11 Regression] ICE in to_wide
2020-05-05 15:18 [Bug c++/94955] New: ICE in to_wide hubicka at gcc dot gnu.org
` (4 preceding siblings ...)
2020-05-05 16:33 ` [Bug c++/94955] [10/11 Regression] " mpolacek at gcc dot gnu.org
@ 2020-05-06 19:20 ` mpolacek at gcc dot gnu.org
2020-05-11 0:35 ` mpolacek at gcc dot gnu.org
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-05-06 19:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94955
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/94955] [10/11 Regression] ICE in to_wide
2020-05-05 15:18 [Bug c++/94955] New: ICE in to_wide hubicka at gcc dot gnu.org
` (5 preceding siblings ...)
2020-05-06 19:20 ` mpolacek at gcc dot gnu.org
@ 2020-05-11 0:35 ` mpolacek at gcc dot gnu.org
2020-05-11 12:28 ` john at mcfarlane dot name
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-05-11 0:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94955
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |john at mcfarlane dot name
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
*** Bug 95022 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/94955] [10/11 Regression] ICE in to_wide
2020-05-05 15:18 [Bug c++/94955] New: ICE in to_wide hubicka at gcc dot gnu.org
` (6 preceding siblings ...)
2020-05-11 0:35 ` mpolacek at gcc dot gnu.org
@ 2020-05-11 12:28 ` john at mcfarlane dot name
2020-05-18 23:06 ` cvs-commit at gcc dot gnu.org
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: john at mcfarlane dot name @ 2020-05-11 12:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94955
--- Comment #5 from John McFarlane <john at mcfarlane dot name> ---
I have applied a workaround and am not blocked:
https://github.com/johnmcfarlane/cnl/pull/589/commits/ca3478ed0002e5834227d7b6fa0010910aabc875
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/94955] [10/11 Regression] ICE in to_wide
2020-05-05 15:18 [Bug c++/94955] New: ICE in to_wide hubicka at gcc dot gnu.org
` (7 preceding siblings ...)
2020-05-11 12:28 ` john at mcfarlane dot name
@ 2020-05-18 23:06 ` cvs-commit at gcc dot gnu.org
2020-05-18 23:07 ` [Bug c++/94955] [10 " mpolacek at gcc dot gnu.org
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-18 23:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94955
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:2d4e1e144c25e526e4f668be5a0bc10d0c1c738c
commit r11-474-g2d4e1e144c25e526e4f668be5a0bc10d0c1c738c
Author: Marek Polacek <polacek@redhat.com>
Date: Wed May 6 15:53:33 2020 -0400
c++: ICE when shortening right shift [PR94955]
Since r10-6527 fold_for_warn calls maybe_constant_value, which means it
can fold more than it previously could. In this testcase it means that
cp_build_binary_op/RSHIFT_EXPR set short_shift because now we were able
to fold op1 to an INTEGER_CST. But then when actually performing the
shortening we crashed because cp_fold_rvalue wasn't able to fold as much
as f_f_w and so tree_int_cst_sgn crashed on a NOP_EXPR. Therefore the
calls should probably match.
PR c++/94955
* typeck.c (cp_build_binary_op): Use fold_for_warn instead of
cp_fold_rvalue.
* g++.dg/cpp0x/constexpr-shift2.C: New test.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/94955] [10 Regression] ICE in to_wide
2020-05-05 15:18 [Bug c++/94955] New: ICE in to_wide hubicka at gcc dot gnu.org
` (8 preceding siblings ...)
2020-05-18 23:06 ` cvs-commit at gcc dot gnu.org
@ 2020-05-18 23:07 ` mpolacek at gcc dot gnu.org
2020-05-19 16:55 ` mpolacek at gcc dot gnu.org
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-05-18 23:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94955
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[10/11 Regression] ICE in |[10 Regression] ICE in
|to_wide |to_wide
--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed on trunk so far.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/94955] [10 Regression] ICE in to_wide
2020-05-05 15:18 [Bug c++/94955] New: ICE in to_wide hubicka at gcc dot gnu.org
` (9 preceding siblings ...)
2020-05-18 23:07 ` [Bug c++/94955] [10 " mpolacek at gcc dot gnu.org
@ 2020-05-19 16:55 ` mpolacek at gcc dot gnu.org
2020-06-08 16:59 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-05-19 16:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94955
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |danny.schneider at posteo dot de
--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
*** Bug 95206 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/94955] [10 Regression] ICE in to_wide
2020-05-05 15:18 [Bug c++/94955] New: ICE in to_wide hubicka at gcc dot gnu.org
` (10 preceding siblings ...)
2020-05-19 16:55 ` mpolacek at gcc dot gnu.org
@ 2020-06-08 16:59 ` jakub at gcc dot gnu.org
2020-06-11 20:27 ` cvs-commit at gcc dot gnu.org
2020-06-11 20:27 ` mpolacek at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-06-08 16:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94955
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nmmm at nmmm dot nu
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
*** Bug 95579 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/94955] [10 Regression] ICE in to_wide
2020-05-05 15:18 [Bug c++/94955] New: ICE in to_wide hubicka at gcc dot gnu.org
` (11 preceding siblings ...)
2020-06-08 16:59 ` jakub at gcc dot gnu.org
@ 2020-06-11 20:27 ` cvs-commit at gcc dot gnu.org
2020-06-11 20:27 ` mpolacek at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-11 20:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94955
--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Marek Polacek
<mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:18436d87ff85282b200579cb8da496659632ad6b
commit r10-8277-g18436d87ff85282b200579cb8da496659632ad6b
Author: Marek Polacek <polacek@redhat.com>
Date: Thu Jun 11 16:26:41 2020 -0400
c++: ICE when shortening right shift [PR94955]
Since r10-6527 fold_for_warn calls maybe_constant_value, which means it
can fold more than it previously could. In this testcase it means that
cp_build_binary_op/RSHIFT_EXPR set short_shift because now we were able
to fold op1 to an INTEGER_CST. But then when actually performing the
shortening we crashed because cp_fold_rvalue wasn't able to fold as much
as f_f_w and so tree_int_cst_sgn crashed on a NOP_EXPR. Therefore the
calls should probably match.
PR c++/94955
* typeck.c (cp_build_binary_op): Use fold_for_warn instead of
cp_fold_rvalue.
* g++.dg/cpp0x/constexpr-shift2.C: New test.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/94955] [10 Regression] ICE in to_wide
2020-05-05 15:18 [Bug c++/94955] New: ICE in to_wide hubicka at gcc dot gnu.org
` (12 preceding siblings ...)
2020-06-11 20:27 ` cvs-commit at gcc dot gnu.org
@ 2020-06-11 20:27 ` mpolacek at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-06-11 20:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94955
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #11 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2020-06-11 20:27 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-05 15:18 [Bug c++/94955] New: ICE in to_wide hubicka at gcc dot gnu.org
2020-05-05 15:37 ` [Bug c++/94955] [10 regression] " mpolacek at gcc dot gnu.org
2020-05-05 16:13 ` mpolacek at gcc dot gnu.org
2020-05-05 16:15 ` hubicka at gcc dot gnu.org
2020-05-05 16:16 ` hubicka at gcc dot gnu.org
2020-05-05 16:33 ` [Bug c++/94955] [10/11 Regression] " mpolacek at gcc dot gnu.org
2020-05-06 19:20 ` mpolacek at gcc dot gnu.org
2020-05-11 0:35 ` mpolacek at gcc dot gnu.org
2020-05-11 12:28 ` john at mcfarlane dot name
2020-05-18 23:06 ` cvs-commit at gcc dot gnu.org
2020-05-18 23:07 ` [Bug c++/94955] [10 " mpolacek at gcc dot gnu.org
2020-05-19 16:55 ` mpolacek at gcc dot gnu.org
2020-06-08 16:59 ` jakub at gcc dot gnu.org
2020-06-11 20:27 ` cvs-commit at gcc dot gnu.org
2020-06-11 20:27 ` mpolacek at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).