https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94496

--- Comment #3 from Witold Baryluk <witold.baryluk+gcc at gmail dot com> ---
Also about 'nothrow' and Errors.

I would really welcome a flag to compiler that simply terminates all threads
immidetly any Error is thrown at throw location. They aren't really
recoverable. The only option is either catch them really high in the stack or
terminate the program (in D this will I think unwind all the stack and destroy
scoped structs, also call full GC collection, optionally call all class
destrustors, and module destructors). But in many cases terminating the program
at the spot (_exit(2) or _Exit(2), from glibc (not kernel) to terminate all
threads via exit_group).

As of the 'nothrow' itself. I belive it doesn't mean there is 'no thrown
exceptions in the call tree'. I think it means there is no 'uncought exceptions
possibly throw by call to this function'.

```d
extern int g(int x);  // not nothrow

int f(int x) nothrow {
  try {
     return g(x);
     throw new MyException("ble");
  } catch (Exception e) {
    return 1;
  }
  return 0;
}
```

https://gcc.godbolt.org/z/Y3vNQr


As of the asm pure, considering there is asm volatile, wouldn't it make sense
to not allow 'asm pure volatilve' in the first place in the source?

strict aliasing should be enabled for dynamic arrays, static arrays and normal
pointer to other types.   I.e.

```d
void f(int* x, float[] y);  // x, y, y.ptr should not alias.
```



```d
void f(int* x, int[] y);  // x, y and y.ptr can alias.
```

Also how about using `restrict` automatically for transitively const types?
I.e. 

```d
void f(const scope int[] a, int *b);  // can't alias. if b aliases a, then it
is UB.
```

Reply via email to