Halalaluyafail3 wrote:

> Thank you for that! I think it's defensible to port this behavior back to C11 
> because this situation is UB (by omission), but I also don't know if that 
> will cause fallout for anyone (or if deviating from GCC will). So I think 
> it's also reasonable as-is.

As far as I understand it would not be undefined behavior, but just not a 
definition like the following:
```c
extern thread_local int x;
```
With the new wording after Issue 1009 was fixed and old wording this should not 
be undefined behavior. To summarize:
```c
/* Old is C17, New is C23 + Issue 1009 fixes */
thread_local int x;/* Old: no definition, New: external definition */
extern thread_local int y;/* Old: no definition, New: no definition */
static thread_local int z;/* Old: tentative definition, New: external 
definition */
```
Both GCC and Clang do not give y a definition in any language mode for obvious 
reasons. GCC before C23 gives x and z tentative definitions. GCC in C23 gives x 
and z external definitions. I have not tested the new behavior yet but if Clang 
matches the GCC behavior here I think it is fine.

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

Reply via email to