Repository navigation
GNU mode accepts pointer-to-unsigned-char reinterpret_cast with a warning instead of an error #298
71iq
started this conversation in
Issue Triage - Compilation
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Version
Compiler: 7.0, commit
43e10b90fc83ed2a436fb79b241be8dbf3dc6846Platform: Linux x86_64 (LP64)
Reference/compiler for generated C: GCC 13.3.0
Preset:
linux-gcc-debug, withEDG_CPFE_USE_ASAN=OFFRelevant configuration:
Code to reproduce
Compiler options:
Behavior
On this target, pointers are 64 bits and
unsigned charis 8 bits. The destination cannot hold all pointer values, so the cast is ill-formed.GCC rejects it without
-fpermissiveand exits with status 1:GNU emulation instead generates C and exits with status 0, issuing:
Strict ISO mode (
--c++20 --strict, without GNU emulation) correctly rejects it and exits with status 2.This report concerns GNU compatibility and diagnostic severity. The warning is a diagnostic; is accepting the cast as an extension intentional?
Reference: C++20 [expr.reinterpret.cast]/1 and /4: https://timsong-cpp.github.io/cppwp/n4861/expr.reinterpret.cast#4.
The attachment contains the full
--dump_configurationoutput and self-contained reproduction inputs.Source, generated C, results, and full configuration
Reporting acknowledgements
I acknowledge that:
LICENSE.txtfile in my.zipor.tar.gzupload. If I included aLICENSE.txtfile, any tests created using the reproducing source code will be governed by the terms of the license I provided instead.All reactions