[Bug libstdc++/119488] 25_algorithms/stable_sort/constexpr.cc test fails (error: non-constant condition for static assertion)

2025-03-27 Thread peppe at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119488

Giuseppe D'Angelo  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |peppe at gcc dot gnu.org
 Resolution|--- |FIXED
 Status|UNCONFIRMED |RESOLVED

--- Comment #6 from Giuseppe D'Angelo  ---
Fixed on trunk.

[Bug libstdc++/119488] 25_algorithms/stable_sort/constexpr.cc test fails (error: non-constant condition for static assertion)

2025-03-27 Thread peppe at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119488

--- Comment #7 from Giuseppe D'Angelo  ---
(In reply to Sam James from comment #5)
> (In reply to Giuseppe D'Angelo from comment #4)
> > Hi,
> > 
> > Apologies for the testsuite regression; I think this is fixed now in trunk
> > by r15-8971-g6acfb68dc0a479 .
> 
> Thank you! By the way, if you change your email on BZ to pe...@gcc.gnu.org,
> you'll get permissions to modify bugs.

Got it! Done that, thank you.

[Bug c++/119850] New: #pragma GCC diagnostic ignored "-Wstrict-overflow" is ignored

2025-04-17 Thread peppe at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119850

Bug ID: 119850
   Summary: #pragma GCC diagnostic ignored "-Wstrict-overflow" is
ignored
   Product: gcc
   Version: 14.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: peppe at gcc dot gnu.org
  Target Milestone: ---

Wrapping a function that raises -Wstrict-overflow with #pragma GCC diagnostic
ignored does not suppress the relative warning.


#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-overflow"

#include 

#pragma GCC diagnostic pop

int main()
{
using json = nlohmann::json;
json j = json::parse(R"(
{
"pi": 3.141e2,
"happy": true
}
)");

std::string s = j.dump(4);
}


On GCC 14.2, with -Wall -Wextra -Wstrict-overflow=3, this still emits a
warning:

: In function 'nlohmann::json_v3_11_1::detail::dtoa_impl::cached_power
nlohmann::json_v3_11_1::detail::dtoa_impl::get_cached_power_for_binary_exponent(int)':
:19:1: warning: assuming signed overflow does not occur when changing X
+- C1 cmp C2 to X cmp C2 -+ C1 [-Wstrict-overflow]
   19 | }
  | ^



Even if one wraps the entire file (not just the header) with the pragma, the
warning is not suppressed (!). The fact that the header is in a -isystem path
doesn't affect anything (but that seems to be by design, PR119388).

One can reduce the testcase by picking the function out of nlohmann-json). You
can find both the original and the reduction here:
https://gcc.godbolt.org/z/hTWMdjq7b