Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/gcc.dg/sso-8.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 04ced10e8804 |
children |
line wrap: on
line source
/* Test support of scalar_storage_order pragma */ /* { dg-do run } */ /* { dg-options "-fsso-struct=little-endian" } */ /* { dg-require-effective-target int32plus } */ struct S1 { int i; }; #pragma scalar_storage_order big-endian struct S2 { int i; }; #pragma scalar_storage_order default struct S3 { int i; }; struct S1 my_s1 = { 0x12345678 }; struct S2 my_s2 = { 0x12345678 }; struct S3 my_s3 = { 0x12345678 }; unsigned char big_endian_pattern[4] = { 0x12, 0x34, 0x56, 0x78 }; unsigned char little_endian_pattern[4] = { 0x78, 0x56, 0x34, 0x12 }; int main (void) { if (__builtin_memcmp (&my_s1, &little_endian_pattern, 4) != 0) __builtin_abort (); if (__builtin_memcmp (&my_s2, &big_endian_pattern, 4) != 0) __builtin_abort (); if (__builtin_memcmp (&my_s3, &little_endian_pattern, 4) != 0) __builtin_abort (); return 0; }