public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/103530] New: ICE: in execute, at gimple-harden-conditionals.cc:397 with -O -fharden-compares
@ 2021-12-02 13:32 zsojka at seznam dot cz
2021-12-02 14:17 ` [Bug middle-end/103530] " marxin at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: zsojka at seznam dot cz @ 2021-12-02 13:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103530
Bug ID: 103530
Summary: ICE: in execute, at gimple-harden-conditionals.cc:397
with -O -fharden-compares
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: zsojka at seznam dot cz
Target Milestone: ---
Host: x86_64-pc-linux-gnu
Created attachment 51923
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51923&action=edit
reduced testcase
This seems to be different from PR103024
Compiler output:
$ x86_64-pc-linux-gnu-gcc -O -fharden-compares testcase.C
during GIMPLE pass: hardcmp
testcase.C: In function 'void foo(E)':
testcase.C:15:1: internal compiler error: in execute, at
gimple-harden-conditionals.cc:397
15 | foo (E)
| ^~~
0xd6e750 execute
/repo/gcc-trunk/gcc/gimple-harden-conditionals.cc:397
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r12-5705-20211202014655-g1c5317d6214-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--with-cloog --with-ppl --with-isl --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
--with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r12-5705-20211202014655-g1c5317d6214-checking-yes-rtl-df-extra-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.0 20211202 (experimental) (GCC)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/103530] ICE: in execute, at gimple-harden-conditionals.cc:397 with -O -fharden-compares
2021-12-02 13:32 [Bug middle-end/103530] New: ICE: in execute, at gimple-harden-conditionals.cc:397 with -O -fharden-compares zsojka at seznam dot cz
@ 2021-12-02 14:17 ` marxin at gcc dot gnu.org
2021-12-02 23:03 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-02 14:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103530
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
CC| |marxin at gcc dot gnu.org
Last reconfirmed| |2021-12-02
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, started with r12-4759-g95bb87b2458bfab4.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/103530] ICE: in execute, at gimple-harden-conditionals.cc:397 with -O -fharden-compares
2021-12-02 13:32 [Bug middle-end/103530] New: ICE: in execute, at gimple-harden-conditionals.cc:397 with -O -fharden-compares zsojka at seznam dot cz
2021-12-02 14:17 ` [Bug middle-end/103530] " marxin at gcc dot gnu.org
@ 2021-12-02 23:03 ` pinskia at gcc dot gnu.org
2021-12-03 9:57 ` aoliva at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-02 23:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103530
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
gcc_checking_assert (TREE_CODE (TREE_TYPE (lhs)) == BOOLEAN_TYPE);
This assert is incorrect because useless_type_conversion_p has the following
code:
/* If both the inner and outer types are integral types, then the
conversion is not necessary if they have the same mode and
signedness and precision, and both or neither are boolean. */
if (INTEGRAL_TYPE_P (inner_type)
&& INTEGRAL_TYPE_P (outer_type))
{
/* Preserve changes in signedness or precision. */
if (TYPE_UNSIGNED (inner_type) != TYPE_UNSIGNED (outer_type)
|| TYPE_PRECISION (inner_type) != TYPE_PRECISION (outer_type))
return false;
/* Preserve conversions to/from BOOLEAN_TYPE if types are not
of precision one. */
if (((TREE_CODE (inner_type) == BOOLEAN_TYPE)
!= (TREE_CODE (outer_type) == BOOLEAN_TYPE))
&& TYPE_PRECISION (outer_type) != 1)
return false;
/* We don't need to preserve changes in the types minimum or
maximum value in general as these do not generate code
unless the types precisions are different. */
return true;
}
Which means if the precision is 1 of the integer type (and boolean is also
prevision of 1), then the cast between BOOLEAN_TYPE and that integer type will
be removed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/103530] ICE: in execute, at gimple-harden-conditionals.cc:397 with -O -fharden-compares
2021-12-02 13:32 [Bug middle-end/103530] New: ICE: in execute, at gimple-harden-conditionals.cc:397 with -O -fharden-compares zsojka at seznam dot cz
2021-12-02 14:17 ` [Bug middle-end/103530] " marxin at gcc dot gnu.org
2021-12-02 23:03 ` pinskia at gcc dot gnu.org
@ 2021-12-03 9:57 ` aoliva at gcc dot gnu.org
2021-12-09 2:38 ` cvs-commit at gcc dot gnu.org
2021-12-09 2:53 ` aoliva at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: aoliva at gcc dot gnu.org @ 2021-12-03 9:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103530
Alexandre Oliva <aoliva at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |aoliva at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #3 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Mine
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/103530] ICE: in execute, at gimple-harden-conditionals.cc:397 with -O -fharden-compares
2021-12-02 13:32 [Bug middle-end/103530] New: ICE: in execute, at gimple-harden-conditionals.cc:397 with -O -fharden-compares zsojka at seznam dot cz
` (2 preceding siblings ...)
2021-12-03 9:57 ` aoliva at gcc dot gnu.org
@ 2021-12-09 2:38 ` cvs-commit at gcc dot gnu.org
2021-12-09 2:53 ` aoliva at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-09 2:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103530
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Alexandre Oliva <aoliva@gcc.gnu.org>:
https://gcc.gnu.org/g:2bff91f3b4e6f697823a261222186f4b5b052e86
commit r12-5851-g2bff91f3b4e6f697823a261222186f4b5b052e86
Author: Alexandre Oliva <oliva@adacore.com>
Date: Wed Dec 8 23:37:09 2021 -0300
[PR103024,PR103530] support throwing compares and non-boolean types
This patch adjusts the harden-compares pass to cope with compares that
end basic blocks, and to accept non-boolean integral types whose
conversion to boolean may have been discarded.
for gcc/ChangeLog
PR tree-optimization/103024
PR middle-end/103530
* gimple-harden-conditionals.cc (non_eh_succ_edge): New.
(pass_harden_compares::execute): Accept 1-bit integral types,
and cope with throwing compares.
for gcc/testsuite/ChangeLog
PR tree-optimization/103024
PR middle-end/103530
* g++.dg/pr103024.C: New.
* g++.dg/pr103530.C: New.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/103530] ICE: in execute, at gimple-harden-conditionals.cc:397 with -O -fharden-compares
2021-12-02 13:32 [Bug middle-end/103530] New: ICE: in execute, at gimple-harden-conditionals.cc:397 with -O -fharden-compares zsojka at seznam dot cz
` (3 preceding siblings ...)
2021-12-09 2:38 ` cvs-commit at gcc dot gnu.org
@ 2021-12-09 2:53 ` aoliva at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: aoliva at gcc dot gnu.org @ 2021-12-09 2:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103530
Alexandre Oliva <aoliva at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #5 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Fixed
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-12-09 2:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-02 13:32 [Bug middle-end/103530] New: ICE: in execute, at gimple-harden-conditionals.cc:397 with -O -fharden-compares zsojka at seznam dot cz
2021-12-02 14:17 ` [Bug middle-end/103530] " marxin at gcc dot gnu.org
2021-12-02 23:03 ` pinskia at gcc dot gnu.org
2021-12-03 9:57 ` aoliva at gcc dot gnu.org
2021-12-09 2:38 ` cvs-commit at gcc dot gnu.org
2021-12-09 2:53 ` aoliva 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).