From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3A24138582A1; Wed, 7 Feb 2024 10:09:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3A24138582A1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707300562; bh=ZetsFTOdO7rki0Xq2pZXSr9vHOeu2gWQ8LU+cZ1lwcs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=HisLcdUdFD7nbHrkZBoYe4oAT4lpKWUcPrfXclRptQw2HCLB7r3/U2L+uWojWEHX0 vKpc/nEQNMJVuzyVOWz4IRJtOcUA3IU+YUFPA61z9/tSDhDascJzm+0/x3ixVy9esK F6Ae5rFUH3X+hbKyabKGY0vRa6pNZgTdlqFT7GFg= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/22200] numeric_limits::is_modulo is inconsistent with gcc Date: Wed, 07 Feb 2024 10:09:17 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 4.0.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: target_milestone bug_status resolution Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D22200 Jonathan Wakely changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |4.8.0 Status|WAITING |RESOLVED Resolution|--- |FIXED --- Comment #45 from Jonathan Wakely --- https://cplusplus.github.io/LWG/issue2422 changed the spec for is_modulo to remove the "on most machines" text and add: -??- [Example: is_modulo is false for signed integer types ([basic.fundamental]) unless an implementation, as an extension to this International Standard, defines signed integer overflow to wrap. =E2=80=94 end example] This seems very clear that numeric_limits::is_modulo should be false *unless* -fwrapv is used. I'm going to close this now. If GCC gets a macro = that allows us to detect the presence of -fwrapv we can revisit it. N.B. Since C++17 is_modulo is an inline variable and so no extern definitio= n in libstdc++.so is needed. If we made it depend on -fwrapv then you would still get ODR violations between different translation units compiled with differ= ent -fwrapv states, but at least you wouldn't get a value from libstdc++.so that ignores the current TU.=