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].