public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115511] New: ICE on ambigous overload for _Float32
@ 2024-06-16 14:06 dv at vollmann dot ch
2024-06-16 14:18 ` [Bug c++/115511] " pinskia at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: dv at vollmann dot ch @ 2024-06-16 14:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115511
Bug ID: 115511
Summary: ICE on ambigous overload for _Float32
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: dv at vollmann dot ch
Target Milestone: ---
Target: avr
Created attachment 58445
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58445&action=edit
Output from -freport-bug
On AVR for the default model float and double both are 32 bit.
When calling with a _Float32, I get an internal compiler error with this
program:
void f1(float x);
void f1(double x);
void f2(_Float32 x)
{
f1(x);
}
I don't know the rules for _Float32 (this is an extremly stripped version of
the cmath header), but the program is probably ill-formed.
But still an error message would be nicer than an ICE ;-)
I used the AVR target, but this may be a problem on other targets where float
and double are the same size.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/115511] ICE on ambigous overload for _Float32
2024-06-16 14:06 [Bug c++/115511] New: ICE on ambigous overload for _Float32 dv at vollmann dot ch
@ 2024-06-16 14:18 ` pinskia at gcc dot gnu.org
2024-06-17 5:45 ` dv at vollmann dot ch
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-16 14:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115511
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2024-06-16
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. I thought I had saw this before but I can't seem to find the bug
report.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/115511] ICE on ambigous overload for _Float32
2024-06-16 14:06 [Bug c++/115511] New: ICE on ambigous overload for _Float32 dv at vollmann dot ch
2024-06-16 14:18 ` [Bug c++/115511] " pinskia at gcc dot gnu.org
@ 2024-06-17 5:45 ` dv at vollmann dot ch
2024-06-17 5:57 ` pinskia at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: dv at vollmann dot ch @ 2024-06-17 5:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115511
--- Comment #2 from dv at vollmann dot ch ---
On 6/16/24 16:18, pinskia at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115511
>
> Andrew Pinski <pinskia at gcc dot gnu.org> changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> Last reconfirmed| |2024-06-16
> Status|UNCONFIRMED |NEW
> Ever confirmed|0 |1
>
> --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
> Confirmed. I thought I had saw this before but I can't seem to find the bug
> report.
I searched again, and found this one:
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111343>
It looks like my report is a duplicate of 111343.
Detlef
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/115511] ICE on ambigous overload for _Float32
2024-06-16 14:06 [Bug c++/115511] New: ICE on ambigous overload for _Float32 dv at vollmann dot ch
2024-06-16 14:18 ` [Bug c++/115511] " pinskia at gcc dot gnu.org
2024-06-17 5:45 ` dv at vollmann dot ch
@ 2024-06-17 5:57 ` pinskia at gcc dot gnu.org
2024-06-17 8:47 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-17 5:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115511
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to dv from comment #2)
>
> It looks like my report is a duplicate of 111343.
That was the one which I was thinking of too :). I will clean up the recording
of this tomorrow. one for the C++ ICE and one maybe for the libstdc++.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/115511] ICE on ambigous overload for _Float32
2024-06-16 14:06 [Bug c++/115511] New: ICE on ambigous overload for _Float32 dv at vollmann dot ch
` (2 preceding siblings ...)
2024-06-17 5:57 ` pinskia at gcc dot gnu.org
@ 2024-06-17 8:47 ` jakub at gcc dot gnu.org
2024-06-17 10:32 ` dv at vollmann dot ch
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-06-17 8:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115511
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Untested fix below. I wasn't aware any targets would actually have float the
same as double. C++23 says here:
http://eel.is/c++draft/conv.rank#2.2 that double has higher rank than float
http://eel.is/c++draft/conv.rank#2.5 and that extended type with same set of
values as 2+ standard types has same rank as double. As I've only thought
about the double same as long double case, I've only handled that case there.
No testcase for testsuite, as this needs to be tested in avr/sh specific
g++.target only and needs proper options/effective target macros to find out if
that is really the float same as double configuration. Will defer testcases to
the respective target maintainers.
2024-06-17 Jakub Jelinek <jakub@redhat.com>
PR target/111343
PR c++/115511
* typeck.cc (cp_compare_floating_point_conversion_ranks): If an
extended floating point type mv1 has same set of values as more
than one standard floating point type and mv2 is float, return 2.
--- gcc/cp/typeck.cc.jj 2024-06-04 13:19:03.755604346 +0200
+++ gcc/cp/typeck.cc 2024-06-17 10:32:02.063088961 +0200
@@ -393,6 +393,9 @@ cp_compare_floating_point_conversion_ran
has higher rank. */
if (cnt > 1 && mv2 == long_double_type_node)
return -2;
+ /* And similarly if t2 is float, t2 has lower rank. */
+ if (cnt > 1 && mv2 == float_type_node)
+ return 2;
/* Otherwise, they have equal rank, but extended types
(other than std::bfloat16_t) have higher subrank.
std::bfloat16_t shouldn't have equal rank to any standard
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/115511] ICE on ambigous overload for _Float32
2024-06-16 14:06 [Bug c++/115511] New: ICE on ambigous overload for _Float32 dv at vollmann dot ch
` (3 preceding siblings ...)
2024-06-17 8:47 ` jakub at gcc dot gnu.org
@ 2024-06-17 10:32 ` dv at vollmann dot ch
2024-06-17 16:59 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: dv at vollmann dot ch @ 2024-06-17 10:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115511
--- Comment #5 from dv at vollmann dot ch ---
On 6/17/24 10:47, jakub at gcc dot gnu.org wrote:
> --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> Untested fix below.
I did a quick test for AVR and it worked :-)
I'll now do a full build of libstdc++ and see how it works.\
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/115511] ICE on ambigous overload for _Float32
2024-06-16 14:06 [Bug c++/115511] New: ICE on ambigous overload for _Float32 dv at vollmann dot ch
` (4 preceding siblings ...)
2024-06-17 10:32 ` dv at vollmann dot ch
@ 2024-06-17 16:59 ` cvs-commit at gcc dot gnu.org
2024-06-17 17:19 ` cvs-commit at gcc dot gnu.org
2024-06-17 17:23 ` cvs-commit at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-17 16:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115511
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:8584c98f370cd91647c184ce58141508ca478a12
commit r15-1380-g8584c98f370cd91647c184ce58141508ca478a12
Author: Jakub Jelinek <jakub@redhat.com>
Date: Mon Jun 17 18:53:21 2024 +0200
c++: Fix up floating point conversion rank comparison for _Float32 and
float if float/double are same size [PR115511]
On AVR and SH with some options sizeof (float) == sizeof (double) and
the 2 types have the same set of values.
http://eel.is/c++draft/conv.rank#2.2 for this says that double still
has bigger rank than float and http://eel.is/c++draft/conv.rank#2.2
says that extended type with the same set of values as more than one
standard floating point type shall have the same rank as double.
I've implemented the latter rule as
if (cnt > 1 && mv2 == long_double_type_node)
return -2;
with the _Float64/double/long double case having same mode case (various
targets with -mlong-double-64) in mind.
But never thought there are actually targets where float and double
are the same, that needs handling too, if cnt > 1 (that is the extended
type mv1 has same set of values as 2 or 3 of float/double/long double)
and mv2 is float, we need to return 2, because mv1 in that case should
have same rank as double and double has bigger rank than float.
2024-06-17 Jakub Jelinek <jakub@redhat.com>
PR target/111343
PR c++/115511
* typeck.cc (cp_compare_floating_point_conversion_ranks): If an
extended floating point type mv1 has same set of values as more
than one standard floating point type and mv2 is float, return 2.
* g++.dg/cpp23/ext-floating18.C: New test.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/115511] ICE on ambigous overload for _Float32
2024-06-16 14:06 [Bug c++/115511] New: ICE on ambigous overload for _Float32 dv at vollmann dot ch
` (5 preceding siblings ...)
2024-06-17 16:59 ` cvs-commit at gcc dot gnu.org
@ 2024-06-17 17:19 ` cvs-commit at gcc dot gnu.org
2024-06-17 17:23 ` cvs-commit at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-17 17:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115511
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:5be6d9d2a9854c05f3c019deb9fe95eca7248140
commit r14-10321-g5be6d9d2a9854c05f3c019deb9fe95eca7248140
Author: Jakub Jelinek <jakub@redhat.com>
Date: Mon Jun 17 18:53:21 2024 +0200
c++: Fix up floating point conversion rank comparison for _Float32 and
float if float/double are same size [PR115511]
On AVR and SH with some options sizeof (float) == sizeof (double) and
the 2 types have the same set of values.
http://eel.is/c++draft/conv.rank#2.2 for this says that double still
has bigger rank than float and http://eel.is/c++draft/conv.rank#2.2
says that extended type with the same set of values as more than one
standard floating point type shall have the same rank as double.
I've implemented the latter rule as
if (cnt > 1 && mv2 == long_double_type_node)
return -2;
with the _Float64/double/long double case having same mode case (various
targets with -mlong-double-64) in mind.
But never thought there are actually targets where float and double
are the same, that needs handling too, if cnt > 1 (that is the extended
type mv1 has same set of values as 2 or 3 of float/double/long double)
and mv2 is float, we need to return 2, because mv1 in that case should
have same rank as double and double has bigger rank than float.
2024-06-17 Jakub Jelinek <jakub@redhat.com>
PR target/111343
PR c++/115511
* typeck.cc (cp_compare_floating_point_conversion_ranks): If an
extended floating point type mv1 has same set of values as more
than one standard floating point type and mv2 is float, return 2.
* g++.dg/cpp23/ext-floating18.C: New test.
(cherry picked from commit 8584c98f370cd91647c184ce58141508ca478a12)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/115511] ICE on ambigous overload for _Float32
2024-06-16 14:06 [Bug c++/115511] New: ICE on ambigous overload for _Float32 dv at vollmann dot ch
` (6 preceding siblings ...)
2024-06-17 17:19 ` cvs-commit at gcc dot gnu.org
@ 2024-06-17 17:23 ` cvs-commit at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-17 17:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115511
--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:6d0a0c547a6c8425d432129fc90869305fef7bc2
commit r13-8853-g6d0a0c547a6c8425d432129fc90869305fef7bc2
Author: Jakub Jelinek <jakub@redhat.com>
Date: Mon Jun 17 18:53:21 2024 +0200
c++: Fix up floating point conversion rank comparison for _Float32 and
float if float/double are same size [PR115511]
On AVR and SH with some options sizeof (float) == sizeof (double) and
the 2 types have the same set of values.
http://eel.is/c++draft/conv.rank#2.2 for this says that double still
has bigger rank than float and http://eel.is/c++draft/conv.rank#2.2
says that extended type with the same set of values as more than one
standard floating point type shall have the same rank as double.
I've implemented the latter rule as
if (cnt > 1 && mv2 == long_double_type_node)
return -2;
with the _Float64/double/long double case having same mode case (various
targets with -mlong-double-64) in mind.
But never thought there are actually targets where float and double
are the same, that needs handling too, if cnt > 1 (that is the extended
type mv1 has same set of values as 2 or 3 of float/double/long double)
and mv2 is float, we need to return 2, because mv1 in that case should
have same rank as double and double has bigger rank than float.
2024-06-17 Jakub Jelinek <jakub@redhat.com>
PR target/111343
PR c++/115511
* typeck.cc (cp_compare_floating_point_conversion_ranks): If an
extended floating point type mv1 has same set of values as more
than one standard floating point type and mv2 is float, return 2.
* g++.dg/cpp23/ext-floating18.C: New test.
(cherry picked from commit 8584c98f370cd91647c184ce58141508ca478a12)
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-06-17 17:23 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-16 14:06 [Bug c++/115511] New: ICE on ambigous overload for _Float32 dv at vollmann dot ch
2024-06-16 14:18 ` [Bug c++/115511] " pinskia at gcc dot gnu.org
2024-06-17 5:45 ` dv at vollmann dot ch
2024-06-17 5:57 ` pinskia at gcc dot gnu.org
2024-06-17 8:47 ` jakub at gcc dot gnu.org
2024-06-17 10:32 ` dv at vollmann dot ch
2024-06-17 16:59 ` cvs-commit at gcc dot gnu.org
2024-06-17 17:19 ` cvs-commit at gcc dot gnu.org
2024-06-17 17:23 ` 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).