| Issue |
63304
|
| Summary |
`clangtk` hangs when processing _expression_ with deep dependency and type intptr_t
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
wierton
|
When the following code is compiled using `clangtk` with the `-O1` option, the compiler hangs indefinitely. This behavior can be reproduced at https://gcc.godbolt.org/z/KeEnoKbTP:
```c
#include <stdint.h>
typedef intptr_t T; // T is aliased to intptr_t
char *bar (void);
T baz (void);
long foo_q;
void foo (T *q) {
char *p = bar ();
T a = baz ();
T b = baz ();
int i = 0;
#define X q[i++] = a; q[i++] = b; a = a + b; b = b + a;
#define Y X X X X X X X X X X
#define Z Y Y Y Y Y Y Y Y Y Y
Z;
p[a] = 1;
p[b] *= 2;
}
```
However, when the type `T` is aliased to `int` instead of `intptr_t`, the compilation is completed quickly without any issues. The modified code can be found at https://gcc.godbolt.org/z/K818h6dzx:
```c
#include <stdint.h>
typedef int T; // T is aliased to int
char *bar (void);
T baz (void);
long foo_q;
void foo (T *q) {
char *p = bar ();
T a = baz ();
T b = baz ();
int i = 0;
#define X q[i++] = a; q[i++] = b; a = a + b; b = b + a;
#define Y X X X X X X X X X X
#define Z Y Y Y Y Y Y Y Y Y Y
Z;
p[a] = 1;
p[b] *= 2;
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs