[Bug c/112556] Null pointer constants with enumeration type are not accepted

2024-06-27 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112556

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed||2024-06-27
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW

--- Comment #3 from Andrew Pinski  ---
Confirmed a bug by JSM already.

[Bug c/112556] Null pointer constants with enumeration type are not accepted

2023-11-16 Thread joseph at codesourcery dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112556

--- Comment #2 from joseph at codesourcery dot com  ---
Yes, this is a bug; null_pointer_constant_p gets this right, but 
convert_for_assignment fails to handle enumerations and booleans as 
possible null pointer constants.  Other contexts such as comparisons and 
conditional expressions appear to be OK (through performing integer 
promotions so that enumerations and booleans can't appear, for example, or 
through handling all kinds of integer types together).

[Bug c/112556] Null pointer constants with enumeration type are not accepted

2023-11-15 Thread luigighiron at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112556

--- Comment #1 from Halalaluyafail3  ---
This bug also seems to happen with boolean types:

void*p=(_Bool)0;

Furthermore, this bug only seems to happen when the type
of the null pointer constant is an enumeration or boolean type:

void*p1=+(_Bool)0,*p2=+(enum{E})E;

No errors are generated for this code.