frederick-vs-ja wrote:

> (LMK if I've got that wrong!) Given that, how is the C11 change a breaking 
> change? It seems like the C99 rule was just bogus, and we should forget it 
> ever existed?

IIUC, the "breaking change" is that in C99 a pointer value to a temporary array 
element never becomes indeterminate (despite access through it raising UB), but 
in C11 it does.

E.g.
```C
struct S { int a[1]; };
struct S fun(void) {
  return (struct S){0};
}

int main(void) {
  int* p = fun().a;
  int m = *p; // UB in C99 and C11
  *p += 42;   // UB in C99 and C11

  *p;         // UB in C11, but OK in C99?
  int* q = p; // q is more indeterminate in C11?
}
```

https://github.com/llvm/llvm-project/pull/133472
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to