https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94340
--- Comment #5 from Andrew Pinski ---
apinski@xeond:~/src/upstream-gcc$ diff -up nodiscard3.C.gkd nodiscard3.gk.C.gkd
--- nodiscard3.C.gkd2021-09-20 07:45:03.448528331 +
+++ nodiscard3.gk.C.gkd 2021-09-20 07:45:04.373528230 +
@@ -2190,10 +2190,10 @@ Declarations used by test, sorted by DEC
(note # 0 0 NOTE_INSN_DELETED)
(insn # 0 0 166 (set (reg:DI 5 di [406])
(plus:DI (reg/f:DI 7 sp)
-(const_int 7280 [0x1c70])))
"gcc/gcc/testsuite/g++.dg/cpp1z/nodiscard3.C":198:7# {*leadi}
+(const_int 7280 [0x1c70])))
"gcc/gcc/testsuite/g++.dg/cpp1z/nodiscard3.C":198:18# {*leadi}
(nil))
(call_insn # 0 0 166 (call (mem:QI (symbol_ref:DI ("_Z7check12v") [flags 0x41]
) [ check12 S1 A8])
-(const_int 0 [0]))
"gcc/gcc/testsuite/g++.dg/cpp1z/nodiscard3.C":198:7# {*call}
+(const_int 0 [0]))
"gcc/gcc/testsuite/g++.dg/cpp1z/nodiscard3.C":198:18# {*call}
(expr_list:REG_DEAD (reg:DI 5 di)
(expr_list:REG_EH_REGION (const_int 2 [0x2])
(nil)))
Literally just column differences.
>From .gimple:
- [gcc/gcc/testsuite/g++.dg/cpp1z/nodiscard3.C:198:7] D.2655 = check12
(); [return slot optimization]
+ [gcc/gcc/testsuite/g++.dg/cpp1z/nodiscard3.C:198:3] # DEBUG
BEGIN_STMT
+ [gcc/gcc/testsuite/g++.dg/cpp1z/nodiscard3.C:198:10] # DEBUG
BEGIN_STMT
+ [gcc/gcc/testsuite/g++.dg/cpp1z/nodiscard3.C:198:18] D.2655 =
check12 (); [return slot optimization]
The correct line/column is actually with debugging turned on
column 7 is the start of the statement expression.
- if (<>>).i != 0>>)
+ D.2654 >>;>).i != 0>>)
I wonder if this is a gimplification issue where the call gets the
TARGET_EXPR's location info if the TARGET_EXPR can be removed ... Just happens
with the statement frontiers, that the TARGET_EXPR can no longer exactly be
removed so the location info is not copied.