public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Koenig <tkoenig@netcologne.de>
To: gcc-patches <gcc-patches@gcc.gnu.org>,
	"fortran@gcc.gnu.org" <fortran@gcc.gnu.org>
Subject: [patch, wwwdocs] Mention random number generators in porting_to.html
Date: Sat, 18 Mar 2023 19:23:59 +0100	[thread overview]
Message-ID: <a0c911ee-4587-10d6-3c75-74538e7623be@netcologne.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 210 bytes --]

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.

[-- Attachment #2: porting_to.diff --]
[-- Type: text/x-patch, Size: 1264 bytes --]

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
 <p>
 Since C++20, there is no <code>rebind</code> member in
 <code>std::allocator</code>, so deriving your own allocator types from
-<code>std::allocator</code> is simpler and doesn't require the derived
+<code>std::allocator</code> is simpler and does not require the derived
 allocator to provide its own <code>rebind</code>.
 For compatibility with previous C++ standards, the member should still be
 provided. The converting constructor is still required even in C++20.
 </p>
 
+<h2 id="fortran">Fortran language issues</h2>
+<h3 id="overflow">Behavior on integer overflow</h3>
+<p> 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 <code>RANDOM_NUMBER</code> for random number generators
+  or, if the old behavior is desired, to use the <code>-fwrapv</code>
+  option.  Note that this option can impact performance.
 </body>
 </html>

             reply	other threads:[~2023-03-18 18:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-18 18:23 Thomas Koenig [this message]
2023-03-18 21:11 ` Harald Anlauf
2023-03-18 21:11   ` Harald Anlauf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a0c911ee-4587-10d6-3c75-74538e7623be@netcologne.de \
    --to=tkoenig@netcologne.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).