diff options
author | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
commit | 1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch) | |
tree | c607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/g++.dg/opt/pr7503-1.C | |
parent | 283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff) | |
download | toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2 toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip |
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/opt/pr7503-1.C')
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/opt/pr7503-1.C | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/opt/pr7503-1.C b/gcc-4.9/gcc/testsuite/g++.dg/opt/pr7503-1.C new file mode 100644 index 000000000..d366a6180 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/opt/pr7503-1.C @@ -0,0 +1,148 @@ +// PR c++/7503 +// { dg-do run } +// { dg-options "-O2" } + +extern "C" void abort(); + +void test1a() +{ + int A = 4; + int B = 4; + + (A > B ? A : B) = 1; + if (A != 4 || B != 1) + abort (); +} + +void test1b() +{ + int A = 3; + int B = 5; + + (A > B ? A : B) = 1; + if (A != 3 || B != 1) + abort (); +} + +void test1c() +{ + int A = 5; + int B = 3; + + (A > B ? A : B) = 1; + if (A != 1 || B != 3) + abort (); +} + +void test2a() +{ + int A = 4; + int B = 4; + + (A >= B ? A : B) = 1; + if (A != 1 || B != 4) + abort (); +} + +void test2b() +{ + int A = 3; + int B = 5; + + (A >= B ? A : B) = 1; + if (A != 3 || B != 1) + abort (); +} + +void test2c() +{ + int A = 5; + int B = 3; + + (A >= B ? A : B) = 1; + if (A != 1 || B != 3) + abort (); +} + +void test3a() +{ + int A = 4; + int B = 4; + + (A < B ? A : B) = 1; + if (A != 4 || B != 1) + abort (); +} + +void test3b() +{ + int A = 3; + int B = 5; + + (A < B ? A : B) = 1; + if (A != 1 || B != 5) + abort (); +} + +void test3c() +{ + int A = 5; + int B = 3; + + (A < B ? A : B) = 1; + if (A != 5 || B != 1) + abort (); +} + +void test4a() +{ + int A = 4; + int B = 4; + + (A <= B ? A : B) = 1; + if (A != 1 || B != 4) + abort (); +} + +void test4b() +{ + int A = 3; + int B = 5; + + (A <= B ? A : B) = 1; + if (A != 1 || B != 5) + abort (); +} + +void test4c() +{ + int A = 5; + int B = 3; + + (A <= B ? A : B) = 1; + if (A != 5 || B != 1) + abort (); +} + + +int main() +{ + test1a(); + test1b(); + test1c(); + + test2a(); + test2b(); + test2c(); + + test3a(); + test3b(); + test3c(); + + test4a(); + test4b(); + test4c(); + + return 0; +} + |