[llvm-bugs] [Bug 52237] New: Variable's value not available after assignment at Oz after SROA

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Oct 20 10:13:47 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=52237

            Bug ID: 52237
           Summary: Variable's value not available after assignment at Oz
                    after SROA
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: cristianassaiante at outlook.com
                CC: jdevlieghere at apple.com, keith.walker at arm.com,
                    llvm-bugs at lists.llvm.org,
                    paul_robinson at playstation.sony.com

Variable l_201 value is not available after the first loop iteration on lines 4
and 5. It is only available on line 6.
>From bisect, this behavior may be caused by SROA on function (b).

$ cat a.c
short a;
void  b() {
        char l_201 ;
        for (;
                a <= 8;
                ++a) l_201 = 0;
}
int main () {
        {
                b();
        }
}

$ clang -v
clang version 13.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Candidate multilib: .;@m64
Selected multilib: .;@m64

$ lldb -v
lldb version 13.0.0

$ clang -g -Oz -o opt a.c
$ lldb opt
(lldb) target create "opt"
Current executable set to '/home/stepping/7/reduce/opt' (x86_64).
(lldb) b 4
Breakpoint 1: where = opt`b + 11 at a.c:4:9, address = 0x0000000000400483
(lldb) run
Process 112 launched: '/home/stepping/7/reduce/opt' (x86_64)
Process 112 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.1
    frame #0: 0x0000000000400483 opt`b at a.c:4:9
   1    short a;
   2    void  b() {
   3            char l_201 ;
-> 4            for (;
   5                    a <= 8;
   6                    ++a) l_201 = 0;
   7    }
(lldb) n
Process 112 stopped
* thread #1, name = 'opt', stop reason = step over
    frame #0: 0x0000000000400485 opt`b at a.c:6:3
   3            char l_201 ;
   4            for (;
   5                    a <= 8;
-> 6                    ++a) l_201 = 0;
   7    }
   8    int main () {
   9            {
(lldb) frame var
(char) l_201 = '\0'
(lldb) n
Process 112 stopped
* thread #1, name = 'opt', stop reason = step over
    frame #0: 0x000000000040047f opt`b at a.c:5:5
   2    void  b() {
   3            char l_201 ;
   4            for (;
-> 5                    a <= 8;
   6                    ++a) l_201 = 0;
   7    }
   8    int main () {
(lldb) frame var
(char) l_201 = <variable not available>

(lldb) n
Process 112 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.1
    frame #0: 0x0000000000400483 opt`b at a.c:4:9
   1    short a;
   2    void  b() {
   3            char l_201 ;
-> 4            for (;
   5                    a <= 8;
   6                    ++a) l_201 = 0;
   7    }
(lldb) n
Process 112 stopped
* thread #1, name = 'opt', stop reason = step over
    frame #0: 0x0000000000400485 opt`b at a.c:6:3
   3            char l_201 ;
   4            for (;
   5                    a <= 8;
-> 6                    ++a) l_201 = 0;
   7    }
   8    int main () {
   9            {
(lldb) frame var
(char) l_201 = '\0'

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211020/bae15534/attachment.html>


More information about the llvm-bugs mailing list