diff options
author | Andrew Pinski <andrew.pinski@oss.qualcomm.com> | 2025-08-20 15:34:15 -0700 |
---|---|---|
committer | Andrew Pinski <andrew.pinski@oss.qualcomm.com> | 2025-08-21 11:35:52 -0700 |
commit | 8b41e021ba4ad8db6a6cbd512c8c42277909c402 (patch) | |
tree | d897cbb81abf7997c8c0635b8e14d63c68fb6bfe /libjava/javax | |
parent | 70f33ad677e6350a724b56d4cb766480ed8367fc (diff) | |
download | gcc-8b41e021ba4ad8db6a6cbd512c8c42277909c402.zip gcc-8b41e021ba4ad8db6a6cbd512c8c42277909c402.tar.gz gcc-8b41e021ba4ad8db6a6cbd512c8c42277909c402.tar.bz2 |
c: Add folding of nullptr_t in some cases [PR121478]
The middle-end does not fully understand NULLPTR_TYPE. So it
gets confused a lot of the time when dealing with it.
This adds the folding that is similarly done in the C++ front-end already.
In some cases it should produce slightly better code as there is no
reason to load from a nullptr_t variable as it is always NULL.
The following is handled:
nullptr_v ==/!= nullptr_v -> true/false
(ptr)nullptr_v -> (ptr)0, nullptr_v
f(nullptr_v) -> f ((nullptr, nullptr_v))
The last one is for conversion inside ... .
Bootstrapped and tested on x86_64-linux-gnu.
PR c/121478
gcc/c/ChangeLog:
* c-fold.cc (c_fully_fold_internal): Fold nullptr_t ==/!= nullptr_t.
* c-typeck.cc (convert_arguments): Handle conversion from nullptr_t
for varargs.
(convert_for_assignment): Handle conversions from nullptr_t to
pointer type specially.
gcc/testsuite/ChangeLog:
* gcc.dg/torture/pr121478-1.c: New test.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Diffstat (limited to 'libjava/javax')
0 files changed, 0 insertions, 0 deletions