[Bug d/94496] [D] Use aggressive optimizations in release mode

2020-05-15 Thread witold.baryluk+gcc at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94496

--- Comment #3 from Witold Baryluk  ---
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.
```

[Bug d/94496] [D] Use aggressive optimizations in release mode

2020-05-13 Thread ibuclaw at gdcproject dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94496

--- Comment #2 from Iain Buclaw  ---
(In reply to Witold Baryluk from comment #1)
> We are close to making 'in' mean 'scope const', it is already available as a
> preview in dmd 2.092: https://dlang.org/changelog/2.092.0.html#preview-in

Indeed, the new @live attribute should also allow strict aliasing rules to be
turned on for them as well.

[Bug d/94496] [D] Use aggressive optimizations in release mode

2020-05-13 Thread witold.baryluk+gcc at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94496

Witold Baryluk  changed:

   What|Removed |Added

 CC||witold.baryluk+gcc at gmail 
dot co
   ||m

--- Comment #1 from Witold Baryluk  ---
We are close to making 'in' mean 'scope const', it is already available as a
preview in dmd 2.092: https://dlang.org/changelog/2.092.0.html#preview-in