public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/102029] New: ice: error: type mismatch in ‘lshift_expr’
@ 2021-08-23 19:47 dcb314 at hotmail dot com
2021-08-23 19:50 ` [Bug middle-end/102029] [12 Regression] " pinskia at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: dcb314 at hotmail dot com @ 2021-08-23 19:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102029
Bug ID: 102029
Summary: ice: error: type mismatch in ‘lshift_expr’
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: dcb314 at hotmail dot com
Target Milestone: ---
For this C code:
$ more bug743.c
const long fmpz_neg_f2;
void qfb_reduce(void) { __gmpz_neg((int *)(fmpz_neg_f2 << 2)); }
$
Recent gcc trunk does this:
$ /home/dcb/gcc/results.20210823/bin/gcc -c -O2 bug743.c
bug743.c: In function ‘qfb_reduce’:
bug743.c:2:25: warning: implicit declaration of function ‘__gmpz_neg’
[-Wimplici
t-function-declaration]
2 | void qfb_reduce(void) { __gmpz_neg((int *)(fmpz_neg_f2 << 2)); }
| ^~~~~~~~~~
bug743.c:2:6: error: type mismatch in ‘lshift_expr’
2 | void qfb_reduce(void) { __gmpz_neg((int *)(fmpz_neg_f2 << 2)); }
| ^~~~~~~~~~
int *
int *
int
_3 = fmpz_neg_f2.1_2 << 2;
bug743.c:2:6: internal compiler error: ‘verify_gimple’ failed
0xd9532a verify_gimple_in_seq(gimple*)
../../trunk.git/gcc/tree-cfg.c:5183
The problem first seems to appear sometime between git hash
e92d0ff6b5e6d4b9 and 38757aa88735ab2e, about 40 commits.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/102029] [12 Regression] ice: error: type mismatch in ‘lshift_expr’
2021-08-23 19:47 [Bug c/102029] New: ice: error: type mismatch in ‘lshift_expr’ dcb314 at hotmail dot com
@ 2021-08-23 19:50 ` pinskia at gcc dot gnu.org
2021-08-23 19:51 ` pinskia at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-23 19:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102029
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
Target Milestone|--- |12.0
Summary|ice: error: type mismatch |[12 Regression] ice:
|in ‘lshift_expr’ |error: type mismatch in
| |‘lshift_expr’
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/102029] [12 Regression] ice: error: type mismatch in ‘lshift_expr’
2021-08-23 19:47 [Bug c/102029] New: ice: error: type mismatch in ‘lshift_expr’ dcb314 at hotmail dot com
2021-08-23 19:50 ` [Bug middle-end/102029] [12 Regression] " pinskia at gcc dot gnu.org
@ 2021-08-23 19:51 ` pinskia at gcc dot gnu.org
2021-08-23 20:21 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-23 19:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102029
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-08-23
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Caused by r12-3073.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/102029] [12 Regression] ice: error: type mismatch in ‘lshift_expr’
2021-08-23 19:47 [Bug c/102029] New: ice: error: type mismatch in ‘lshift_expr’ dcb314 at hotmail dot com
2021-08-23 19:50 ` [Bug middle-end/102029] [12 Regression] " pinskia at gcc dot gnu.org
2021-08-23 19:51 ` pinskia at gcc dot gnu.org
@ 2021-08-23 20:21 ` jakub at gcc dot gnu.org
2021-08-23 21:52 ` roger at nextmovesoftware dot com
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-08-23 20:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102029
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Slightly cleaned up testcase:
int *
foo (const __PTRDIFF_TYPE__ l)
{
return (int *) (l << 2);
}
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/102029] [12 Regression] ice: error: type mismatch in ‘lshift_expr’
2021-08-23 19:47 [Bug c/102029] New: ice: error: type mismatch in ‘lshift_expr’ dcb314 at hotmail dot com
` (2 preceding siblings ...)
2021-08-23 20:21 ` jakub at gcc dot gnu.org
@ 2021-08-23 21:52 ` roger at nextmovesoftware dot com
2021-08-24 2:00 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: roger at nextmovesoftware dot com @ 2021-08-23 21:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102029
Roger Sayle <roger at nextmovesoftware dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |roger at nextmovesoftware dot com
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |roger at nextmovesoftware dot com
--- Comment #3 from Roger Sayle <roger at nextmovesoftware dot com> ---
Here's the fix that I'm currently testing...
(simplify
(convert (lshift:s@0 (convert:s@1 @2) INTEGER_CST@3))
- (if (tree_nop_conversion_p (type, TREE_TYPE (@0))
+ (if (INTEGRAL_TYPE_P (type)
+ && !POINTER_TYPE_P (type)
+ && tree_nop_conversion_p (type, TREE_TYPE (@0))
&& INTEGRAL_TYPE_P (TREE_TYPE (@2))
&& TYPE_PRECISION (TREE_TYPE (@2)) <= TYPE_PRECISION (type))
(lshift (convert @2) @3)))
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/102029] [12 Regression] ice: error: type mismatch in ‘lshift_expr’
2021-08-23 19:47 [Bug c/102029] New: ice: error: type mismatch in ‘lshift_expr’ dcb314 at hotmail dot com
` (3 preceding siblings ...)
2021-08-23 21:52 ` roger at nextmovesoftware dot com
@ 2021-08-24 2:00 ` cvs-commit at gcc dot gnu.org
2021-08-24 7:14 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-08-24 2:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102029
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Roger Sayle <sayle@gcc.gnu.org>:
https://gcc.gnu.org/g:78fa5112b4c2dcd94b78ee79baddebbf14d6ad98
commit r12-3104-g78fa5112b4c2dcd94b78ee79baddebbf14d6ad98
Author: Roger Sayle <roger@nextmovesoftware.com>
Date: Tue Aug 24 02:59:02 2021 +0100
[Committed] PR middle-end/102029: Stricter typing in LSHIFT_EXPR sign
folding.
My sincere apologies to everyone (again). As diagnosed by
Jakub Jelinek, my recent patch to fold the signedness of LSHIFT_EXPR
needs to be careful not to attempt transforming a left shift in an
integer type into an invalid left shift of a pointer type.
2021-08-24 Roger Sayle <roger@nextmovesoftware.com>
Jakub Jelinek <jakub@redhat.com>
gcc/ChangeLog
PR middle-end/102029
* match.pd (shift transformations): Add an additional check for
!POINTER_TYPE_P in the recently added left shift transformation.
gcc/testsuite/ChangeLog
PR middle-end/102029
* gcc.dg/fold-convlshift-3.c: New test case.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/102029] [12 Regression] ice: error: type mismatch in ‘lshift_expr’
2021-08-23 19:47 [Bug c/102029] New: ice: error: type mismatch in ‘lshift_expr’ dcb314 at hotmail dot com
` (4 preceding siblings ...)
2021-08-24 2:00 ` cvs-commit at gcc dot gnu.org
@ 2021-08-24 7:14 ` rguenth at gcc dot gnu.org
2021-08-24 12:23 ` dje at gcc dot gnu.org
2021-08-26 17:52 ` cvs-commit at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-08-24 7:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102029
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Roger Sayle from comment #3)
> Here's the fix that I'm currently testing...
>
> (simplify
> (convert (lshift:s@0 (convert:s@1 @2) INTEGER_CST@3))
> - (if (tree_nop_conversion_p (type, TREE_TYPE (@0))
> + (if (INTEGRAL_TYPE_P (type)
> + && !POINTER_TYPE_P (type)
either of both is redundant, I think keeping INTEGRAL_TYPE_P is better.
> + && tree_nop_conversion_p (type, TREE_TYPE (@0))
> && INTEGRAL_TYPE_P (TREE_TYPE (@2))
> && TYPE_PRECISION (TREE_TYPE (@2)) <= TYPE_PRECISION (type))
> (lshift (convert @2) @3)))
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/102029] [12 Regression] ice: error: type mismatch in ‘lshift_expr’
2021-08-23 19:47 [Bug c/102029] New: ice: error: type mismatch in ‘lshift_expr’ dcb314 at hotmail dot com
` (5 preceding siblings ...)
2021-08-24 7:14 ` rguenth at gcc dot gnu.org
@ 2021-08-24 12:23 ` dje at gcc dot gnu.org
2021-08-26 17:52 ` cvs-commit at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: dje at gcc dot gnu.org @ 2021-08-24 12:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102029
David Edelsohn <dje at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dje at gcc dot gnu.org
--- Comment #6 from David Edelsohn <dje at gcc dot gnu.org> ---
This also had broken 32 bit powerpc, so I want to track any future updates.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/102029] [12 Regression] ice: error: type mismatch in ‘lshift_expr’
2021-08-23 19:47 [Bug c/102029] New: ice: error: type mismatch in ‘lshift_expr’ dcb314 at hotmail dot com
` (6 preceding siblings ...)
2021-08-24 12:23 ` dje at gcc dot gnu.org
@ 2021-08-26 17:52 ` cvs-commit at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-08-26 17:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102029
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Roger Sayle <sayle@gcc.gnu.org>:
https://gcc.gnu.org/g:a2d9b558299df91e9c34a583eb0f0b14d1cacce9
commit r12-3163-ga2d9b558299df91e9c34a583eb0f0b14d1cacce9
Author: Roger Sayle <roger@nextmovesoftware.com>
Date: Thu Aug 26 18:51:46 2021 +0100
[Committed] Tidy up !POINTER_TYPE_P test in match.pd LSHIFT_EXPR folding
As suggested by Richard Biener in the comments of PR middle-end/102029,
the new test "INTEGRAL_TYPE_P (type) && !POINTER_TYPE_P (type) ..." is
redundant, and just "INTEGRAL_TYPE_P (type)" is the preferred form.
2021-08-26 Roger Sayle <roger@nextmovesoftware.com>
Richard Biener <rguenther@suse.de>
gcc/ChangeLog
* match.pd (shift transformations): Remove a redundant
!POINTER_TYPE_P check.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-08-26 17:52 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-23 19:47 [Bug c/102029] New: ice: error: type mismatch in ‘lshift_expr’ dcb314 at hotmail dot com
2021-08-23 19:50 ` [Bug middle-end/102029] [12 Regression] " pinskia at gcc dot gnu.org
2021-08-23 19:51 ` pinskia at gcc dot gnu.org
2021-08-23 20:21 ` jakub at gcc dot gnu.org
2021-08-23 21:52 ` roger at nextmovesoftware dot com
2021-08-24 2:00 ` cvs-commit at gcc dot gnu.org
2021-08-24 7:14 ` rguenth at gcc dot gnu.org
2021-08-24 12:23 ` dje at gcc dot gnu.org
2021-08-26 17:52 ` cvs-commit 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).