Issue 183728
Summary [clang] crashes with format_matches attribute after invalid declaration
Labels clang:frontend, crash-on-invalid
Assignees
Reporter k-arrows
    Reproducer:
https://godbolt.org/z/336x7roqh
```c
int bar(char *) __attribute__((format_matches(printf, 1, "%s")));

void foo() {
  const *const fmt2 = fmt;
 bar(fmt2);
}
```

Output:
```console
<source>:4:16: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
    4 |   const *const fmt2 = fmt;
      | ~~~~~        ^
      |   int 
<source>:4:23: error: use of undeclared identifier 'fmt'; did you mean 'fmt2'?
    4 |   const *const fmt2 = fmt;
 |                       ^~~
      | fmt2
<source>:4:16: note: 'fmt2' declared here
    4 |   const *const fmt2 = fmt;
      |                ^
<source>:5:7: error: incompatible pointer types passing 'const int *const' to parameter of type 'char *' [-Wincompatible-pointer-types]
    5 |   bar(fmt2);
      | ^~~~
<source>:1:15: note: passing argument to parameter here
    1 | int bar(char *) __attribute__((format_matches(printf, 1, "%s")));
      | ^
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to