tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Bug using -g with line directive


From: Levo D
Subject: [Tinycc-devel] Bug using -g with line directive
Date: Mon, 16 Jan 2023 01:31:40 +0000 (UTC)

I'm interested in using tcc as a backend for debug builds in my compiler. It 
appears that when I compile with '-g' it works fine but tcc has problems when I 
use the line directive to specify my source file. Below is an example of my 
source and an example c output. If you compile the c code with 'tcc -g test.c' 
and run the gdb command below gdb will complain and show an internal error. 
This happens on linux (x86-64). On mac lldb is also unhappy

Is the below enough information as a bug report? You can use the following 
regex to remove the '#line' from the c file \t?#line.*\n

gdb ./a.out -batch -ex 'br a.bolin:5' -ex 'r'

---

test0() s32 {
        array := $s32[10]
        array[0] = 0
        array[1] = 3
        array[2] = 6
        array[3] = 9
        array[4] = 12
        array[5] = 15
        array[6] = 18
        array[7] = 21
        array[8] = 24
        array[9] = 27
        return array[4]
}
main() {
        test0();
}

---

#include <stdint.h>
static const char*G0="/tmp/a.bolin";
int32_t test0();
#line 1 "/tmp/a.bolin"
int32_t test0() {
        int32_t var1;
        #line 2
        int32_t var2[10];
        #line 3
        var2[0] = 0;
        #line 4
        var2[1] = 3;
        #line 5
        var2[2] = 6;
        #line 6
        var2[3] = 9;
        #line 7
        var2[4] = 12;
        #line 8
        var2[5] = 15;
        #line 9
        var2[6] = 18;
        #line 10
        var2[7] = 21;
        #line 11
        var2[8] = 24;
        #line 12
        var2[9] = 27;
        #line 13
        int32_t var3 = var2[4];
        #line 14
        var1 = var3;
        return var1;
}
#line 15
int64_t main() {
        #line 16
        int32_t var1 = test0();
        return 0;
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]