Re: [patch, wwwdocs] Mention random number generators in porting_to.html

2023-03-18 Thread Harald Anlauf via Gcc-patches

Hi Thomas,

Am 18.03.23 um 19:23 schrieb Thomas Koenig via Gcc-patches:

Hi,

Text says it all.  OK for web pages?

Best regards

 Thomas

Mention issues with integer owerflow for random number generators.

This mentions the issues with integer overflow and how to work
around them.


it's basically fine, although I'd prefer a formulation replacing

+  GCC 13 includes new optimizations which expose reliance on
+  non-standard behavior for integer overflow, which was often used
+  for linear congruential pseudo-random number generators in old
+  programs.  It is recommended to use the intrinsic

by something like:

GCC 13 includes new optimizations which may change behavior on
integer overflow.  Traditional code, like linear congruential
pseudo-random number generators in old programs and relying on a
specific, non-standard behavior may now generate unexpected results.
In such cases it is recommended to use the intrinsic ...


Thanks for updating the documentation!

Harald




[patch, wwwdocs] Mention random number generators in porting_to.html

2023-03-18 Thread Thomas Koenig via Gcc-patches

Hi,

Text says it all.  OK for web pages?

Best regards

Thomas

Mention issues with integer owerflow for random number generators.

This mentions the issues with integer overflow and how to work
around them.
diff --git a/htdocs/gcc-13/porting_to.html b/htdocs/gcc-13/porting_to.html
index 0ee58802..7d733b16 100644
--- a/htdocs/gcc-13/porting_to.html
+++ b/htdocs/gcc-13/porting_to.html
@@ -203,11 +203,20 @@ class Alloc
 
 Since C++20, there is no rebind member in
 std::allocator, so deriving your own allocator types from
-std::allocator is simpler and doesn't require the derived
+std::allocator is simpler and does not require the derived
 allocator to provide its own rebind.
 For compatibility with previous C++ standards, the member should still be
 provided. The converting constructor is still required even in C++20.
 
 
+Fortran language issues
+Behavior on integer overflow
+ GCC 13 includes new optimizations which expose reliance on
+  non-standard behavior for integer overflow, which was often used
+  for linear congruential pseudo-random number generators in old
+  programs.  It is recommended to use the intrinsic
+  subroutine RANDOM_NUMBER for random number generators
+  or, if the old behavior is desired, to use the -fwrapv
+  option.  Note that this option can impact performance.