Repository navigation
EDG silently accepts deep pointer qualification conversions in C #472
71iq
started this conversation in
Issue Triage - Standard Conformance
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.
The C front end reportedly accepts the following assignment without a
diagnostic:
This conversion is const-safe and valid in C++, but it violates the pointer
assignment constraints in C23 6.5.17.2 paragraph 1. The immediate pointed-to
types are not qualified or unqualified versions of compatible types. C23
5.1.1.3 paragraph 1 therefore requires a diagnostic; a warning is sufficient.
Standard reference: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf
Suggested EDG reproduction:
eccp --c --c23 -c testcase.c, also with--strict_warnings. The EDG version and--dump_configurationoutput werenot supplied, and EDG execution is unavailable in this workspace. The silent
acceptance is the reported behavior, supported by inspecting current main
at 2d71da5.
GCC 13.3.0, with
gcc -std=c2x -pedantic -fsyntax-only testcase.c, emits anincompatible-pointer-types warning. Clang is also reported to diagnose this
conversion; it has not been independently rerun here.
In
src/types.c,impl_pointer_conversionaccepts the const-safe deepqualification path as a C extension but forwards
ec_no_error. A proposedfix is to select the caller's default warning when
C_mode()is true andno more specific warning has been selected. It preserves extension
acceptance while providing the diagnostic. Related C++ work: PR #455.
All reactions