llvm-project
llvm-project copied to clipboard
inconsistent line number information with unsigned 64-bit int conversion to double
| Bugzilla Link | 21006 |
| Version | trunk |
| OS | Windows NT |
| Attachments | corresponding IR input |
| CC | @pogo59,@wjristow |
Extended Description
When two or more conversions of unsigned64-bit integer to 'double' floating-point are done "near" each other (in the same basic block, in our experiments), instructions with line numbers for the two conversions are interspersed with each other causing stepping in the debugger to jump back and forth between the two conversions.
This happens at -O0 -g and occurs at r218128.
The following source file illustrates this. I am attaching a .ll file, generated by clang with -emit-llvm -S, which can be compiled with llc -O0.
---------------------------------------------------------------------
extern "C" int printf(const char *, ...);
void bar()
{
printf("bar() invoked\n");
}
// Change 'fp_t' to 'float', or 'int_t' to 'unsigned int' (or
// 'signed long'), and the problem doesn't happen:
typedef double fp_t;
typedef unsigned long int_t;
int_t glb_start = 17;
int_t glb_end = 42;
int main()
{
/*17*/ int_t start = glb_start;
/*18*/ int_t end = glb_end;
/*20*/ fp_t dbl_start = (fp_t) start;
/*21*/ bar();
/*22*/ fp_t dbl_end = (fp_t) end;
/*24*/ printf("dbl_start = %f, dbl_end = %f\n", dbl_start, dbl_end);
/*25*/ return 0;
}
---------------------------------------------------------------------
dwarfdump -l output when compiled to a .o file:
0x00000030 [ 16, 0] NS
0x00000049 [ 17, 8] NS PE
0x00000054 [ 18, 8] NS
==> 0x0000005f [ 20, 8] NS
==> 0x00000064 [ 22, 8] NS
==> 0x0000006b [ 20, 8] NS
==> 0x0000006f [ 22, 8] NS
==> 0x00000077 [ 20, 8] NS
==> 0x00000089 [ 21, 8] NS
==> 0x0000009a [ 22, 8] NS
0x000000bd [ 24, 8] NS
0x000000d4 [ 25, 8] NS
0x000000df [ 25, 8] NS ET
So stepping through the code in the debugger takes the following sequence: line 20, 22, 20, 22, 20, 21, 22