public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/102924] New: incorrect output for error "cannot mix operands of decimal floating and other floating types"
@ 2021-10-25 9:22 vincent-gcc at vinc17 dot net
0 siblings, 0 replies; only message in thread
From: vincent-gcc at vinc17 dot net @ 2021-10-25 9:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102924
Bug ID: 102924
Summary: incorrect output for error "cannot mix operands of
decimal floating and other floating types"
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: vincent-gcc at vinc17 dot net
Target Milestone: ---
On the following C code
void foo (int i)
{
(void) (((float) 0 + (_Decimal64) 0) + ((float) 0 + (_Decimal64) 0));
(void) ((i ? (float) 0 : (_Decimal64) 0) == (i ? (float) 0 : (_Decimal64)
0));
(void) ((i ? (int *) 0 : (long *) 0) == (i ? (int *) 0 : (long *) 0));
}
GCC gives
tst.c: In function 'foo':
tst.c:3:3: error: cannot mix operands of decimal floating and other floating
types
3 | (void) (((float) 0 + (_Decimal64) 0) + ((float) 0 + (_Decimal64) 0));
| ^
tst.c:3:3: error: cannot mix operands of decimal floating and other floating
types
tst.c:4:3: error: cannot mix operands of decimal floating and other floating
types
4 | (void) ((i ? (float) 0 : (_Decimal64) 0) == (i ? (float) 0 :
(_Decimal64) 0));
| ^
tst.c:4:3: error: cannot mix operands of decimal floating and other floating
types
tst.c:5:26: warning: pointer type mismatch in conditional expression
5 | (void) ((i ? (int *) 0 : (long *) 0) == (i ? (int *) 0 : (long *)
0));
| ^
tst.c:5:58: warning: pointer type mismatch in conditional expression
5 | (void) ((i ? (int *) 0 : (long *) 0) == (i ? (int *) 0 : (long *)
0));
| ^
For the error "cannot mix operands of decimal floating and other floating
types", there are two issues (possibly related):
1. The caret location is incorrect: at the beginning of the full expression
instead of somewhere in the concerned subexpression; I would expect something
like the output for pointer type mismatch in conditional expression.
2. The detail for the second error in the expression is missing. With the caret
location issue, the detail would be the same, so that this isn't much a
problem, but once (1) is fixed, it would be different.
Tested from GCC 8 to gcc (Debian 20210918-1) 12.0.0 20210918 (experimental)
[master r12-3644-g7afcb534239].
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-10-25 9:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-25 9:22 [Bug c/102924] New: incorrect output for error "cannot mix operands of decimal floating and other floating types" vincent-gcc at vinc17 dot net
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).