anatasluo wrote:

I reproduced this with Clang 24.0.0git (`6fba582ee46d`) and GDB 17.2 on x86-64 
Linux.

```cpp
// arm.cpp
int mark(int *p) { return 1; }

int main(int argc, char **) {
  if (argc > 1)
    static int x = mark(&x);
  else
    static int x = mark(&x);
}
```

```sh
clang++ -O0 -g arm.cpp -o arm
gdb -q -nx -batch ./arm -ex 'break mark' -ex run \
    -ex 'set $actual = p' -ex up -ex 'print &x == $actual'
```

With no arguments, `main` takes the `else` arm. Its `&x` should match the 
pointer passed to `mark`. GDB prints `false` on main and `true` with the patch. 
                                                                                
                           

https://github.com/llvm/llvm-project/pull/243767
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to