aboutsummaryrefslogtreecommitdiff
path: root/gcc/c/c-typeck.cc
diff options
context:
space:
mode:
authorAndrew Pinski <pinskia@gmail.com>2023-10-18 20:49:05 -0700
committerAndrew Pinski <pinskia@gmail.com>2023-10-19 09:49:13 -0700
commit9f33e4c50ee92a2053f52e5eb8f205afa54d4cb0 (patch)
treee62876b99fb6b5c06d4d2e09480328444bf6d0eb /gcc/c/c-typeck.cc
parent00e7c49fa04a3766e4726322b427621a74b78c71 (diff)
downloadgcc-9f33e4c50ee92a2053f52e5eb8f205afa54d4cb0.zip
gcc-9f33e4c50ee92a2053f52e5eb8f205afa54d4cb0.tar.gz
gcc-9f33e4c50ee92a2053f52e5eb8f205afa54d4cb0.tar.bz2
c: Don't warn about converting NULL to different sso endian [PR104822]
In a similar way we don't warn about NULL pointer constant conversion to a different named address we should not warn to a different sso endian either. This adds the simple check. Bootstrapped and tested on x86_64-linux-gnu with no regressions. PR c/104822 gcc/c/ChangeLog: * c-typeck.cc (convert_for_assignment): Check for null pointer before warning about an incompatible scalar storage order. gcc/testsuite/ChangeLog: * gcc.dg/sso-18.c: New test. * gcc.dg/sso-19.c: New test.
Diffstat (limited to 'gcc/c/c-typeck.cc')
-rw-r--r--gcc/c/c-typeck.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
index 6e044b4..f39dc71 100644
--- a/gcc/c/c-typeck.cc
+++ b/gcc/c/c-typeck.cc
@@ -7449,6 +7449,7 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type,
/* See if the pointers point to incompatible scalar storage orders. */
if (warn_scalar_storage_order
+ && !null_pointer_constant_p (rhs)
&& (AGGREGATE_TYPE_P (ttl) && TYPE_REVERSE_STORAGE_ORDER (ttl))
!= (AGGREGATE_TYPE_P (ttr) && TYPE_REVERSE_STORAGE_ORDER (ttr)))
{