From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/gcc.c-torture/ChangeLog.0 | 635 +++++++++++++++++ gcc/testsuite/gcc.c-torture/compat/strct-layout.c | 69 ++ gcc/testsuite/gcc.c-torture/compat/struct-align.c | 52 ++ gcc/testsuite/gcc.c-torture/compat/struct-big.c | 54 ++ gcc/testsuite/gcc.c-torture/compat/struct-i.c | 46 ++ gcc/testsuite/gcc.c-torture/compat/struct-ic.c | 48 ++ gcc/testsuite/gcc.c-torture/compat/struct-ii.c | 48 ++ gcc/testsuite/gcc.c-torture/compat/struct-ret-1.c | 25 + gcc/testsuite/gcc.c-torture/compile/20000105-1.c | 27 + gcc/testsuite/gcc.c-torture/compile/20000105-2.c | 5 + gcc/testsuite/gcc.c-torture/compile/20000120-1.c | 13 + gcc/testsuite/gcc.c-torture/compile/20000120-2.c | 18 + gcc/testsuite/gcc.c-torture/compile/20000127-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/20000211-1.c | 98 +++ gcc/testsuite/gcc.c-torture/compile/20000211-3.c | 10 + gcc/testsuite/gcc.c-torture/compile/20000224-1.c | 41 ++ gcc/testsuite/gcc.c-torture/compile/20000314-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/20000314-2.c | 6 + gcc/testsuite/gcc.c-torture/compile/20000319-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/20000326-1.c | 23 + gcc/testsuite/gcc.c-torture/compile/20000326-2.c | 13 + gcc/testsuite/gcc.c-torture/compile/20000329-1.c | 40 ++ gcc/testsuite/gcc.c-torture/compile/20000403-1.c | 18 + gcc/testsuite/gcc.c-torture/compile/20000403-2.c | 6 + gcc/testsuite/gcc.c-torture/compile/20000405-1.c | 13 + gcc/testsuite/gcc.c-torture/compile/20000405-2.c | 6 + gcc/testsuite/gcc.c-torture/compile/20000405-3.c | 9 + gcc/testsuite/gcc.c-torture/compile/20000412-1.c | 16 + gcc/testsuite/gcc.c-torture/compile/20000412-2.c | 4 + gcc/testsuite/gcc.c-torture/compile/20000420-1.c | 19 + gcc/testsuite/gcc.c-torture/compile/20000420-2.c | 11 + gcc/testsuite/gcc.c-torture/compile/20000427-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/20000502-1.c | 17 + gcc/testsuite/gcc.c-torture/compile/20000504-1.c | 15 + gcc/testsuite/gcc.c-torture/compile/20000511-1.c | 31 + gcc/testsuite/gcc.c-torture/compile/20000517-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/20000518-1.c | 17 + gcc/testsuite/gcc.c-torture/compile/20000523-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/20000605-1.c | 22 + gcc/testsuite/gcc.c-torture/compile/20000606-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/20000609-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/20000629-1.c | 28 + gcc/testsuite/gcc.c-torture/compile/20000701-1.c | 19 + gcc/testsuite/gcc.c-torture/compile/20000717-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/20000718.c | 14 + gcc/testsuite/gcc.c-torture/compile/20000728-1.c | 16 + gcc/testsuite/gcc.c-torture/compile/20000802-1.c | 15 + gcc/testsuite/gcc.c-torture/compile/20000803-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/20000804-1.c | 20 + gcc/testsuite/gcc.c-torture/compile/20000818-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/20000825-1.c | 31 + gcc/testsuite/gcc.c-torture/compile/20000827-1.c | 17 + gcc/testsuite/gcc.c-torture/compile/20000922-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/20000923-1.c | 8 + gcc/testsuite/gcc.c-torture/compile/20001018-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/20001024-1.c | 13 + gcc/testsuite/gcc.c-torture/compile/20001109-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/20001109-2.c | 8 + gcc/testsuite/gcc.c-torture/compile/20001116-1.c | 3 + gcc/testsuite/gcc.c-torture/compile/20001121-1.c | 21 + gcc/testsuite/gcc.c-torture/compile/20001123-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/20001123-2.c | 21 + gcc/testsuite/gcc.c-torture/compile/20001205-1.c | 26 + gcc/testsuite/gcc.c-torture/compile/20001212-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/20001221-1.c | 70 ++ gcc/testsuite/gcc.c-torture/compile/20001222-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/20001226-1.c | 37 + gcc/testsuite/gcc.c-torture/compile/200031109-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/20010102-1.c | 101 +++ gcc/testsuite/gcc.c-torture/compile/20010107-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/20010112-1.c | 14 + gcc/testsuite/gcc.c-torture/compile/20010113-1.c | 15 + gcc/testsuite/gcc.c-torture/compile/20010114-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/20010114-2.c | 6 + gcc/testsuite/gcc.c-torture/compile/20010117-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/20010117-2.c | 20 + gcc/testsuite/gcc.c-torture/compile/20010118-1.c | 21 + gcc/testsuite/gcc.c-torture/compile/20010124-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/20010202-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/20010209-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/20010226-1.c | 24 + gcc/testsuite/gcc.c-torture/compile/20010227-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/20010313-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/20010320-1.c | 28 + gcc/testsuite/gcc.c-torture/compile/20010326-1.c | 16 + gcc/testsuite/gcc.c-torture/compile/20010327-1.c | 15 + gcc/testsuite/gcc.c-torture/compile/20010328-1.c | 80 +++ gcc/testsuite/gcc.c-torture/compile/20010329-1.c | 17 + gcc/testsuite/gcc.c-torture/compile/20010404-1.c | 15 + gcc/testsuite/gcc.c-torture/compile/20010408-1.c | 77 ++ gcc/testsuite/gcc.c-torture/compile/20010421-1.c | 8 + gcc/testsuite/gcc.c-torture/compile/20010423-1.c | 16 + gcc/testsuite/gcc.c-torture/compile/20010426-1.c | 19 + gcc/testsuite/gcc.c-torture/compile/20010503-1.c | 17 + gcc/testsuite/gcc.c-torture/compile/20010510-1.c | 3 + gcc/testsuite/gcc.c-torture/compile/20010518-1.c | 205 ++++++ gcc/testsuite/gcc.c-torture/compile/20010518-2.c | 20 + gcc/testsuite/gcc.c-torture/compile/20010525-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/20010605-1.c | 15 + gcc/testsuite/gcc.c-torture/compile/20010605-2.c | 17 + gcc/testsuite/gcc.c-torture/compile/20010605-3.c | 20 + gcc/testsuite/gcc.c-torture/compile/20010610-1.c | 19 + gcc/testsuite/gcc.c-torture/compile/20010611-1.c | 24 + gcc/testsuite/gcc.c-torture/compile/20010701-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/20010706-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/20010711-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/20010711-2.c | 11 + gcc/testsuite/gcc.c-torture/compile/20010714-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/20010824-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/20010903-1.c | 28 + gcc/testsuite/gcc.c-torture/compile/20010903-2.c | 15 + gcc/testsuite/gcc.c-torture/compile/20010911-1.c | 4 + gcc/testsuite/gcc.c-torture/compile/20011010-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/20011023-1.c | 14 + gcc/testsuite/gcc.c-torture/compile/20011029-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/20011106-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/20011106-2.c | 7 + gcc/testsuite/gcc.c-torture/compile/20011109-1.c | 51 ++ gcc/testsuite/gcc.c-torture/compile/20011114-1.c | 2 + gcc/testsuite/gcc.c-torture/compile/20011114-2.c | 13 + gcc/testsuite/gcc.c-torture/compile/20011114-3.c | 42 ++ gcc/testsuite/gcc.c-torture/compile/20011114-4.c | 38 + gcc/testsuite/gcc.c-torture/compile/20011119-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/20011119-2.c | 12 + gcc/testsuite/gcc.c-torture/compile/20011130-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/20011130-2.c | 54 ++ gcc/testsuite/gcc.c-torture/compile/20011205-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/20011217-1.c | 20 + gcc/testsuite/gcc.c-torture/compile/20011217-2.c | 19 + gcc/testsuite/gcc.c-torture/compile/20011218-1.c | 16 + gcc/testsuite/gcc.c-torture/compile/20011219-1.c | 29 + gcc/testsuite/gcc.c-torture/compile/20011219-2.c | 20 + gcc/testsuite/gcc.c-torture/compile/20011229-1.c | 78 +++ gcc/testsuite/gcc.c-torture/compile/20011229-2.c | 17 + gcc/testsuite/gcc.c-torture/compile/20020103-1.c | 22 + gcc/testsuite/gcc.c-torture/compile/20020106-1.c | 8 + gcc/testsuite/gcc.c-torture/compile/20020109-1.c | 23 + gcc/testsuite/gcc.c-torture/compile/20020109-2.c | 30 + gcc/testsuite/gcc.c-torture/compile/20020110.c | 12 + gcc/testsuite/gcc.c-torture/compile/20020116-1.c | 28 + gcc/testsuite/gcc.c-torture/compile/20020120-1.c | 55 ++ gcc/testsuite/gcc.c-torture/compile/20020121-1.c | 30 + gcc/testsuite/gcc.c-torture/compile/20020129-1.c | 17 + gcc/testsuite/gcc.c-torture/compile/20020206-1.c | 18 + gcc/testsuite/gcc.c-torture/compile/20020210-1.c | 2 + gcc/testsuite/gcc.c-torture/compile/20020303-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/20020304-1.c | 777 +++++++++++++++++++++ gcc/testsuite/gcc.c-torture/compile/20020304-2.c | 10 + gcc/testsuite/gcc.c-torture/compile/20020309-1.c | 14 + gcc/testsuite/gcc.c-torture/compile/20020309-2.c | 16 + gcc/testsuite/gcc.c-torture/compile/20020312-1.c | 25 + gcc/testsuite/gcc.c-torture/compile/20020314-1.c | 26 + gcc/testsuite/gcc.c-torture/compile/20020315-1.c | 34 + gcc/testsuite/gcc.c-torture/compile/20020318-1.c | 16 + gcc/testsuite/gcc.c-torture/compile/20020319-1.c | 20 + gcc/testsuite/gcc.c-torture/compile/20020320-1.c | 24 + gcc/testsuite/gcc.c-torture/compile/20020323-1.c | 26 + gcc/testsuite/gcc.c-torture/compile/20020330-1.c | 27 + gcc/testsuite/gcc.c-torture/compile/20020409-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/20020415-1.c | 22 + gcc/testsuite/gcc.c-torture/compile/20020418-1.c | 18 + gcc/testsuite/gcc.c-torture/compile/20020530-1.c | 16 + gcc/testsuite/gcc.c-torture/compile/20020604-1.c | 93 +++ gcc/testsuite/gcc.c-torture/compile/20020605-1.c | 17 + gcc/testsuite/gcc.c-torture/compile/20020701-1.c | 75 ++ gcc/testsuite/gcc.c-torture/compile/20020706-1.c | 50 ++ gcc/testsuite/gcc.c-torture/compile/20020706-2.c | 26 + gcc/testsuite/gcc.c-torture/compile/20020709-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/20020710-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/20020715-1.c | 22 + gcc/testsuite/gcc.c-torture/compile/20020807-1.c | 33 + gcc/testsuite/gcc.c-torture/compile/20020910-1.c | 19 + gcc/testsuite/gcc.c-torture/compile/20020926-1.c | 21 + gcc/testsuite/gcc.c-torture/compile/20020927-1.c | 26 + gcc/testsuite/gcc.c-torture/compile/20020930-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/20021001-1.c | 4 + gcc/testsuite/gcc.c-torture/compile/20021007-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/20021008-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/20021015-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/20021015-2.c | 7 + gcc/testsuite/gcc.c-torture/compile/20021103-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/20021108-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/20021110.c | 10 + gcc/testsuite/gcc.c-torture/compile/20021119-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/20021120-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/20021120-2.c | 9 + gcc/testsuite/gcc.c-torture/compile/20021124-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/20021204-1.c | 16 + gcc/testsuite/gcc.c-torture/compile/20021205-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/20021212-1.c | 15 + gcc/testsuite/gcc.c-torture/compile/20021230-1.c | 8 + gcc/testsuite/gcc.c-torture/compile/20030109-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/20030110-1.c | 39 ++ gcc/testsuite/gcc.c-torture/compile/20030125-1.c | 24 + gcc/testsuite/gcc.c-torture/compile/20030206-1.c | 14 + gcc/testsuite/gcc.c-torture/compile/20030216-1.c | 42 ++ gcc/testsuite/gcc.c-torture/compile/20030219-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/20030220-1.c | 20 + gcc/testsuite/gcc.c-torture/compile/20030224-1.c | 17 + gcc/testsuite/gcc.c-torture/compile/20030305-1.c | 18 + gcc/testsuite/gcc.c-torture/compile/20030310-1.c | 13 + gcc/testsuite/gcc.c-torture/compile/20030314-1.c | 18 + gcc/testsuite/gcc.c-torture/compile/20030319-1.c | 14 + gcc/testsuite/gcc.c-torture/compile/20030320-1.c | 44 ++ gcc/testsuite/gcc.c-torture/compile/20030323-1.c | 17 + gcc/testsuite/gcc.c-torture/compile/20030330-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/20030331-1.c | 13 + gcc/testsuite/gcc.c-torture/compile/20030405-1.c | 30 + gcc/testsuite/gcc.c-torture/compile/20030410-1.c | 27 + gcc/testsuite/gcc.c-torture/compile/20030415-1.c | 4 + gcc/testsuite/gcc.c-torture/compile/20030416-1.c | 16 + gcc/testsuite/gcc.c-torture/compile/20030418-1.c | 16 + gcc/testsuite/gcc.c-torture/compile/20030503-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/20030518-1.c | 14 + gcc/testsuite/gcc.c-torture/compile/20030530-1.c | 23 + gcc/testsuite/gcc.c-torture/compile/20030530-3.c | 16 + gcc/testsuite/gcc.c-torture/compile/20030604-1.c | 18 + gcc/testsuite/gcc.c-torture/compile/20030605-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/20030612-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/20030624-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/20030703-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/20030704-1.c | 17 + gcc/testsuite/gcc.c-torture/compile/20030707-1.c | 13 + gcc/testsuite/gcc.c-torture/compile/20030708-1.c | 13 + gcc/testsuite/gcc.c-torture/compile/20030716-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/20030725-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/20030804-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/20030821-1.c | 24 + gcc/testsuite/gcc.c-torture/compile/20030823-1.c | 18 + gcc/testsuite/gcc.c-torture/compile/20030902-1.c | 37 + gcc/testsuite/gcc.c-torture/compile/20030903-1.c | 33 + gcc/testsuite/gcc.c-torture/compile/20030904-1.c | 94 +++ gcc/testsuite/gcc.c-torture/compile/20030907-1.c | 25 + gcc/testsuite/gcc.c-torture/compile/20030910-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/20030917-1.c | 18 + gcc/testsuite/gcc.c-torture/compile/20030921-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/20031002-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/20031010-1.c | 4 + gcc/testsuite/gcc.c-torture/compile/20031011-1.c | 21 + gcc/testsuite/gcc.c-torture/compile/20031011-2.c | 15 + gcc/testsuite/gcc.c-torture/compile/20031023-1.c | 66 ++ gcc/testsuite/gcc.c-torture/compile/20031023-2.c | 2 + gcc/testsuite/gcc.c-torture/compile/20031023-3.c | 2 + gcc/testsuite/gcc.c-torture/compile/20031023-4.c | 2 + gcc/testsuite/gcc.c-torture/compile/20031031-1.c | 36 + gcc/testsuite/gcc.c-torture/compile/20031031-2.c | 36 + gcc/testsuite/gcc.c-torture/compile/20031102-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/20031112-1.c | 2 + gcc/testsuite/gcc.c-torture/compile/20031113-1.c | 21 + gcc/testsuite/gcc.c-torture/compile/20031124-1.c | 8 + gcc/testsuite/gcc.c-torture/compile/20031125-1.c | 34 + gcc/testsuite/gcc.c-torture/compile/20031125-2.c | 18 + gcc/testsuite/gcc.c-torture/compile/20031203-1.c | 20 + gcc/testsuite/gcc.c-torture/compile/20031203-2.c | 6 + gcc/testsuite/gcc.c-torture/compile/20031203-3.c | 7 + gcc/testsuite/gcc.c-torture/compile/20031208-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/20031220-1.c | 21 + gcc/testsuite/gcc.c-torture/compile/20031220-2.c | 44 ++ gcc/testsuite/gcc.c-torture/compile/20031227-1.c | 17 + gcc/testsuite/gcc.c-torture/compile/20031231-1.c | 51 ++ gcc/testsuite/gcc.c-torture/compile/20040101-1.c | 30 + gcc/testsuite/gcc.c-torture/compile/20040109-1.c | 25 + gcc/testsuite/gcc.c-torture/compile/20040121-1.c | 41 ++ gcc/testsuite/gcc.c-torture/compile/20040124-1.c | 22 + gcc/testsuite/gcc.c-torture/compile/20040130-1.c | 28 + gcc/testsuite/gcc.c-torture/compile/20040202-1.c | 8 + gcc/testsuite/gcc.c-torture/compile/20040209-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/20040214-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/20040214-2.c | 57 ++ gcc/testsuite/gcc.c-torture/compile/20040216-1.c | 4 + gcc/testsuite/gcc.c-torture/compile/20040219-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/20040220-1.c | 16 + gcc/testsuite/gcc.c-torture/compile/20040303-1.c | 16 + gcc/testsuite/gcc.c-torture/compile/20040303-2.c | 23 + gcc/testsuite/gcc.c-torture/compile/20040304-1.c | 20 + gcc/testsuite/gcc.c-torture/compile/20040309-1.c | 20 + gcc/testsuite/gcc.c-torture/compile/20040310-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/20040317-1.c | 4 + gcc/testsuite/gcc.c-torture/compile/20040317-2.c | 25 + gcc/testsuite/gcc.c-torture/compile/20040317-3.c | 11 + gcc/testsuite/gcc.c-torture/compile/20040323-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/20040401-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/20040415-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/20040415-2.c | 7 + gcc/testsuite/gcc.c-torture/compile/20040419-1.c | 3 + gcc/testsuite/gcc.c-torture/compile/20040602-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/20040610-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/20040611-1.c | 8 + gcc/testsuite/gcc.c-torture/compile/20040614-1.c | 20 + gcc/testsuite/gcc.c-torture/compile/20040621-1.c | 17 + gcc/testsuite/gcc.c-torture/compile/20040624-1.c | 3 + gcc/testsuite/gcc.c-torture/compile/20040705-1.c | 2 + gcc/testsuite/gcc.c-torture/compile/20040708-1.c | 68 ++ gcc/testsuite/gcc.c-torture/compile/20040709-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/20040726-1.c | 14 + gcc/testsuite/gcc.c-torture/compile/20040726-2.c | 22 + gcc/testsuite/gcc.c-torture/compile/20040727-1.c | 32 + gcc/testsuite/gcc.c-torture/compile/20040730-1.c | 17 + gcc/testsuite/gcc.c-torture/compile/20040817-1.c | 19 + gcc/testsuite/gcc.c-torture/compile/20040824-1.c | 2 + gcc/testsuite/gcc.c-torture/compile/20040901-1.c | 2 + gcc/testsuite/gcc.c-torture/compile/20040907-1.c | 13 + gcc/testsuite/gcc.c-torture/compile/20040908-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/20040909-1.c | 13 + gcc/testsuite/gcc.c-torture/compile/20040914-1.c | 39 ++ gcc/testsuite/gcc.c-torture/compile/20040916-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/20041005-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/20041007-1.c | 16 + gcc/testsuite/gcc.c-torture/compile/20041018-1.c | 18 + gcc/testsuite/gcc.c-torture/compile/20041026-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/20041119-1.c | 30 + gcc/testsuite/gcc.c-torture/compile/20041211-1.c | 13 + gcc/testsuite/gcc.c-torture/compile/20050105-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/20050113-1.c | 16 + gcc/testsuite/gcc.c-torture/compile/20050119-1.c | 25 + gcc/testsuite/gcc.c-torture/compile/20050122-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/20050122-2.c | 21 + gcc/testsuite/gcc.c-torture/compile/20050202-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/20050206-1.c | 8 + gcc/testsuite/gcc.c-torture/compile/20050210-1.c | 8 + gcc/testsuite/gcc.c-torture/compile/20050215-1.c | 4 + gcc/testsuite/gcc.c-torture/compile/20050215-2.c | 7 + gcc/testsuite/gcc.c-torture/compile/20050215-3.c | 8 + gcc/testsuite/gcc.c-torture/compile/20050217-1.c | 14 + gcc/testsuite/gcc.c-torture/compile/20050303-1.c | 13 + gcc/testsuite/gcc.c-torture/compile/20050328-1.c | 24 + gcc/testsuite/gcc.c-torture/compile/20050423-1.c | 16 + gcc/testsuite/gcc.c-torture/compile/20050510-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/20050516-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/20050520-1.c | 13 + gcc/testsuite/gcc.c-torture/compile/20050622-1.c | 16 + gcc/testsuite/gcc.c-torture/compile/20050721-1.c | 57 ++ gcc/testsuite/gcc.c-torture/compile/20050801-1.c | 8 + gcc/testsuite/gcc.c-torture/compile/20050801-2.c | 12 + gcc/testsuite/gcc.c-torture/compile/20051207-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/20051216-1.c | 131 ++++ gcc/testsuite/gcc.c-torture/compile/20051228-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/20060109-1.c | 36 + gcc/testsuite/gcc.c-torture/compile/20060202-1.c | 54 ++ gcc/testsuite/gcc.c-torture/compile/20060208-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/20060215-1.c | 42 ++ gcc/testsuite/gcc.c-torture/compile/20060217-1.c | 25 + gcc/testsuite/gcc.c-torture/compile/20060309-1.c | 3 + gcc/testsuite/gcc.c-torture/compile/20060419-1.c | 21 + gcc/testsuite/gcc.c-torture/compile/20060421-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/20060609-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/20060625-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/20060823-1.c | 18 + gcc/testsuite/gcc.c-torture/compile/20060826-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/20060904-1.c | 27 + gcc/testsuite/gcc.c-torture/compile/20061005-1.c | 23 + gcc/testsuite/gcc.c-torture/compile/20061214-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/20070121.c | 18 + gcc/testsuite/gcc.c-torture/compile/20070129.c | 94 +++ gcc/testsuite/gcc.c-torture/compile/20070419-1.c | 17 + gcc/testsuite/gcc.c-torture/compile/20070501-1.c | 16 + gcc/testsuite/gcc.c-torture/compile/20070520-1.c | 35 + gcc/testsuite/gcc.c-torture/compile/20070522-1.c | 13 + gcc/testsuite/gcc.c-torture/compile/20070529-1.c | 16 + gcc/testsuite/gcc.c-torture/compile/20070529-2.c | 11 + gcc/testsuite/gcc.c-torture/compile/20070531-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/20070531-2.c | 6 + gcc/testsuite/gcc.c-torture/compile/20070603-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/20070603-2.c | 9 + gcc/testsuite/gcc.c-torture/compile/20070605-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/20070827-1.c | 20 + gcc/testsuite/gcc.c-torture/compile/20070905-1.c | 34 + gcc/testsuite/gcc.c-torture/compile/20070906-1.c | 8 + gcc/testsuite/gcc.c-torture/compile/20070915-1.c | 20 + gcc/testsuite/gcc.c-torture/compile/20070919-1.c | 31 + gcc/testsuite/gcc.c-torture/compile/20071027-1.c | 25 + gcc/testsuite/gcc.c-torture/compile/20071102-1.c | 32 + gcc/testsuite/gcc.c-torture/compile/20071105-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/20071107-1.c | 332 +++++++++ gcc/testsuite/gcc.c-torture/compile/20071108-1.c | 13 + gcc/testsuite/gcc.c-torture/compile/20071114-1.c | 113 +++ gcc/testsuite/gcc.c-torture/compile/20071117-1.c | 13 + gcc/testsuite/gcc.c-torture/compile/20071118-1.c | 17 + gcc/testsuite/gcc.c-torture/compile/20071128-1.c | 24 + gcc/testsuite/gcc.c-torture/compile/20071203-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/20071207-1.c | 14 + gcc/testsuite/gcc.c-torture/compile/20071214-1.c | 15 + gcc/testsuite/gcc.c-torture/compile/20080114-1.c | 14 + gcc/testsuite/gcc.c-torture/compile/20080124-1.c | 52 ++ gcc/testsuite/gcc.c-torture/compile/20080419-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/20080613-1.c | 40 ++ gcc/testsuite/gcc.c-torture/compile/20080625-1.c | 17 + gcc/testsuite/gcc.c-torture/compile/20080628-1.c | 15 + gcc/testsuite/gcc.c-torture/compile/20080704-1.c | 43 ++ gcc/testsuite/gcc.c-torture/compile/20080721-1.c | 15 + gcc/testsuite/gcc.c-torture/compile/20080806-1.c | 41 ++ gcc/testsuite/gcc.c-torture/compile/20080812-1.c | 21 + gcc/testsuite/gcc.c-torture/compile/20080820-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/20080903-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/20080910-1.c | 56 ++ gcc/testsuite/gcc.c-torture/compile/20080922-1.c | 29 + gcc/testsuite/gcc.c-torture/compile/20080929-1.c | 39 ++ gcc/testsuite/gcc.c-torture/compile/20081101-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/20081108-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/20081108-2.c | 4 + gcc/testsuite/gcc.c-torture/compile/20081108-3.c | 4 + gcc/testsuite/gcc.c-torture/compile/20081119-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/20081203-1.c | 24 + gcc/testsuite/gcc.c-torture/compile/20090107-1.c | 25 + gcc/testsuite/gcc.c-torture/compile/20090114-1.c | 44 ++ gcc/testsuite/gcc.c-torture/compile/20090209-1.c | 61 ++ gcc/testsuite/gcc.c-torture/compile/20090303-1.c | 20 + gcc/testsuite/gcc.c-torture/compile/20090303-2.c | 20 + gcc/testsuite/gcc.c-torture/compile/20090328-1.c | 17 + gcc/testsuite/gcc.c-torture/compile/20090331-1.c | 26 + gcc/testsuite/gcc.c-torture/compile/20090401-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/20090518-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/20090519-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/20090721-1.c | 3 + gcc/testsuite/gcc.c-torture/compile/20090907-1.c | 84 +++ gcc/testsuite/gcc.c-torture/compile/20090917-1.c | 55 ++ gcc/testsuite/gcc.c-torture/compile/20091215-1.c | 15 + gcc/testsuite/gcc.c-torture/compile/20100609-1.c | 8 + gcc/testsuite/gcc.c-torture/compile/20100907.c | 9 + gcc/testsuite/gcc.c-torture/compile/20100915-1.c | 82 +++ gcc/testsuite/gcc.c-torture/compile/20101217-1.c | 36 + gcc/testsuite/gcc.c-torture/compile/20110126-1.c | 18 + gcc/testsuite/gcc.c-torture/compile/20110131-1.c | 38 + gcc/testsuite/gcc.c-torture/compile/20110906-1.c | 22 + gcc/testsuite/gcc.c-torture/compile/20110913-1.c | 26 + gcc/testsuite/gcc.c-torture/compile/20121107-1.c | 14 + gcc/testsuite/gcc.c-torture/compile/900116-1.c | 14 + gcc/testsuite/gcc.c-torture/compile/900216-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/900313-1.c | 172 +++++ gcc/testsuite/gcc.c-torture/compile/900407-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/900516-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/920301-1.c | 4 + gcc/testsuite/gcc.c-torture/compile/920409-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/920409-2.c | 2 + gcc/testsuite/gcc.c-torture/compile/920410-1.c | 30 + gcc/testsuite/gcc.c-torture/compile/920410-2.c | 12 + gcc/testsuite/gcc.c-torture/compile/920411-2.c | 1 + gcc/testsuite/gcc.c-torture/compile/920413-1.c | 2 + gcc/testsuite/gcc.c-torture/compile/920415-1.c | 20 + gcc/testsuite/gcc.c-torture/compile/920428-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/920428-2.c | 531 ++++++++++++++ gcc/testsuite/gcc.c-torture/compile/920428-3.c | 5 + gcc/testsuite/gcc.c-torture/compile/920428-4.c | 1 + gcc/testsuite/gcc.c-torture/compile/920428-5.c | 1 + gcc/testsuite/gcc.c-torture/compile/920428-6.c | 22 + gcc/testsuite/gcc.c-torture/compile/920428-7.c | 1 + gcc/testsuite/gcc.c-torture/compile/920501-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/920501-10.c | 1 + gcc/testsuite/gcc.c-torture/compile/920501-11.c | 1 + gcc/testsuite/gcc.c-torture/compile/920501-12.c | 10 + gcc/testsuite/gcc.c-torture/compile/920501-13.c | 1 + gcc/testsuite/gcc.c-torture/compile/920501-15.c | 1 + gcc/testsuite/gcc.c-torture/compile/920501-16.c | 1 + gcc/testsuite/gcc.c-torture/compile/920501-17.c | 1 + gcc/testsuite/gcc.c-torture/compile/920501-18.c | 2 + gcc/testsuite/gcc.c-torture/compile/920501-19.c | 1 + gcc/testsuite/gcc.c-torture/compile/920501-2.c | 11 + gcc/testsuite/gcc.c-torture/compile/920501-20.c | 1 + gcc/testsuite/gcc.c-torture/compile/920501-21.c | 3 + gcc/testsuite/gcc.c-torture/compile/920501-22.c | 1 + gcc/testsuite/gcc.c-torture/compile/920501-23.c | 16 + gcc/testsuite/gcc.c-torture/compile/920501-3.c | 2 + gcc/testsuite/gcc.c-torture/compile/920501-4.c | 54 ++ gcc/testsuite/gcc.c-torture/compile/920501-6.c | 1 + gcc/testsuite/gcc.c-torture/compile/920501-7.c | 5 + gcc/testsuite/gcc.c-torture/compile/920501-8.c | 1 + gcc/testsuite/gcc.c-torture/compile/920501-9.c | 1 + gcc/testsuite/gcc.c-torture/compile/920502-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/920502-2.c | 1 + gcc/testsuite/gcc.c-torture/compile/920520-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/920521-1.c | 3 + gcc/testsuite/gcc.c-torture/compile/920529-1.c | 21 + gcc/testsuite/gcc.c-torture/compile/920608-1.c | 25 + gcc/testsuite/gcc.c-torture/compile/920611-2.c | 53 ++ gcc/testsuite/gcc.c-torture/compile/920615-1.c | 4 + gcc/testsuite/gcc.c-torture/compile/920617-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/920617-2.c | 1 + gcc/testsuite/gcc.c-torture/compile/920623-1.c | 2 + gcc/testsuite/gcc.c-torture/compile/920624-1.c | 2 + gcc/testsuite/gcc.c-torture/compile/920625-1.c | 279 ++++++++ gcc/testsuite/gcc.c-torture/compile/920625-2.c | 103 +++ gcc/testsuite/gcc.c-torture/compile/920626-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/920701-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/920702-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/920706-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/920710-2.c | 36 + gcc/testsuite/gcc.c-torture/compile/920711-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/920721-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/920723-1.c | 31 + gcc/testsuite/gcc.c-torture/compile/920729-1.c | 2 + gcc/testsuite/gcc.c-torture/compile/920806-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/920808-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/920809-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/920817-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/920820-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/920821-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/920821-2.c | 4 + gcc/testsuite/gcc.c-torture/compile/920825-1.c | 3 + gcc/testsuite/gcc.c-torture/compile/920825-2.c | 3 + gcc/testsuite/gcc.c-torture/compile/920826-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/920828-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/920829-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/920831-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/920902-1.c | 2 + gcc/testsuite/gcc.c-torture/compile/920909-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/920917-1.c | 2 + gcc/testsuite/gcc.c-torture/compile/920928-1.c | 2 + gcc/testsuite/gcc.c-torture/compile/920928-2.c | 19 + gcc/testsuite/gcc.c-torture/compile/920928-3.c | 19 + gcc/testsuite/gcc.c-torture/compile/920928-4.c | 113 +++ gcc/testsuite/gcc.c-torture/compile/920928-5.c | 7 + gcc/testsuite/gcc.c-torture/compile/920928-6.c | 2 + gcc/testsuite/gcc.c-torture/compile/921004-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/921011-1.c | 27 + gcc/testsuite/gcc.c-torture/compile/921011-2.c | 65 ++ gcc/testsuite/gcc.c-torture/compile/921012-1.c | 4 + gcc/testsuite/gcc.c-torture/compile/921012-2.c | 7 + gcc/testsuite/gcc.c-torture/compile/921013-1.c | 4 + gcc/testsuite/gcc.c-torture/compile/921019-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/921021-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/921024-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/921026-1.c | 4 + gcc/testsuite/gcc.c-torture/compile/921103-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/921109-1.c | 28 + gcc/testsuite/gcc.c-torture/compile/921111-1.c | 40 ++ gcc/testsuite/gcc.c-torture/compile/921116-2.c | 9 + gcc/testsuite/gcc.c-torture/compile/921118-1.c | 8 + gcc/testsuite/gcc.c-torture/compile/921126-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/921202-1.c | 22 + gcc/testsuite/gcc.c-torture/compile/921202-2.c | 8 + gcc/testsuite/gcc.c-torture/compile/921203-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/921203-2.c | 13 + gcc/testsuite/gcc.c-torture/compile/921206-1.c | 28 + gcc/testsuite/gcc.c-torture/compile/921227-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/930109-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/930109-2.c | 11 + gcc/testsuite/gcc.c-torture/compile/930111-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/930117-1.c | 4 + gcc/testsuite/gcc.c-torture/compile/930118-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/930120-1.c | 138 ++++ gcc/testsuite/gcc.c-torture/compile/930126-1.c | 74 ++ gcc/testsuite/gcc.c-torture/compile/930210-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/930217-1.c | 20 + gcc/testsuite/gcc.c-torture/compile/930222-1.c | 16 + gcc/testsuite/gcc.c-torture/compile/930325-1.c | 23 + gcc/testsuite/gcc.c-torture/compile/930326-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/930411-1.c | 36 + gcc/testsuite/gcc.c-torture/compile/930421-1.c | 19 + gcc/testsuite/gcc.c-torture/compile/930427-2.c | 9 + gcc/testsuite/gcc.c-torture/compile/930503-1.c | 8 + gcc/testsuite/gcc.c-torture/compile/930503-2.c | 5 + gcc/testsuite/gcc.c-torture/compile/930506-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/930506-2.c | 15 + gcc/testsuite/gcc.c-torture/compile/930510-1.c | 18 + gcc/testsuite/gcc.c-torture/compile/930513-1.c | 15 + gcc/testsuite/gcc.c-torture/compile/930513-2.c | 9 + gcc/testsuite/gcc.c-torture/compile/930513-3.c | 9 + gcc/testsuite/gcc.c-torture/compile/930523-1.c | 54 ++ gcc/testsuite/gcc.c-torture/compile/930525-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/930527-1.c | 16 + gcc/testsuite/gcc.c-torture/compile/930529-1.c | 83 +++ gcc/testsuite/gcc.c-torture/compile/930530-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/930602-1.c | 13 + gcc/testsuite/gcc.c-torture/compile/930603-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/930607-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/930611-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/930618-1.c | 8 + gcc/testsuite/gcc.c-torture/compile/930621-1.c | 38 + gcc/testsuite/gcc.c-torture/compile/930623-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/930702-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/930926-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/930927-1.c | 3 + gcc/testsuite/gcc.c-torture/compile/931003-1.c | 15 + gcc/testsuite/gcc.c-torture/compile/931004-1.c | 8 + gcc/testsuite/gcc.c-torture/compile/931013-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/931013-2.c | 20 + gcc/testsuite/gcc.c-torture/compile/931013-3.c | 11 + gcc/testsuite/gcc.c-torture/compile/931018-1.c | 14 + gcc/testsuite/gcc.c-torture/compile/931031-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/931102-1.c | 111 +++ gcc/testsuite/gcc.c-torture/compile/931102-2.c | 21 + gcc/testsuite/gcc.c-torture/compile/931203-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/940611-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/940712-1.c | 4 + gcc/testsuite/gcc.c-torture/compile/940718-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/941014-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/941014-2.c | 37 + gcc/testsuite/gcc.c-torture/compile/941014-3.c | 72 ++ gcc/testsuite/gcc.c-torture/compile/941014-4.c | 16 + gcc/testsuite/gcc.c-torture/compile/941019-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/941111-1.c | 8 + gcc/testsuite/gcc.c-torture/compile/941113-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/950122-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/950124-1.c | 15 + gcc/testsuite/gcc.c-torture/compile/950221-1.c | 16 + gcc/testsuite/gcc.c-torture/compile/950329-1.c | 19 + gcc/testsuite/gcc.c-torture/compile/950512-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/950530-1.c | 4 + gcc/testsuite/gcc.c-torture/compile/950607-1.c | 38 + gcc/testsuite/gcc.c-torture/compile/950610-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/950612-1.c | 134 ++++ gcc/testsuite/gcc.c-torture/compile/950613-1.c | 31 + gcc/testsuite/gcc.c-torture/compile/950618-1.c | 2 + gcc/testsuite/gcc.c-torture/compile/950719-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/950729-1.c | 39 ++ gcc/testsuite/gcc.c-torture/compile/950816-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/950816-2.c | 8 + gcc/testsuite/gcc.c-torture/compile/950816-3.c | 8 + gcc/testsuite/gcc.c-torture/compile/950910-1.c | 22 + gcc/testsuite/gcc.c-torture/compile/950919-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/950921-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/950922-1.c | 68 ++ gcc/testsuite/gcc.c-torture/compile/951004-1.c | 23 + gcc/testsuite/gcc.c-torture/compile/951106-1.c | 4 + gcc/testsuite/gcc.c-torture/compile/951116-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/951128-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/951220-1.c | 4 + gcc/testsuite/gcc.c-torture/compile/951222-1.c | 15 + gcc/testsuite/gcc.c-torture/compile/960106-1.c | 4 + gcc/testsuite/gcc.c-torture/compile/960130-1.c | 8 + gcc/testsuite/gcc.c-torture/compile/960201-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/960218-1.c | 2 + gcc/testsuite/gcc.c-torture/compile/960220-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/960221-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/960319-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/960514-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/960704-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/960829-1.c | 4 + gcc/testsuite/gcc.c-torture/compile/961004-1.c | 37 + gcc/testsuite/gcc.c-torture/compile/961010-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/961019-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/961031-1.c | 16 + gcc/testsuite/gcc.c-torture/compile/961126-1.c | 107 +++ gcc/testsuite/gcc.c-torture/compile/961203-1.c | 22 + gcc/testsuite/gcc.c-torture/compile/970206-1.c | 13 + gcc/testsuite/gcc.c-torture/compile/970214-1.c | 3 + gcc/testsuite/gcc.c-torture/compile/980329-1.c | 72 ++ gcc/testsuite/gcc.c-torture/compile/980408-1.c | 129 ++++ gcc/testsuite/gcc.c-torture/compile/980504-1.c | 28 + gcc/testsuite/gcc.c-torture/compile/980506-1.c | 70 ++ gcc/testsuite/gcc.c-torture/compile/980506-2.c | 89 +++ gcc/testsuite/gcc.c-torture/compile/980511-1.c | 20 + gcc/testsuite/gcc.c-torture/compile/980701-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/980706-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/980726-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/980729-1.c | 14 + gcc/testsuite/gcc.c-torture/compile/980816-1.c | 51 ++ gcc/testsuite/gcc.c-torture/compile/980821-1.c | 15 + gcc/testsuite/gcc.c-torture/compile/980825-1.c | 30 + gcc/testsuite/gcc.c-torture/compile/981001-1.c | 18 + gcc/testsuite/gcc.c-torture/compile/981001-2.c | 14 + gcc/testsuite/gcc.c-torture/compile/981001-3.c | 14 + gcc/testsuite/gcc.c-torture/compile/981001-4.c | 14 + gcc/testsuite/gcc.c-torture/compile/981006-1.c | 53 ++ gcc/testsuite/gcc.c-torture/compile/981007-1.c | 21 + gcc/testsuite/gcc.c-torture/compile/981107-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/981223-1.c | 17 + gcc/testsuite/gcc.c-torture/compile/990107-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/990117-1.c | 13 + gcc/testsuite/gcc.c-torture/compile/990203-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/990517-1.c | 30 + gcc/testsuite/gcc.c-torture/compile/990519-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/990523-1.c | 30 + gcc/testsuite/gcc.c-torture/compile/990527-1.c | 37 + gcc/testsuite/gcc.c-torture/compile/990617-1.c | 21 + gcc/testsuite/gcc.c-torture/compile/990625-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/990625-2.c | 12 + gcc/testsuite/gcc.c-torture/compile/990801-1.c | 26 + gcc/testsuite/gcc.c-torture/compile/990801-2.c | 11 + gcc/testsuite/gcc.c-torture/compile/990829-1.c | 13 + gcc/testsuite/gcc.c-torture/compile/990913-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/990928-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/991008-1.c | 23 + gcc/testsuite/gcc.c-torture/compile/991026-1.c | 13 + gcc/testsuite/gcc.c-torture/compile/991026-2.c | 33 + gcc/testsuite/gcc.c-torture/compile/991127-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/991202-1.c | 18 + gcc/testsuite/gcc.c-torture/compile/991208-1.c | 4 + gcc/testsuite/gcc.c-torture/compile/991213-1.c | 13 + gcc/testsuite/gcc.c-torture/compile/991213-2.c | 15 + gcc/testsuite/gcc.c-torture/compile/991213-3.c | 2 + gcc/testsuite/gcc.c-torture/compile/991214-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/991214-2.c | 28 + gcc/testsuite/gcc.c-torture/compile/991229-1.c | 23 + gcc/testsuite/gcc.c-torture/compile/991229-2.c | 10 + gcc/testsuite/gcc.c-torture/compile/991229-3.c | 17 + gcc/testsuite/gcc.c-torture/compile/acc1.c | 21 + gcc/testsuite/gcc.c-torture/compile/asmgoto-1.c | 30 + gcc/testsuite/gcc.c-torture/compile/bcopy-1.c | 14 + .../gcc.c-torture/compile/builtin_constant_p.c | 6 + .../gcc.c-torture/compile/builtin_unreachable-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/calls.c | 22 + gcc/testsuite/gcc.c-torture/compile/cmpdi-1.c | 15 + gcc/testsuite/gcc.c-torture/compile/combine-hang.c | 26 + gcc/testsuite/gcc.c-torture/compile/compile.exp | 34 + gcc/testsuite/gcc.c-torture/compile/complex-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/complex-2.c | 16 + gcc/testsuite/gcc.c-torture/compile/complex-3.c | 17 + gcc/testsuite/gcc.c-torture/compile/complex-4.c | 9 + gcc/testsuite/gcc.c-torture/compile/complex-5.c | 9 + gcc/testsuite/gcc.c-torture/compile/complex-6.c | 17 + .../gcc.c-torture/compile/compound-literal-1.c | 9 + .../gcc.c-torture/compile/compound-literal-2.c | 8 + .../gcc.c-torture/compile/compound-literal-3.c | 8 + .../gcc.c-torture/compile/const-high-part.c | 19 + gcc/testsuite/gcc.c-torture/compile/cpp-1.c | 8 + gcc/testsuite/gcc.c-torture/compile/cpp-2.c | 5 + .../gcc.c-torture/compile/debugvlafunction-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/dll.c | 23 + .../gcc.c-torture/compile/fix-trunc-mem-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/funcptr-1.c | 19 + gcc/testsuite/gcc.c-torture/compile/goto-1.c | 16 + gcc/testsuite/gcc.c-torture/compile/iftrap-1.c | 99 +++ gcc/testsuite/gcc.c-torture/compile/iftrap-2.c | 10 + gcc/testsuite/gcc.c-torture/compile/iftrap-3.c | 4 + gcc/testsuite/gcc.c-torture/compile/init-1.c | 19 + gcc/testsuite/gcc.c-torture/compile/init-2.c | 4 + gcc/testsuite/gcc.c-torture/compile/init-3.c | 11 + gcc/testsuite/gcc.c-torture/compile/inline-1.c | 21 + gcc/testsuite/gcc.c-torture/compile/labels-1.c | 13 + gcc/testsuite/gcc.c-torture/compile/labels-2.c | 10 + gcc/testsuite/gcc.c-torture/compile/labels-3.c | 18 + gcc/testsuite/gcc.c-torture/compile/libcall-1.c | 14 + .../gcc.c-torture/compile/limits-blockid.c | 22 + .../gcc.c-torture/compile/limits-caselabels.c | 21 + .../gcc.c-torture/compile/limits-declparen.c | 16 + .../gcc.c-torture/compile/limits-enumconst.c | 22 + .../gcc.c-torture/compile/limits-exprparen.c | 15 + .../gcc.c-torture/compile/limits-externalid.c | 15 + .../gcc.c-torture/compile/limits-externdecl.c | 56 ++ .../gcc.c-torture/compile/limits-fnargs.c | 23 + .../gcc.c-torture/compile/limits-fndefn.c | 19 + .../gcc.c-torture/compile/limits-idexternal.c | 11 + .../gcc.c-torture/compile/limits-idinternal.c | 11 + .../gcc.c-torture/compile/limits-pointer.c | 9 + .../gcc.c-torture/compile/limits-stringlit.c | 12 + .../gcc.c-torture/compile/limits-structmem.c | 18 + .../gcc.c-torture/compile/limits-structnest.c | 23 + .../gcc.c-torture/compile/m68k-byte-addr.c | 20 + gcc/testsuite/gcc.c-torture/compile/mangle-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/memcpy-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/memcpy-2.c | 10 + gcc/testsuite/gcc.c-torture/compile/mipscop-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/mipscop-2.c | 18 + gcc/testsuite/gcc.c-torture/compile/mipscop-3.c | 18 + gcc/testsuite/gcc.c-torture/compile/mipscop-4.c | 19 + gcc/testsuite/gcc.c-torture/compile/nested-1.c | 21 + gcc/testsuite/gcc.c-torture/compile/nested-2.c | 16 + gcc/testsuite/gcc.c-torture/compile/packed-1.c | 14 + gcc/testsuite/gcc.c-torture/compile/pc44485.c | 46 ++ gcc/testsuite/gcc.c-torture/compile/pr12517.c | 19 + gcc/testsuite/gcc.c-torture/compile/pr12578.c | 15 + gcc/testsuite/gcc.c-torture/compile/pr12899.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr13066-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/pr13889.c | 7 + gcc/testsuite/gcc.c-torture/compile/pr14692.c | 14 + gcc/testsuite/gcc.c-torture/compile/pr14730.c | 16 + gcc/testsuite/gcc.c-torture/compile/pr15245.c | 21 + gcc/testsuite/gcc.c-torture/compile/pr16461.c | 14 + gcc/testsuite/gcc.c-torture/compile/pr16566-1.c | 15 + gcc/testsuite/gcc.c-torture/compile/pr16566-2.c | 14 + gcc/testsuite/gcc.c-torture/compile/pr16566-3.c | 12 + gcc/testsuite/gcc.c-torture/compile/pr16808.c | 38 + gcc/testsuite/gcc.c-torture/compile/pr17119.c | 19 + gcc/testsuite/gcc.c-torture/compile/pr17273.c | 22 + gcc/testsuite/gcc.c-torture/compile/pr17397.c | 12 + gcc/testsuite/gcc.c-torture/compile/pr17407.c | 15 + gcc/testsuite/gcc.c-torture/compile/pr17408.c | 5 + gcc/testsuite/gcc.c-torture/compile/pr17529.c | 14 + gcc/testsuite/gcc.c-torture/compile/pr17558.c | 10 + gcc/testsuite/gcc.c-torture/compile/pr17656.c | 18 + gcc/testsuite/gcc.c-torture/compile/pr17906.c | 7 + gcc/testsuite/gcc.c-torture/compile/pr17913.c | 7 + gcc/testsuite/gcc.c-torture/compile/pr18291.c | 12 + gcc/testsuite/gcc.c-torture/compile/pr18299-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/pr18712.c | 17 + gcc/testsuite/gcc.c-torture/compile/pr18903.c | 17 + gcc/testsuite/gcc.c-torture/compile/pr19080.c | 115 +++ gcc/testsuite/gcc.c-torture/compile/pr19121.c | 23 + gcc/testsuite/gcc.c-torture/compile/pr19357.c | 8 + gcc/testsuite/gcc.c-torture/compile/pr19736.c | 21 + gcc/testsuite/gcc.c-torture/compile/pr19853.c | 19 + gcc/testsuite/gcc.c-torture/compile/pr20203.c | 16 + gcc/testsuite/gcc.c-torture/compile/pr20412.c | 20 + gcc/testsuite/gcc.c-torture/compile/pr20539-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/pr20583.c | 30 + gcc/testsuite/gcc.c-torture/compile/pr20928.c | 10 + gcc/testsuite/gcc.c-torture/compile/pr21021.c | 19 + gcc/testsuite/gcc.c-torture/compile/pr21030.c | 19 + gcc/testsuite/gcc.c-torture/compile/pr21293.c | 12 + gcc/testsuite/gcc.c-torture/compile/pr21356.c | 13 + gcc/testsuite/gcc.c-torture/compile/pr21380.c | 42 ++ gcc/testsuite/gcc.c-torture/compile/pr21532.c | 14 + gcc/testsuite/gcc.c-torture/compile/pr21562.c | 25 + gcc/testsuite/gcc.c-torture/compile/pr21638.c | 21 + gcc/testsuite/gcc.c-torture/compile/pr21728.c | 10 + gcc/testsuite/gcc.c-torture/compile/pr21761.c | 9 + gcc/testsuite/gcc.c-torture/compile/pr21839.c | 12 + gcc/testsuite/gcc.c-torture/compile/pr21840.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr22013-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr22269.c | 16 + gcc/testsuite/gcc.c-torture/compile/pr22379.c | 23 + gcc/testsuite/gcc.c-torture/compile/pr22398.c | 21 + gcc/testsuite/gcc.c-torture/compile/pr22422.c | 30 + gcc/testsuite/gcc.c-torture/compile/pr22531.c | 7 + gcc/testsuite/gcc.c-torture/compile/pr22589-1.c | 4 + gcc/testsuite/gcc.c-torture/compile/pr23233-1.c | 8 + gcc/testsuite/gcc.c-torture/compile/pr23237.c | 16 + gcc/testsuite/gcc.c-torture/compile/pr23435.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr23445.c | 10 + gcc/testsuite/gcc.c-torture/compile/pr23476.c | 14 + gcc/testsuite/gcc.c-torture/compile/pr23929.c | 21 + gcc/testsuite/gcc.c-torture/compile/pr23944.c | 4 + gcc/testsuite/gcc.c-torture/compile/pr23946.c | 72 ++ gcc/testsuite/gcc.c-torture/compile/pr23960.c | 12 + gcc/testsuite/gcc.c-torture/compile/pr24227.c | 6 + gcc/testsuite/gcc.c-torture/compile/pr24883.c | 21 + gcc/testsuite/gcc.c-torture/compile/pr24930.c | 17 + gcc/testsuite/gcc.c-torture/compile/pr25224.c | 20 + gcc/testsuite/gcc.c-torture/compile/pr25310.c | 22 + gcc/testsuite/gcc.c-torture/compile/pr25311.c | 47 ++ gcc/testsuite/gcc.c-torture/compile/pr25483.c | 15 + gcc/testsuite/gcc.c-torture/compile/pr25513.c | 9 + gcc/testsuite/gcc.c-torture/compile/pr25514.c | 24 + gcc/testsuite/gcc.c-torture/compile/pr25860.c | 20 + gcc/testsuite/gcc.c-torture/compile/pr25861.c | 4 + gcc/testsuite/gcc.c-torture/compile/pr26213.c | 15 + gcc/testsuite/gcc.c-torture/compile/pr26255.c | 31 + gcc/testsuite/gcc.c-torture/compile/pr26425.c | 9 + gcc/testsuite/gcc.c-torture/compile/pr26622.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr26626.c | 13 + gcc/testsuite/gcc.c-torture/compile/pr26725.c | 15 + gcc/testsuite/gcc.c-torture/compile/pr26781-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr26781-2.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr26833.c | 19 + gcc/testsuite/gcc.c-torture/compile/pr26840.c | 42 ++ gcc/testsuite/gcc.c-torture/compile/pr27087.c | 23 + gcc/testsuite/gcc.c-torture/compile/pr27282.c | 17 + gcc/testsuite/gcc.c-torture/compile/pr27341-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/pr27341-2.c | 8 + gcc/testsuite/gcc.c-torture/compile/pr27373.c | 40 ++ gcc/testsuite/gcc.c-torture/compile/pr27528.c | 40 ++ gcc/testsuite/gcc.c-torture/compile/pr27571.c | 27 + gcc/testsuite/gcc.c-torture/compile/pr27863.c | 28 + gcc/testsuite/gcc.c-torture/compile/pr27889.c | 13 + gcc/testsuite/gcc.c-torture/compile/pr27907.c | 23 + gcc/testsuite/gcc.c-torture/compile/pr28489.c | 48 ++ gcc/testsuite/gcc.c-torture/compile/pr28675.c | 38 + gcc/testsuite/gcc.c-torture/compile/pr28776-1.c | 16 + gcc/testsuite/gcc.c-torture/compile/pr28776-2.c | 26 + gcc/testsuite/gcc.c-torture/compile/pr28905.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr29128.c | 28 + gcc/testsuite/gcc.c-torture/compile/pr29201.c | 116 +++ gcc/testsuite/gcc.c-torture/compile/pr29241.c | 15 + gcc/testsuite/gcc.c-torture/compile/pr29250.c | 32 + gcc/testsuite/gcc.c-torture/compile/pr29945.c | 8 + gcc/testsuite/gcc.c-torture/compile/pr30132.c | 5 + gcc/testsuite/gcc.c-torture/compile/pr30311.c | 16 + gcc/testsuite/gcc.c-torture/compile/pr30338.c | 14 + gcc/testsuite/gcc.c-torture/compile/pr30433.c | 2 + gcc/testsuite/gcc.c-torture/compile/pr30564-1.c | 15 + gcc/testsuite/gcc.c-torture/compile/pr30564-2.c | 12 + gcc/testsuite/gcc.c-torture/compile/pr30984.c | 7 + gcc/testsuite/gcc.c-torture/compile/pr31034.c | 14 + gcc/testsuite/gcc.c-torture/compile/pr31345-1.c | 24 + gcc/testsuite/gcc.c-torture/compile/pr31541.c | 9 + gcc/testsuite/gcc.c-torture/compile/pr31703.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr31710.c | 6 + gcc/testsuite/gcc.c-torture/compile/pr31797.c | 31 + gcc/testsuite/gcc.c-torture/compile/pr31953.c | 14 + gcc/testsuite/gcc.c-torture/compile/pr32139.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr32169.c | 17 + gcc/testsuite/gcc.c-torture/compile/pr32349.c | 26 + gcc/testsuite/gcc.c-torture/compile/pr32355.c | 31 + gcc/testsuite/gcc.c-torture/compile/pr32372.c | 21 + gcc/testsuite/gcc.c-torture/compile/pr32399.c | 16 + gcc/testsuite/gcc.c-torture/compile/pr32453.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr32482.c | 23 + gcc/testsuite/gcc.c-torture/compile/pr32571.c | 38 + gcc/testsuite/gcc.c-torture/compile/pr32584.c | 74 ++ gcc/testsuite/gcc.c-torture/compile/pr32606.c | 30 + gcc/testsuite/gcc.c-torture/compile/pr32780.c | 10 + gcc/testsuite/gcc.c-torture/compile/pr32796.c | 6 + gcc/testsuite/gcc.c-torture/compile/pr32919.c | 26 + gcc/testsuite/gcc.c-torture/compile/pr32920.c | 7 + gcc/testsuite/gcc.c-torture/compile/pr32988.c | 20 + gcc/testsuite/gcc.c-torture/compile/pr33122.c | 14 + gcc/testsuite/gcc.c-torture/compile/pr33133.c | 50 ++ gcc/testsuite/gcc.c-torture/compile/pr33146.c | 19 + gcc/testsuite/gcc.c-torture/compile/pr33166.c | 10 + gcc/testsuite/gcc.c-torture/compile/pr33173.c | 102 +++ gcc/testsuite/gcc.c-torture/compile/pr33382.c | 95 +++ gcc/testsuite/gcc.c-torture/compile/pr33614.c | 9 + gcc/testsuite/gcc.c-torture/compile/pr33617.c | 9 + gcc/testsuite/gcc.c-torture/compile/pr33641.c | 12 + gcc/testsuite/gcc.c-torture/compile/pr33855.c | 27 + gcc/testsuite/gcc.c-torture/compile/pr34029-1.c | 22 + gcc/testsuite/gcc.c-torture/compile/pr34029-2.c | 12 + gcc/testsuite/gcc.c-torture/compile/pr34030.c | 8 + gcc/testsuite/gcc.c-torture/compile/pr34091.c | 175 +++++ gcc/testsuite/gcc.c-torture/compile/pr34093.c | 39 ++ gcc/testsuite/gcc.c-torture/compile/pr34113.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr34127.c | 9 + gcc/testsuite/gcc.c-torture/compile/pr34138.c | 21 + gcc/testsuite/gcc.c-torture/compile/pr34334.c | 140 ++++ gcc/testsuite/gcc.c-torture/compile/pr34448.c | 31 + gcc/testsuite/gcc.c-torture/compile/pr34458.c | 16 + gcc/testsuite/gcc.c-torture/compile/pr34648.c | 38 + gcc/testsuite/gcc.c-torture/compile/pr34688.c | 147 ++++ gcc/testsuite/gcc.c-torture/compile/pr34808.c | 29 + gcc/testsuite/gcc.c-torture/compile/pr34856.c | 18 + gcc/testsuite/gcc.c-torture/compile/pr34885.c | 14 + gcc/testsuite/gcc.c-torture/compile/pr34966.c | 21 + gcc/testsuite/gcc.c-torture/compile/pr34993.c | 5 + gcc/testsuite/gcc.c-torture/compile/pr35006.c | 29 + gcc/testsuite/gcc.c-torture/compile/pr35043.c | 20 + gcc/testsuite/gcc.c-torture/compile/pr35171.c | 10 + gcc/testsuite/gcc.c-torture/compile/pr35318.c | 9 + gcc/testsuite/gcc.c-torture/compile/pr35431.c | 15 + gcc/testsuite/gcc.c-torture/compile/pr35432.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr35468.c | 7 + gcc/testsuite/gcc.c-torture/compile/pr35492.c | 26 + gcc/testsuite/gcc.c-torture/compile/pr35595.c | 59 ++ gcc/testsuite/gcc.c-torture/compile/pr35607.c | 9 + gcc/testsuite/gcc.c-torture/compile/pr35760.c | 7 + gcc/testsuite/gcc.c-torture/compile/pr35869.c | 47 ++ gcc/testsuite/gcc.c-torture/compile/pr36125.c | 10 + gcc/testsuite/gcc.c-torture/compile/pr36141.c | 17 + gcc/testsuite/gcc.c-torture/compile/pr36154.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr36172.c | 17 + gcc/testsuite/gcc.c-torture/compile/pr36238.c | 27 + gcc/testsuite/gcc.c-torture/compile/pr36245.c | 21 + gcc/testsuite/gcc.c-torture/compile/pr36666.c | 22 + gcc/testsuite/gcc.c-torture/compile/pr36817.c | 10 + gcc/testsuite/gcc.c-torture/compile/pr36988.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr37026.c | 12 + gcc/testsuite/gcc.c-torture/compile/pr37056.c | 28 + gcc/testsuite/gcc.c-torture/compile/pr37078.c | 6 + gcc/testsuite/gcc.c-torture/compile/pr37207.c | 21 + gcc/testsuite/gcc.c-torture/compile/pr37258.c | 58 ++ gcc/testsuite/gcc.c-torture/compile/pr37285.c | 15 + gcc/testsuite/gcc.c-torture/compile/pr37305.c | 19 + gcc/testsuite/gcc.c-torture/compile/pr37327.c | 48 ++ gcc/testsuite/gcc.c-torture/compile/pr37341.c | 35 + gcc/testsuite/gcc.c-torture/compile/pr37380.c | 51 ++ gcc/testsuite/gcc.c-torture/compile/pr37381.c | 97 +++ gcc/testsuite/gcc.c-torture/compile/pr37382.c | 16 + gcc/testsuite/gcc.c-torture/compile/pr37387.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr37395.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr37418-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/pr37418-2.c | 6 + gcc/testsuite/gcc.c-torture/compile/pr37418-3.c | 6 + gcc/testsuite/gcc.c-torture/compile/pr37418-4.c | 6 + gcc/testsuite/gcc.c-torture/compile/pr37432.c | 9 + gcc/testsuite/gcc.c-torture/compile/pr37433.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr37483.c | 10 + gcc/testsuite/gcc.c-torture/compile/pr37617.c | 19 + gcc/testsuite/gcc.c-torture/compile/pr37662.c | 15 + gcc/testsuite/gcc.c-torture/compile/pr37664.c | 14 + gcc/testsuite/gcc.c-torture/compile/pr37669-2.c | 14 + gcc/testsuite/gcc.c-torture/compile/pr37669.c | 35 + gcc/testsuite/gcc.c-torture/compile/pr37713.c | 10 + gcc/testsuite/gcc.c-torture/compile/pr37742-3.c | 17 + gcc/testsuite/gcc.c-torture/compile/pr37742.c | 21 + gcc/testsuite/gcc.c-torture/compile/pr37878.c | 9 + gcc/testsuite/gcc.c-torture/compile/pr37913.c | 15 + gcc/testsuite/gcc.c-torture/compile/pr37955.c | 19 + gcc/testsuite/gcc.c-torture/compile/pr37976.c | 6 + gcc/testsuite/gcc.c-torture/compile/pr37991.c | 14 + gcc/testsuite/gcc.c-torture/compile/pr38123.c | 13 + gcc/testsuite/gcc.c-torture/compile/pr38343-2.c | 12 + gcc/testsuite/gcc.c-torture/compile/pr38343.c | 12 + gcc/testsuite/gcc.c-torture/compile/pr38359.c | 17 + gcc/testsuite/gcc.c-torture/compile/pr38360.c | 9 + gcc/testsuite/gcc.c-torture/compile/pr38428.c | 20 + gcc/testsuite/gcc.c-torture/compile/pr38505.c | 23 + gcc/testsuite/gcc.c-torture/compile/pr38554.c | 45 ++ gcc/testsuite/gcc.c-torture/compile/pr38564.c | 22 + gcc/testsuite/gcc.c-torture/compile/pr38590-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/pr38590-2.c | 6 + gcc/testsuite/gcc.c-torture/compile/pr38661-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/pr38661.c | 9 + gcc/testsuite/gcc.c-torture/compile/pr38752.c | 25 + gcc/testsuite/gcc.c-torture/compile/pr38771.c | 7 + gcc/testsuite/gcc.c-torture/compile/pr38789.c | 19 + gcc/testsuite/gcc.c-torture/compile/pr38807.c | 23 + gcc/testsuite/gcc.c-torture/compile/pr38857.c | 22 + gcc/testsuite/gcc.c-torture/compile/pr38926.c | 41 ++ gcc/testsuite/gcc.c-torture/compile/pr39041.c | 28 + gcc/testsuite/gcc.c-torture/compile/pr39202.c | 33 + gcc/testsuite/gcc.c-torture/compile/pr39360.c | 16 + gcc/testsuite/gcc.c-torture/compile/pr39394.c | 28 + gcc/testsuite/gcc.c-torture/compile/pr39614-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/pr39614-2.c | 6 + gcc/testsuite/gcc.c-torture/compile/pr39614-3.c | 6 + gcc/testsuite/gcc.c-torture/compile/pr39614-4.c | 6 + gcc/testsuite/gcc.c-torture/compile/pr39614-5.c | 8 + gcc/testsuite/gcc.c-torture/compile/pr39636.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr39648.c | 12 + gcc/testsuite/gcc.c-torture/compile/pr39673-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/pr39673-2.c | 6 + gcc/testsuite/gcc.c-torture/compile/pr39779.c | 5 + gcc/testsuite/gcc.c-torture/compile/pr39824.c | 26 + gcc/testsuite/gcc.c-torture/compile/pr39834.c | 13 + gcc/testsuite/gcc.c-torture/compile/pr39845.c | 45 ++ gcc/testsuite/gcc.c-torture/compile/pr39886.c | 12 + gcc/testsuite/gcc.c-torture/compile/pr39928-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/pr39928-2.c | 8 + gcc/testsuite/gcc.c-torture/compile/pr39937.c | 12 + gcc/testsuite/gcc.c-torture/compile/pr39941.c | 12 + gcc/testsuite/gcc.c-torture/compile/pr39943.c | 7 + gcc/testsuite/gcc.c-torture/compile/pr39983.c | 17 + gcc/testsuite/gcc.c-torture/compile/pr39999.c | 18 + gcc/testsuite/gcc.c-torture/compile/pr40023.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr40026.c | 15 + gcc/testsuite/gcc.c-torture/compile/pr40035.c | 20 + gcc/testsuite/gcc.c-torture/compile/pr40080.c | 44 ++ gcc/testsuite/gcc.c-torture/compile/pr40204.c | 15 + gcc/testsuite/gcc.c-torture/compile/pr40233.c | 10 + gcc/testsuite/gcc.c-torture/compile/pr40252.c | 6 + gcc/testsuite/gcc.c-torture/compile/pr40291.c | 7 + gcc/testsuite/gcc.c-torture/compile/pr40321.c | 12 + gcc/testsuite/gcc.c-torture/compile/pr40351.c | 22 + gcc/testsuite/gcc.c-torture/compile/pr40432.c | 17 + gcc/testsuite/gcc.c-torture/compile/pr40556.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr40570.c | 22 + gcc/testsuite/gcc.c-torture/compile/pr40582.c | 18 + gcc/testsuite/gcc.c-torture/compile/pr40640.c | 15 + gcc/testsuite/gcc.c-torture/compile/pr40676.c | 33 + gcc/testsuite/gcc.c-torture/compile/pr40692.c | 15 + gcc/testsuite/gcc.c-torture/compile/pr40753.c | 20 + gcc/testsuite/gcc.c-torture/compile/pr40964.c | 10 + gcc/testsuite/gcc.c-torture/compile/pr41006-1.c | 17 + gcc/testsuite/gcc.c-torture/compile/pr41006-2.c | 15 + gcc/testsuite/gcc.c-torture/compile/pr41016.c | 17 + gcc/testsuite/gcc.c-torture/compile/pr41101.c | 19 + gcc/testsuite/gcc.c-torture/compile/pr41163.c | 10 + gcc/testsuite/gcc.c-torture/compile/pr41181.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr41182-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/pr41282.c | 20 + gcc/testsuite/gcc.c-torture/compile/pr41469.c | 14 + gcc/testsuite/gcc.c-torture/compile/pr41634.c | 19 + gcc/testsuite/gcc.c-torture/compile/pr41646.c | 28 + gcc/testsuite/gcc.c-torture/compile/pr41661.c | 20 + gcc/testsuite/gcc.c-torture/compile/pr41679.c | 15 + gcc/testsuite/gcc.c-torture/compile/pr41728.c | 12 + gcc/testsuite/gcc.c-torture/compile/pr41987.c | 22 + gcc/testsuite/gcc.c-torture/compile/pr42025-1.c | 24 + gcc/testsuite/gcc.c-torture/compile/pr42025-2.c | 32 + gcc/testsuite/gcc.c-torture/compile/pr42049.c | 27 + gcc/testsuite/gcc.c-torture/compile/pr42164.c | 25 + gcc/testsuite/gcc.c-torture/compile/pr42196-1.c | 28 + gcc/testsuite/gcc.c-torture/compile/pr42196-2.c | 28 + gcc/testsuite/gcc.c-torture/compile/pr42196-3.c | 27 + gcc/testsuite/gcc.c-torture/compile/pr42234.c | 14 + gcc/testsuite/gcc.c-torture/compile/pr42237.c | 32 + gcc/testsuite/gcc.c-torture/compile/pr42299.c | 23 + gcc/testsuite/gcc.c-torture/compile/pr42347.c | 16 + gcc/testsuite/gcc.c-torture/compile/pr42398.c | 6 + gcc/testsuite/gcc.c-torture/compile/pr42559.c | 8 + gcc/testsuite/gcc.c-torture/compile/pr42632.c | 16 + gcc/testsuite/gcc.c-torture/compile/pr42703.c | 12 + gcc/testsuite/gcc.c-torture/compile/pr42705.c | 58 ++ gcc/testsuite/gcc.c-torture/compile/pr42708-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/pr42716.c | 18 + gcc/testsuite/gcc.c-torture/compile/pr42717.c | 30 + gcc/testsuite/gcc.c-torture/compile/pr42730.c | 14 + gcc/testsuite/gcc.c-torture/compile/pr42749.c | 5 + gcc/testsuite/gcc.c-torture/compile/pr42927.c | 32 + gcc/testsuite/gcc.c-torture/compile/pr42956.c | 33 + gcc/testsuite/gcc.c-torture/compile/pr42998.c | 15 + gcc/testsuite/gcc.c-torture/compile/pr43066.c | 14 + gcc/testsuite/gcc.c-torture/compile/pr43164.c | 16 + gcc/testsuite/gcc.c-torture/compile/pr43186.c | 15 + gcc/testsuite/gcc.c-torture/compile/pr43188.c | 6 + gcc/testsuite/gcc.c-torture/compile/pr43191.c | 47 ++ gcc/testsuite/gcc.c-torture/compile/pr43255.c | 33 + gcc/testsuite/gcc.c-torture/compile/pr43288.c | 1 + gcc/testsuite/gcc.c-torture/compile/pr43367.c | 30 + gcc/testsuite/gcc.c-torture/compile/pr43415.c | 36 + gcc/testsuite/gcc.c-torture/compile/pr43614.c | 27 + gcc/testsuite/gcc.c-torture/compile/pr43635.c | 7 + gcc/testsuite/gcc.c-torture/compile/pr43636.c | 10 + gcc/testsuite/gcc.c-torture/compile/pr43661.c | 5 + gcc/testsuite/gcc.c-torture/compile/pr43679.c | 33 + gcc/testsuite/gcc.c-torture/compile/pr43791.c | 21 + gcc/testsuite/gcc.c-torture/compile/pr43845.c | 12 + gcc/testsuite/gcc.c-torture/compile/pr44030.c | 28 + gcc/testsuite/gcc.c-torture/compile/pr44038.c | 13 + gcc/testsuite/gcc.c-torture/compile/pr44043.c | 87 +++ gcc/testsuite/gcc.c-torture/compile/pr44063.c | 38 + gcc/testsuite/gcc.c-torture/compile/pr44119.c | 46 ++ gcc/testsuite/gcc.c-torture/compile/pr44197.c | 33 + gcc/testsuite/gcc.c-torture/compile/pr44246.c | 5 + gcc/testsuite/gcc.c-torture/compile/pr44686.c | 7 + gcc/testsuite/gcc.c-torture/compile/pr44687.c | 32 + gcc/testsuite/gcc.c-torture/compile/pr44707.c | 14 + gcc/testsuite/gcc.c-torture/compile/pr44784.c | 47 ++ gcc/testsuite/gcc.c-torture/compile/pr44788.c | 8 + gcc/testsuite/gcc.c-torture/compile/pr44831.c | 15 + gcc/testsuite/gcc.c-torture/compile/pr44891.c | 26 + gcc/testsuite/gcc.c-torture/compile/pr44937.c | 30 + gcc/testsuite/gcc.c-torture/compile/pr44941.c | 8 + gcc/testsuite/gcc.c-torture/compile/pr44946.c | 27 + gcc/testsuite/gcc.c-torture/compile/pr44988.c | 13 + gcc/testsuite/gcc.c-torture/compile/pr45047.c | 9 + gcc/testsuite/gcc.c-torture/compile/pr45059.c | 23 + gcc/testsuite/gcc.c-torture/compile/pr45085.c | 45 ++ gcc/testsuite/gcc.c-torture/compile/pr45109.c | 38 + gcc/testsuite/gcc.c-torture/compile/pr45182.c | 10 + gcc/testsuite/gcc.c-torture/compile/pr45412.c | 22 + gcc/testsuite/gcc.c-torture/compile/pr45535.c | 38 + gcc/testsuite/gcc.c-torture/compile/pr45728.c | 17 + gcc/testsuite/gcc.c-torture/compile/pr45771.c | 7 + gcc/testsuite/gcc.c-torture/compile/pr45876.c | 9 + gcc/testsuite/gcc.c-torture/compile/pr45919.c | 9 + gcc/testsuite/gcc.c-torture/compile/pr45969-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/pr46002.c | 10 + gcc/testsuite/gcc.c-torture/compile/pr46034.c | 14 + gcc/testsuite/gcc.c-torture/compile/pr46107.c | 16 + gcc/testsuite/gcc.c-torture/compile/pr46248.c | 32 + gcc/testsuite/gcc.c-torture/compile/pr46360.c | 13 + gcc/testsuite/gcc.c-torture/compile/pr46388.c | 14 + gcc/testsuite/gcc.c-torture/compile/pr46461.c | 8 + gcc/testsuite/gcc.c-torture/compile/pr46534.c | 18 + gcc/testsuite/gcc.c-torture/compile/pr46547-1.c | 6 + gcc/testsuite/gcc.c-torture/compile/pr46637.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr46832.c | 4 + gcc/testsuite/gcc.c-torture/compile/pr46856.c | 26 + gcc/testsuite/gcc.c-torture/compile/pr46866.c | 19 + gcc/testsuite/gcc.c-torture/compile/pr46883.c | 13 + gcc/testsuite/gcc.c-torture/compile/pr47140.c | 25 + gcc/testsuite/gcc.c-torture/compile/pr47141.c | 16 + gcc/testsuite/gcc.c-torture/compile/pr47150.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr47157.c | 20 + gcc/testsuite/gcc.c-torture/compile/pr47265.c | 20 + gcc/testsuite/gcc.c-torture/compile/pr47427.c | 28 + gcc/testsuite/gcc.c-torture/compile/pr47428.c | 42 ++ gcc/testsuite/gcc.c-torture/compile/pr47967.c | 17 + gcc/testsuite/gcc.c-torture/compile/pr48161.c | 24 + gcc/testsuite/gcc.c-torture/compile/pr48335-1.c | 41 ++ gcc/testsuite/gcc.c-torture/compile/pr48517.c | 13 + gcc/testsuite/gcc.c-torture/compile/pr48734.c | 11 + gcc/testsuite/gcc.c-torture/compile/pr48742.c | 15 + gcc/testsuite/gcc.c-torture/compile/pr49029.c | 10 + gcc/testsuite/gcc.c-torture/compile/pr49049.c | 28 + gcc/testsuite/gcc.c-torture/compile/pr49238.c | 18 + gcc/testsuite/gcc.c-torture/compile/pr50565-1.c | 4 + gcc/testsuite/gcc.c-torture/compile/pr50565-2.c | 4 + gcc/testsuite/gcc.c-torture/compile/pr51077.c | 15 + gcc/testsuite/gcc.c-torture/compile/pr51767.c | 23 + gcc/testsuite/gcc.c-torture/compile/pr52074.c | 10 + gcc/testsuite/gcc.c-torture/compile/pr53418-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/pr53418-2.c | 5 + gcc/testsuite/gcc.c-torture/compile/pr54103-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/pr54103-2.c | 5 + gcc/testsuite/gcc.c-torture/compile/pr54103-3.c | 5 + gcc/testsuite/gcc.c-torture/compile/pr54103-4.c | 5 + gcc/testsuite/gcc.c-torture/compile/pr54103-5.c | 5 + gcc/testsuite/gcc.c-torture/compile/pr54103-6.c | 5 + gcc/testsuite/gcc.c-torture/compile/pr54552-1.c | 8 + gcc/testsuite/gcc.c-torture/compile/pr56539.c | 7 + gcc/testsuite/gcc.c-torture/compile/pta-1.c | 31 + gcc/testsuite/gcc.c-torture/compile/ptr-conv-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/simd-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/simd-2.c | 17 + gcc/testsuite/gcc.c-torture/compile/simd-3.c | 23 + gcc/testsuite/gcc.c-torture/compile/simd-4.c | 15 + gcc/testsuite/gcc.c-torture/compile/simd-5.c | 12 + gcc/testsuite/gcc.c-torture/compile/simd-6.c | 3 + .../gcc.c-torture/compile/sizeof-macros-1.c | 15 + gcc/testsuite/gcc.c-torture/compile/sra-1.c | 75 ++ gcc/testsuite/gcc.c-torture/compile/ssa-pre-1.c | 19 + .../gcc.c-torture/compile/statement-expression-1.c | 10 + gcc/testsuite/gcc.c-torture/compile/strcpy-1.c | 15 + gcc/testsuite/gcc.c-torture/compile/strcpy-2.c | 7 + .../gcc.c-torture/compile/struct-non-lval-1.c | 7 + .../gcc.c-torture/compile/struct-non-lval-2.c | 7 + .../gcc.c-torture/compile/struct-non-lval-3.c | 7 + gcc/testsuite/gcc.c-torture/compile/structs.c | 263 +++++++ gcc/testsuite/gcc.c-torture/compile/switch-1.c | 9 + gcc/testsuite/gcc.c-torture/compile/sync-1.c | 279 ++++++++ gcc/testsuite/gcc.c-torture/compile/sync-2.c | 168 +++++ gcc/testsuite/gcc.c-torture/compile/sync-3.c | 187 +++++ gcc/testsuite/gcc.c-torture/compile/trunctfdf.c | 14 + gcc/testsuite/gcc.c-torture/compile/vector-1.c | 12 + gcc/testsuite/gcc.c-torture/compile/vector-2.c | 13 + gcc/testsuite/gcc.c-torture/compile/vector-3.c | 7 + gcc/testsuite/gcc.c-torture/compile/vector-4.c | 13 + .../gcc.c-torture/compile/vector-align-1.c | 11 + gcc/testsuite/gcc.c-torture/compile/vla-const-1.c | 5 + gcc/testsuite/gcc.c-torture/compile/vla-const-2.c | 4 + gcc/testsuite/gcc.c-torture/compile/volatile-1.c | 18 + gcc/testsuite/gcc.c-torture/compile/widechar-1.c | 1 + gcc/testsuite/gcc.c-torture/compile/zero-strct-1.c | 7 + gcc/testsuite/gcc.c-torture/compile/zero-strct-2.c | 2 + gcc/testsuite/gcc.c-torture/compile/zero-strct-3.c | 12 + gcc/testsuite/gcc.c-torture/compile/zero-strct-4.c | 14 + gcc/testsuite/gcc.c-torture/compile/zero-strct-5.c | 14 + gcc/testsuite/gcc.c-torture/execute/20000112-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/20000113-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/20000121-1.c | 14 + gcc/testsuite/gcc.c-torture/execute/20000205-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/20000217-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/20000223-1.c | 61 ++ gcc/testsuite/gcc.c-torture/execute/20000224-1.c | 28 + gcc/testsuite/gcc.c-torture/execute/20000225-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/20000227-1.c | 15 + gcc/testsuite/gcc.c-torture/execute/20000313-1.c | 20 + gcc/testsuite/gcc.c-torture/execute/20000314-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/20000314-2.c | 23 + gcc/testsuite/gcc.c-torture/execute/20000314-3.c | 42 ++ gcc/testsuite/gcc.c-torture/execute/20000402-1.c | 33 + gcc/testsuite/gcc.c-torture/execute/20000403-1.c | 29 + gcc/testsuite/gcc.c-torture/execute/20000412-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/20000412-2.c | 16 + gcc/testsuite/gcc.c-torture/execute/20000412-3.c | 32 + gcc/testsuite/gcc.c-torture/execute/20000412-4.c | 26 + gcc/testsuite/gcc.c-torture/execute/20000412-5.c | 11 + gcc/testsuite/gcc.c-torture/execute/20000412-6.c | 22 + gcc/testsuite/gcc.c-torture/execute/20000419-1.c | 22 + gcc/testsuite/gcc.c-torture/execute/20000422-1.c | 39 ++ gcc/testsuite/gcc.c-torture/execute/20000503-1.c | 13 + gcc/testsuite/gcc.c-torture/execute/20000511-1.c | 33 + gcc/testsuite/gcc.c-torture/execute/20000519-1.c | 30 + gcc/testsuite/gcc.c-torture/execute/20000519-2.c | 12 + gcc/testsuite/gcc.c-torture/execute/20000523-1.c | 22 + gcc/testsuite/gcc.c-torture/execute/20000528-1.c | 13 + gcc/testsuite/gcc.c-torture/execute/20000603-1.c | 22 + gcc/testsuite/gcc.c-torture/execute/20000605-1.c | 48 ++ gcc/testsuite/gcc.c-torture/execute/20000605-2.c | 18 + gcc/testsuite/gcc.c-torture/execute/20000605-3.c | 18 + gcc/testsuite/gcc.c-torture/execute/20000622-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/20000703-1.c | 39 ++ gcc/testsuite/gcc.c-torture/execute/20000706-1.c | 31 + gcc/testsuite/gcc.c-torture/execute/20000706-2.c | 31 + gcc/testsuite/gcc.c-torture/execute/20000706-3.c | 27 + gcc/testsuite/gcc.c-torture/execute/20000706-4.c | 22 + gcc/testsuite/gcc.c-torture/execute/20000706-5.c | 28 + gcc/testsuite/gcc.c-torture/execute/20000707-1.c | 27 + gcc/testsuite/gcc.c-torture/execute/20000715-1.c | 118 ++++ gcc/testsuite/gcc.c-torture/execute/20000715-2.c | 14 + gcc/testsuite/gcc.c-torture/execute/20000717-1.c | 22 + gcc/testsuite/gcc.c-torture/execute/20000717-2.c | 11 + gcc/testsuite/gcc.c-torture/execute/20000717-3.c | 26 + gcc/testsuite/gcc.c-torture/execute/20000717-4.c | 26 + gcc/testsuite/gcc.c-torture/execute/20000717-5.c | 23 + gcc/testsuite/gcc.c-torture/execute/20000722-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/20000726-1.c | 31 + gcc/testsuite/gcc.c-torture/execute/20000731-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/20000731-2.c | 16 + gcc/testsuite/gcc.c-torture/execute/20000801-1.c | 39 ++ gcc/testsuite/gcc.c-torture/execute/20000801-2.c | 40 ++ gcc/testsuite/gcc.c-torture/execute/20000801-3.c | 24 + gcc/testsuite/gcc.c-torture/execute/20000801-4.c | 30 + gcc/testsuite/gcc.c-torture/execute/20000808-1.c | 56 ++ gcc/testsuite/gcc.c-torture/execute/20000815-1.c | 70 ++ gcc/testsuite/gcc.c-torture/execute/20000818-1.c | 60 ++ gcc/testsuite/gcc.c-torture/execute/20000819-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/20000822-1.c | 28 + gcc/testsuite/gcc.c-torture/execute/20000910-1.c | 27 + gcc/testsuite/gcc.c-torture/execute/20000910-2.c | 28 + gcc/testsuite/gcc.c-torture/execute/20000914-1.c | 292 ++++++++ gcc/testsuite/gcc.c-torture/execute/20000917-1.c | 42 ++ gcc/testsuite/gcc.c-torture/execute/20001009-1.c | 12 + gcc/testsuite/gcc.c-torture/execute/20001009-2.c | 21 + gcc/testsuite/gcc.c-torture/execute/20001011-1.c | 14 + gcc/testsuite/gcc.c-torture/execute/20001013-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/20001017-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/20001017-2.c | 17 + gcc/testsuite/gcc.c-torture/execute/20001024-1.c | 34 + gcc/testsuite/gcc.c-torture/execute/20001026-1.c | 44 ++ gcc/testsuite/gcc.c-torture/execute/20001027-1.c | 11 + gcc/testsuite/gcc.c-torture/execute/20001031-1.c | 37 + gcc/testsuite/gcc.c-torture/execute/20001101.c | 40 ++ gcc/testsuite/gcc.c-torture/execute/20001108-1.c | 25 + gcc/testsuite/gcc.c-torture/execute/20001111-1.c | 41 ++ gcc/testsuite/gcc.c-torture/execute/20001112-1.c | 10 + gcc/testsuite/gcc.c-torture/execute/20001121-1.c | 19 + gcc/testsuite/gcc.c-torture/execute/20001124-1.c | 76 ++ gcc/testsuite/gcc.c-torture/execute/20001130-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/20001130-2.c | 31 + gcc/testsuite/gcc.c-torture/execute/20001203-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/20001203-2.c | 123 ++++ gcc/testsuite/gcc.c-torture/execute/20001221-1.c | 7 + gcc/testsuite/gcc.c-torture/execute/20001228-1.c | 28 + gcc/testsuite/gcc.c-torture/execute/20001229-1.c | 49 ++ gcc/testsuite/gcc.c-torture/execute/20010106-1.c | 30 + gcc/testsuite/gcc.c-torture/execute/20010114-1.c | 15 + gcc/testsuite/gcc.c-torture/execute/20010116-1.c | 32 + gcc/testsuite/gcc.c-torture/execute/20010118-1.c | 37 + gcc/testsuite/gcc.c-torture/execute/20010119-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/20010122-1.c | 202 ++++++ gcc/testsuite/gcc.c-torture/execute/20010122-1.x | 11 + gcc/testsuite/gcc.c-torture/execute/20010123-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/20010129-1.c | 64 ++ gcc/testsuite/gcc.c-torture/execute/20010129-1.x | 13 + gcc/testsuite/gcc.c-torture/execute/20010206-1.c | 16 + gcc/testsuite/gcc.c-torture/execute/20010209-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/20010221-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/20010222-1.c | 9 + gcc/testsuite/gcc.c-torture/execute/20010224-1.c | 44 ++ gcc/testsuite/gcc.c-torture/execute/20010325-1.c | 15 + gcc/testsuite/gcc.c-torture/execute/20010329-1.c | 14 + gcc/testsuite/gcc.c-torture/execute/20010403-1.c | 36 + gcc/testsuite/gcc.c-torture/execute/20010409-1.c | 43 ++ gcc/testsuite/gcc.c-torture/execute/20010422-1.c | 15 + gcc/testsuite/gcc.c-torture/execute/20010518-1.c | 28 + gcc/testsuite/gcc.c-torture/execute/20010518-2.c | 38 + gcc/testsuite/gcc.c-torture/execute/20010520-1.c | 12 + gcc/testsuite/gcc.c-torture/execute/20010604-1.c | 14 + gcc/testsuite/gcc.c-torture/execute/20010605-1.c | 11 + gcc/testsuite/gcc.c-torture/execute/20010605-2.c | 36 + gcc/testsuite/gcc.c-torture/execute/20010711-1.c | 13 + gcc/testsuite/gcc.c-torture/execute/20010717-1.c | 22 + gcc/testsuite/gcc.c-torture/execute/20010723-1.c | 16 + gcc/testsuite/gcc.c-torture/execute/20010724-1.c | 59 ++ gcc/testsuite/gcc.c-torture/execute/20010724-1.x | 3 + gcc/testsuite/gcc.c-torture/execute/20010904-1.c | 11 + gcc/testsuite/gcc.c-torture/execute/20010904-2.c | 11 + gcc/testsuite/gcc.c-torture/execute/20010910-1.c | 59 ++ gcc/testsuite/gcc.c-torture/execute/20010915-1.c | 71 ++ gcc/testsuite/gcc.c-torture/execute/20010924-1.c | 71 ++ gcc/testsuite/gcc.c-torture/execute/20010925-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/20011008-3.c | 105 +++ gcc/testsuite/gcc.c-torture/execute/20011019-1.c | 18 + gcc/testsuite/gcc.c-torture/execute/20011024-1.c | 22 + gcc/testsuite/gcc.c-torture/execute/20011109-1.c | 58 ++ gcc/testsuite/gcc.c-torture/execute/20011109-2.c | 10 + gcc/testsuite/gcc.c-torture/execute/20011113-1.c | 55 ++ gcc/testsuite/gcc.c-torture/execute/20011114-1.c | 11 + gcc/testsuite/gcc.c-torture/execute/20011115-1.c | 26 + gcc/testsuite/gcc.c-torture/execute/20011121-1.c | 19 + gcc/testsuite/gcc.c-torture/execute/20011126-1.c | 19 + gcc/testsuite/gcc.c-torture/execute/20011126-2.c | 43 ++ gcc/testsuite/gcc.c-torture/execute/20011128-1.c | 5 + gcc/testsuite/gcc.c-torture/execute/20011217-1.c | 12 + gcc/testsuite/gcc.c-torture/execute/20011219-1.c | 49 ++ gcc/testsuite/gcc.c-torture/execute/20011223-1.c | 22 + gcc/testsuite/gcc.c-torture/execute/20020103-1.c | 28 + gcc/testsuite/gcc.c-torture/execute/20020107-1.c | 28 + gcc/testsuite/gcc.c-torture/execute/20020108-1.c | 203 ++++++ gcc/testsuite/gcc.c-torture/execute/20020118-1.c | 33 + gcc/testsuite/gcc.c-torture/execute/20020127-1.c | 22 + gcc/testsuite/gcc.c-torture/execute/20020129-1.c | 51 ++ gcc/testsuite/gcc.c-torture/execute/20020201-1.c | 37 + gcc/testsuite/gcc.c-torture/execute/20020206-1.c | 26 + gcc/testsuite/gcc.c-torture/execute/20020206-2.c | 24 + gcc/testsuite/gcc.c-torture/execute/20020213-1.c | 34 + gcc/testsuite/gcc.c-torture/execute/20020215-1.c | 33 + gcc/testsuite/gcc.c-torture/execute/20020216-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/20020219-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/20020225-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/20020225-2.c | 19 + gcc/testsuite/gcc.c-torture/execute/20020226-1.c | 104 +++ gcc/testsuite/gcc.c-torture/execute/20020227-1.c | 30 + gcc/testsuite/gcc.c-torture/execute/20020307-1.c | 69 ++ gcc/testsuite/gcc.c-torture/execute/20020314-1.c | 36 + gcc/testsuite/gcc.c-torture/execute/20020320-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/20020321-1.c | 20 + gcc/testsuite/gcc.c-torture/execute/20020328-1.c | 25 + gcc/testsuite/gcc.c-torture/execute/20020402-1.c | 41 ++ gcc/testsuite/gcc.c-torture/execute/20020402-2.c | 230 ++++++ gcc/testsuite/gcc.c-torture/execute/20020402-3.c | 81 +++ gcc/testsuite/gcc.c-torture/execute/20020404-1.c | 102 +++ gcc/testsuite/gcc.c-torture/execute/20020404-1.x | 15 + gcc/testsuite/gcc.c-torture/execute/20020406-1.c | 126 ++++ gcc/testsuite/gcc.c-torture/execute/20020411-1.c | 25 + gcc/testsuite/gcc.c-torture/execute/20020412-1.c | 56 ++ gcc/testsuite/gcc.c-torture/execute/20020413-1.c | 36 + gcc/testsuite/gcc.c-torture/execute/20020418-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/20020423-1.c | 33 + gcc/testsuite/gcc.c-torture/execute/20020503-1.c | 31 + gcc/testsuite/gcc.c-torture/execute/20020506-1.c | 333 +++++++++ gcc/testsuite/gcc.c-torture/execute/20020508-1.c | 104 +++ gcc/testsuite/gcc.c-torture/execute/20020508-2.c | 102 +++ gcc/testsuite/gcc.c-torture/execute/20020508-3.c | 102 +++ gcc/testsuite/gcc.c-torture/execute/20020510-1.c | 85 +++ gcc/testsuite/gcc.c-torture/execute/20020529-1.c | 78 +++ gcc/testsuite/gcc.c-torture/execute/20020611-1.c | 32 + gcc/testsuite/gcc.c-torture/execute/20020614-1.c | 41 ++ gcc/testsuite/gcc.c-torture/execute/20020615-1.c | 59 ++ gcc/testsuite/gcc.c-torture/execute/20020619-1.c | 31 + gcc/testsuite/gcc.c-torture/execute/20020716-1.c | 36 + gcc/testsuite/gcc.c-torture/execute/20020720-1.c | 36 + gcc/testsuite/gcc.c-torture/execute/20020805-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/20020810-1.c | 38 + gcc/testsuite/gcc.c-torture/execute/20020819-1.c | 22 + gcc/testsuite/gcc.c-torture/execute/20020904-1.c | 19 + gcc/testsuite/gcc.c-torture/execute/20020911-1.c | 8 + gcc/testsuite/gcc.c-torture/execute/20020916-1.c | 19 + gcc/testsuite/gcc.c-torture/execute/20020920-1.c | 31 + gcc/testsuite/gcc.c-torture/execute/20021010-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/20021010-2.c | 37 + gcc/testsuite/gcc.c-torture/execute/20021011-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/20021015-1.c | 30 + gcc/testsuite/gcc.c-torture/execute/20021024-1.c | 43 ++ gcc/testsuite/gcc.c-torture/execute/20021024-1.x | 7 + gcc/testsuite/gcc.c-torture/execute/20021111-1.c | 31 + gcc/testsuite/gcc.c-torture/execute/20021113-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/20021118-1.c | 15 + gcc/testsuite/gcc.c-torture/execute/20021118-2.c | 50 ++ gcc/testsuite/gcc.c-torture/execute/20021118-3.c | 18 + gcc/testsuite/gcc.c-torture/execute/20021119-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/20021120-1.c | 58 ++ gcc/testsuite/gcc.c-torture/execute/20021120-2.c | 21 + gcc/testsuite/gcc.c-torture/execute/20021120-3.c | 26 + gcc/testsuite/gcc.c-torture/execute/20021127-1.c | 14 + gcc/testsuite/gcc.c-torture/execute/20021127-1.x | 2 + gcc/testsuite/gcc.c-torture/execute/20021204-1.c | 25 + gcc/testsuite/gcc.c-torture/execute/20021219-1.c | 18 + gcc/testsuite/gcc.c-torture/execute/20030105-1.c | 20 + gcc/testsuite/gcc.c-torture/execute/20030109-1.c | 20 + gcc/testsuite/gcc.c-torture/execute/20030117-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/20030120-1.c | 50 ++ gcc/testsuite/gcc.c-torture/execute/20030120-2.c | 19 + gcc/testsuite/gcc.c-torture/execute/20030125-1.c | 54 ++ gcc/testsuite/gcc.c-torture/execute/20030125-1.x | 4 + gcc/testsuite/gcc.c-torture/execute/20030128-1.c | 10 + gcc/testsuite/gcc.c-torture/execute/20030203-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/20030209-1.c | 25 + gcc/testsuite/gcc.c-torture/execute/20030216-1.c | 10 + gcc/testsuite/gcc.c-torture/execute/20030216-1.x | 12 + gcc/testsuite/gcc.c-torture/execute/20030218-1.c | 25 + gcc/testsuite/gcc.c-torture/execute/20030221-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/20030222-1.c | 27 + gcc/testsuite/gcc.c-torture/execute/20030222-1.x | 6 + gcc/testsuite/gcc.c-torture/execute/20030224-2.c | 28 + gcc/testsuite/gcc.c-torture/execute/20030307-1.c | 26 + gcc/testsuite/gcc.c-torture/execute/20030313-1.c | 68 ++ gcc/testsuite/gcc.c-torture/execute/20030316-1.c | 12 + gcc/testsuite/gcc.c-torture/execute/20030323-1.c | 114 +++ gcc/testsuite/gcc.c-torture/execute/20030330-1.c | 14 + gcc/testsuite/gcc.c-torture/execute/20030401-1.c | 27 + gcc/testsuite/gcc.c-torture/execute/20030403-1.c | 16 + gcc/testsuite/gcc.c-torture/execute/20030404-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/20030408-1.c | 69 ++ gcc/testsuite/gcc.c-torture/execute/20030501-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/20030606-1.c | 27 + gcc/testsuite/gcc.c-torture/execute/20030613-1.c | 62 ++ gcc/testsuite/gcc.c-torture/execute/20030626-1.c | 13 + gcc/testsuite/gcc.c-torture/execute/20030626-2.c | 14 + gcc/testsuite/gcc.c-torture/execute/20030714-1.c | 193 +++++ gcc/testsuite/gcc.c-torture/execute/20030715-1.c | 35 + gcc/testsuite/gcc.c-torture/execute/20030717-1.c | 69 ++ gcc/testsuite/gcc.c-torture/execute/20030718-1.c | 13 + gcc/testsuite/gcc.c-torture/execute/20030811-1.c | 35 + gcc/testsuite/gcc.c-torture/execute/20030821-1.c | 16 + gcc/testsuite/gcc.c-torture/execute/20030828-1.c | 18 + gcc/testsuite/gcc.c-torture/execute/20030828-2.c | 28 + gcc/testsuite/gcc.c-torture/execute/20030903-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/20030909-1.c | 35 + gcc/testsuite/gcc.c-torture/execute/20030910-1.c | 13 + gcc/testsuite/gcc.c-torture/execute/20030913-1.c | 26 + gcc/testsuite/gcc.c-torture/execute/20030914-1.c | 26 + gcc/testsuite/gcc.c-torture/execute/20030914-2.c | 21 + gcc/testsuite/gcc.c-torture/execute/20030916-1.c | 35 + gcc/testsuite/gcc.c-torture/execute/20030920-1.c | 15 + gcc/testsuite/gcc.c-torture/execute/20030928-1.c | 32 + gcc/testsuite/gcc.c-torture/execute/20031003-1.c | 33 + gcc/testsuite/gcc.c-torture/execute/20031010-1.c | 34 + gcc/testsuite/gcc.c-torture/execute/20031011-1.c | 31 + gcc/testsuite/gcc.c-torture/execute/20031012-1.c | 32 + gcc/testsuite/gcc.c-torture/execute/20031020-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/20031201-1.c | 76 ++ gcc/testsuite/gcc.c-torture/execute/20031204-1.c | 49 ++ gcc/testsuite/gcc.c-torture/execute/20031211-1.c | 13 + gcc/testsuite/gcc.c-torture/execute/20031211-2.c | 19 + gcc/testsuite/gcc.c-torture/execute/20031214-1.c | 32 + gcc/testsuite/gcc.c-torture/execute/20031215-1.c | 38 + gcc/testsuite/gcc.c-torture/execute/20031216-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/20040208-1.c | 10 + gcc/testsuite/gcc.c-torture/execute/20040208-2.c | 11 + gcc/testsuite/gcc.c-torture/execute/20040208-2.x | 1 + gcc/testsuite/gcc.c-torture/execute/20040218-1.c | 37 + gcc/testsuite/gcc.c-torture/execute/20040223-1.c | 16 + gcc/testsuite/gcc.c-torture/execute/20040302-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/20040307-1.c | 25 + gcc/testsuite/gcc.c-torture/execute/20040308-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/20040309-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/20040311-1.c | 68 ++ gcc/testsuite/gcc.c-torture/execute/20040313-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/20040319-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/20040331-1.c | 20 + gcc/testsuite/gcc.c-torture/execute/20040409-1.c | 142 ++++ gcc/testsuite/gcc.c-torture/execute/20040409-2.c | 243 +++++++ gcc/testsuite/gcc.c-torture/execute/20040409-3.c | 142 ++++ gcc/testsuite/gcc.c-torture/execute/20040411-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/20040423-1.c | 30 + gcc/testsuite/gcc.c-torture/execute/20040520-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/20040625-1.c | 20 + gcc/testsuite/gcc.c-torture/execute/20040629-1.c | 139 ++++ gcc/testsuite/gcc.c-torture/execute/20040629-1.x | 7 + gcc/testsuite/gcc.c-torture/execute/20040703-1.c | 147 ++++ gcc/testsuite/gcc.c-torture/execute/20040703-1.x | 7 + gcc/testsuite/gcc.c-torture/execute/20040704-1.c | 14 + gcc/testsuite/gcc.c-torture/execute/20040705-1.c | 2 + gcc/testsuite/gcc.c-torture/execute/20040705-1.x | 7 + gcc/testsuite/gcc.c-torture/execute/20040705-2.c | 2 + gcc/testsuite/gcc.c-torture/execute/20040705-2.x | 7 + gcc/testsuite/gcc.c-torture/execute/20040706-1.c | 9 + gcc/testsuite/gcc.c-torture/execute/20040707-1.c | 12 + gcc/testsuite/gcc.c-torture/execute/20040709-1.c | 147 ++++ gcc/testsuite/gcc.c-torture/execute/20040709-1.x | 7 + gcc/testsuite/gcc.c-torture/execute/20040709-2.c | 148 ++++ gcc/testsuite/gcc.c-torture/execute/20040709-2.x | 7 + gcc/testsuite/gcc.c-torture/execute/20040805-1.c | 31 + gcc/testsuite/gcc.c-torture/execute/20040811-1.c | 19 + gcc/testsuite/gcc.c-torture/execute/20040811-1.x | 7 + gcc/testsuite/gcc.c-torture/execute/20040820-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/20040823-1.c | 29 + gcc/testsuite/gcc.c-torture/execute/20040831-1.c | 14 + gcc/testsuite/gcc.c-torture/execute/20040917-1.c | 32 + gcc/testsuite/gcc.c-torture/execute/20041011-1.c | 60 ++ gcc/testsuite/gcc.c-torture/execute/20041019-1.c | 52 ++ gcc/testsuite/gcc.c-torture/execute/20041112-1.c | 40 ++ gcc/testsuite/gcc.c-torture/execute/20041113-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/20041114-1.c | 35 + gcc/testsuite/gcc.c-torture/execute/20041124-1.c | 10 + gcc/testsuite/gcc.c-torture/execute/20041126-1.c | 26 + gcc/testsuite/gcc.c-torture/execute/20041201-1.c | 15 + gcc/testsuite/gcc.c-torture/execute/20041210-1.c | 14 + gcc/testsuite/gcc.c-torture/execute/20041212-1.c | 15 + gcc/testsuite/gcc.c-torture/execute/20041213-2.c | 32 + gcc/testsuite/gcc.c-torture/execute/20041214-1.c | 68 ++ gcc/testsuite/gcc.c-torture/execute/20041218-1.c | 117 ++++ gcc/testsuite/gcc.c-torture/execute/20041218-2.c | 15 + gcc/testsuite/gcc.c-torture/execute/20050104-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/20050106-1.c | 19 + gcc/testsuite/gcc.c-torture/execute/20050107-1.c | 25 + gcc/testsuite/gcc.c-torture/execute/20050111-1.c | 39 ++ gcc/testsuite/gcc.c-torture/execute/20050119-1.c | 37 + gcc/testsuite/gcc.c-torture/execute/20050119-2.c | 40 ++ gcc/testsuite/gcc.c-torture/execute/20050121-1.c | 63 ++ gcc/testsuite/gcc.c-torture/execute/20050124-1.c | 41 ++ gcc/testsuite/gcc.c-torture/execute/20050125-1.c | 35 + gcc/testsuite/gcc.c-torture/execute/20050131-1.c | 18 + gcc/testsuite/gcc.c-torture/execute/20050203-1.c | 29 + gcc/testsuite/gcc.c-torture/execute/20050215-1.c | 25 + gcc/testsuite/gcc.c-torture/execute/20050218-1.c | 30 + gcc/testsuite/gcc.c-torture/execute/20050224-1.c | 33 + gcc/testsuite/gcc.c-torture/execute/20050316-1.c | 69 ++ gcc/testsuite/gcc.c-torture/execute/20050316-1.x | 7 + gcc/testsuite/gcc.c-torture/execute/20050316-2.c | 49 ++ gcc/testsuite/gcc.c-torture/execute/20050316-2.x | 9 + gcc/testsuite/gcc.c-torture/execute/20050316-3.c | 36 + gcc/testsuite/gcc.c-torture/execute/20050410-1.c | 13 + gcc/testsuite/gcc.c-torture/execute/20050502-1.c | 67 ++ gcc/testsuite/gcc.c-torture/execute/20050502-2.c | 34 + gcc/testsuite/gcc.c-torture/execute/20050604-1.c | 39 ++ gcc/testsuite/gcc.c-torture/execute/20050604-1.x | 9 + gcc/testsuite/gcc.c-torture/execute/20050607-1.c | 16 + gcc/testsuite/gcc.c-torture/execute/20050613-1.c | 27 + gcc/testsuite/gcc.c-torture/execute/20050713-1.c | 56 ++ gcc/testsuite/gcc.c-torture/execute/20050826-1.c | 44 ++ gcc/testsuite/gcc.c-torture/execute/20050826-2.c | 62 ++ gcc/testsuite/gcc.c-torture/execute/20050929-1.c | 20 + gcc/testsuite/gcc.c-torture/execute/20051012-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/20051021-1.c | 28 + gcc/testsuite/gcc.c-torture/execute/20051104-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/20051110-1.c | 31 + gcc/testsuite/gcc.c-torture/execute/20051110-2.c | 39 ++ gcc/testsuite/gcc.c-torture/execute/20051113-1.c | 71 ++ gcc/testsuite/gcc.c-torture/execute/20051215-1.c | 28 + gcc/testsuite/gcc.c-torture/execute/20060102-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/20060110-1.c | 16 + gcc/testsuite/gcc.c-torture/execute/20060110-2.c | 19 + gcc/testsuite/gcc.c-torture/execute/20060127-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/20060412-1.c | 33 + gcc/testsuite/gcc.c-torture/execute/20060420-1.c | 73 ++ gcc/testsuite/gcc.c-torture/execute/20060905-1.c | 35 + gcc/testsuite/gcc.c-torture/execute/20060910-1.c | 37 + gcc/testsuite/gcc.c-torture/execute/20060929-1.c | 44 ++ gcc/testsuite/gcc.c-torture/execute/20060930-1.c | 42 ++ gcc/testsuite/gcc.c-torture/execute/20060930-2.c | 31 + gcc/testsuite/gcc.c-torture/execute/20061031-1.c | 28 + gcc/testsuite/gcc.c-torture/execute/20061101-1.c | 32 + gcc/testsuite/gcc.c-torture/execute/20061101-1.x | 7 + gcc/testsuite/gcc.c-torture/execute/20061101-2.c | 32 + gcc/testsuite/gcc.c-torture/execute/20061220-1.c | 72 ++ gcc/testsuite/gcc.c-torture/execute/20070201-1.c | 20 + gcc/testsuite/gcc.c-torture/execute/20070212-1.c | 26 + gcc/testsuite/gcc.c-torture/execute/20070212-2.c | 19 + gcc/testsuite/gcc.c-torture/execute/20070212-3.c | 30 + gcc/testsuite/gcc.c-torture/execute/20070424-1.c | 27 + gcc/testsuite/gcc.c-torture/execute/20070517-1.c | 41 ++ gcc/testsuite/gcc.c-torture/execute/20070614-1.c | 33 + gcc/testsuite/gcc.c-torture/execute/20070623-1.c | 41 ++ gcc/testsuite/gcc.c-torture/execute/20070724-1.c | 11 + gcc/testsuite/gcc.c-torture/execute/20070824-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/20070919-1.c | 41 ++ gcc/testsuite/gcc.c-torture/execute/20071011-1.c | 19 + gcc/testsuite/gcc.c-torture/execute/20071018-1.c | 31 + gcc/testsuite/gcc.c-torture/execute/20071029-1.c | 56 ++ gcc/testsuite/gcc.c-torture/execute/20071030-1.c | 79 +++ gcc/testsuite/gcc.c-torture/execute/20071108-1.c | 53 ++ gcc/testsuite/gcc.c-torture/execute/20071120-1.c | 81 +++ gcc/testsuite/gcc.c-torture/execute/20071202-1.c | 25 + gcc/testsuite/gcc.c-torture/execute/20071205-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/20071210-1.c | 67 ++ gcc/testsuite/gcc.c-torture/execute/20071211-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/20071213-1.c | 53 ++ gcc/testsuite/gcc.c-torture/execute/20071216-1.c | 38 + gcc/testsuite/gcc.c-torture/execute/20071219-1.c | 71 ++ gcc/testsuite/gcc.c-torture/execute/20071220-1.c | 40 ++ gcc/testsuite/gcc.c-torture/execute/20071220-2.c | 39 ++ gcc/testsuite/gcc.c-torture/execute/20080117-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/20080122-1.c | 35 + gcc/testsuite/gcc.c-torture/execute/20080222-1.c | 22 + gcc/testsuite/gcc.c-torture/execute/20080408-1.c | 11 + gcc/testsuite/gcc.c-torture/execute/20080424-1.c | 31 + gcc/testsuite/gcc.c-torture/execute/20080502-1.c | 16 + gcc/testsuite/gcc.c-torture/execute/20080506-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/20080506-2.c | 21 + gcc/testsuite/gcc.c-torture/execute/20080519-1.c | 58 ++ gcc/testsuite/gcc.c-torture/execute/20080522-1.c | 43 ++ gcc/testsuite/gcc.c-torture/execute/20080529-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/20080604-1.c | 32 + gcc/testsuite/gcc.c-torture/execute/20080719-1.c | 65 ++ gcc/testsuite/gcc.c-torture/execute/20080813-1.c | 30 + gcc/testsuite/gcc.c-torture/execute/20081103-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/20081112-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/20081117-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/20081117-1.x | 7 + gcc/testsuite/gcc.c-torture/execute/20081218-1.c | 39 ++ gcc/testsuite/gcc.c-torture/execute/20090113-1.c | 61 ++ gcc/testsuite/gcc.c-torture/execute/20090113-2.c | 160 +++++ gcc/testsuite/gcc.c-torture/execute/20090113-3.c | 138 ++++ gcc/testsuite/gcc.c-torture/execute/20090207-1.c | 16 + gcc/testsuite/gcc.c-torture/execute/20090219-1.c | 29 + gcc/testsuite/gcc.c-torture/execute/20090527-1.c | 38 + gcc/testsuite/gcc.c-torture/execute/20090623-1.c | 18 + gcc/testsuite/gcc.c-torture/execute/20090711-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/20090814-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/20091229-1.c | 2 + gcc/testsuite/gcc.c-torture/execute/20100209-1.c | 12 + gcc/testsuite/gcc.c-torture/execute/20100316-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/20100416-1.c | 40 ++ gcc/testsuite/gcc.c-torture/execute/20100430-1.c | 51 ++ gcc/testsuite/gcc.c-torture/execute/20100708-1.c | 29 + gcc/testsuite/gcc.c-torture/execute/20100805-1.c | 15 + gcc/testsuite/gcc.c-torture/execute/20100827-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/20101011-1.c | 58 ++ gcc/testsuite/gcc.c-torture/execute/20101011-1.x | 2 + gcc/testsuite/gcc.c-torture/execute/20101013-1.c | 36 + gcc/testsuite/gcc.c-torture/execute/20101025-1.c | 30 + gcc/testsuite/gcc.c-torture/execute/20111208-1.c | 94 +++ gcc/testsuite/gcc.c-torture/execute/20111212-1.c | 34 + gcc/testsuite/gcc.c-torture/execute/20120105-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/20120111-1.c | 18 + gcc/testsuite/gcc.c-torture/execute/20120207-1.c | 27 + gcc/testsuite/gcc.c-torture/execute/20120427-1.c | 36 + gcc/testsuite/gcc.c-torture/execute/900409-1.c | 20 + gcc/testsuite/gcc.c-torture/execute/920202-1.c | 18 + gcc/testsuite/gcc.c-torture/execute/920302-1.c | 42 ++ gcc/testsuite/gcc.c-torture/execute/920409-1.c | 1 + gcc/testsuite/gcc.c-torture/execute/920410-1.c | 6 + gcc/testsuite/gcc.c-torture/execute/920411-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/920415-1.c | 5 + gcc/testsuite/gcc.c-torture/execute/920428-1.c | 2 + gcc/testsuite/gcc.c-torture/execute/920428-2.c | 7 + gcc/testsuite/gcc.c-torture/execute/920429-1.c | 3 + gcc/testsuite/gcc.c-torture/execute/920501-1.c | 3 + gcc/testsuite/gcc.c-torture/execute/920501-2.c | 114 +++ gcc/testsuite/gcc.c-torture/execute/920501-3.c | 35 + gcc/testsuite/gcc.c-torture/execute/920501-4.c | 27 + gcc/testsuite/gcc.c-torture/execute/920501-5.c | 19 + gcc/testsuite/gcc.c-torture/execute/920501-6.c | 91 +++ gcc/testsuite/gcc.c-torture/execute/920501-7.c | 30 + gcc/testsuite/gcc.c-torture/execute/920501-8.c | 38 + gcc/testsuite/gcc.c-torture/execute/920501-8.x | 5 + gcc/testsuite/gcc.c-torture/execute/920501-9.c | 27 + gcc/testsuite/gcc.c-torture/execute/920506-1.c | 2 + gcc/testsuite/gcc.c-torture/execute/920520-1.c | 36 + gcc/testsuite/gcc.c-torture/execute/920603-1.c | 2 + gcc/testsuite/gcc.c-torture/execute/920604-1.c | 13 + gcc/testsuite/gcc.c-torture/execute/920612-1.c | 2 + gcc/testsuite/gcc.c-torture/execute/920612-2.c | 15 + gcc/testsuite/gcc.c-torture/execute/920618-1.c | 1 + gcc/testsuite/gcc.c-torture/execute/920625-1.c | 38 + gcc/testsuite/gcc.c-torture/execute/920710-1.c | 11 + gcc/testsuite/gcc.c-torture/execute/920710-1.x | 6 + gcc/testsuite/gcc.c-torture/execute/920711-1.c | 2 + gcc/testsuite/gcc.c-torture/execute/920721-1.c | 2 + gcc/testsuite/gcc.c-torture/execute/920721-2.c | 2 + gcc/testsuite/gcc.c-torture/execute/920721-3.c | 26 + gcc/testsuite/gcc.c-torture/execute/920721-4.c | 60 ++ gcc/testsuite/gcc.c-torture/execute/920726-1.c | 63 ++ gcc/testsuite/gcc.c-torture/execute/920728-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/920730-1.c | 32 + gcc/testsuite/gcc.c-torture/execute/920731-1.c | 2 + gcc/testsuite/gcc.c-torture/execute/920810-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/920812-1.c | 3 + gcc/testsuite/gcc.c-torture/execute/920829-1.c | 2 + gcc/testsuite/gcc.c-torture/execute/920908-1.c | 28 + gcc/testsuite/gcc.c-torture/execute/920908-2.c | 33 + gcc/testsuite/gcc.c-torture/execute/920909-1.c | 2 + gcc/testsuite/gcc.c-torture/execute/920922-1.c | 14 + gcc/testsuite/gcc.c-torture/execute/920929-1.c | 13 + gcc/testsuite/gcc.c-torture/execute/921006-1.c | 6 + gcc/testsuite/gcc.c-torture/execute/921007-1.c | 7 + gcc/testsuite/gcc.c-torture/execute/921013-1.c | 20 + gcc/testsuite/gcc.c-torture/execute/921016-1.c | 10 + gcc/testsuite/gcc.c-torture/execute/921017-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/921019-1.c | 8 + gcc/testsuite/gcc.c-torture/execute/921019-2.c | 8 + gcc/testsuite/gcc.c-torture/execute/921029-1.c | 42 ++ gcc/testsuite/gcc.c-torture/execute/921104-1.c | 8 + gcc/testsuite/gcc.c-torture/execute/921110-1.c | 7 + gcc/testsuite/gcc.c-torture/execute/921112-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/921113-1.c | 63 ++ gcc/testsuite/gcc.c-torture/execute/921117-1.c | 22 + gcc/testsuite/gcc.c-torture/execute/921123-1.c | 13 + gcc/testsuite/gcc.c-torture/execute/921123-2.c | 24 + gcc/testsuite/gcc.c-torture/execute/921124-1.c | 19 + gcc/testsuite/gcc.c-torture/execute/921202-1.c | 41 ++ gcc/testsuite/gcc.c-torture/execute/921202-2.c | 13 + gcc/testsuite/gcc.c-torture/execute/921204-1.c | 46 ++ gcc/testsuite/gcc.c-torture/execute/921207-1.c | 15 + gcc/testsuite/gcc.c-torture/execute/921208-1.c | 18 + gcc/testsuite/gcc.c-torture/execute/921208-2.c | 26 + gcc/testsuite/gcc.c-torture/execute/921215-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/921218-1.c | 11 + gcc/testsuite/gcc.c-torture/execute/921218-2.c | 17 + gcc/testsuite/gcc.c-torture/execute/930106-1.c | 27 + gcc/testsuite/gcc.c-torture/execute/930111-1.c | 22 + gcc/testsuite/gcc.c-torture/execute/930123-1.c | 16 + gcc/testsuite/gcc.c-torture/execute/930126-1.c | 20 + gcc/testsuite/gcc.c-torture/execute/930208-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/930406-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/930408-1.c | 27 + gcc/testsuite/gcc.c-torture/execute/930429-1.c | 14 + gcc/testsuite/gcc.c-torture/execute/930429-2.c | 14 + gcc/testsuite/gcc.c-torture/execute/930513-1.c | 16 + gcc/testsuite/gcc.c-torture/execute/930513-1.x | 5 + gcc/testsuite/gcc.c-torture/execute/930513-2.c | 27 + gcc/testsuite/gcc.c-torture/execute/930518-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/930526-1.c | 18 + gcc/testsuite/gcc.c-torture/execute/930527-1.c | 11 + gcc/testsuite/gcc.c-torture/execute/930529-1.c | 45 ++ gcc/testsuite/gcc.c-torture/execute/930529-1.x | 24 + gcc/testsuite/gcc.c-torture/execute/930603-1.c | 22 + gcc/testsuite/gcc.c-torture/execute/930603-2.c | 19 + gcc/testsuite/gcc.c-torture/execute/930603-3.c | 30 + gcc/testsuite/gcc.c-torture/execute/930608-1.c | 11 + gcc/testsuite/gcc.c-torture/execute/930614-1.c | 19 + gcc/testsuite/gcc.c-torture/execute/930614-2.c | 20 + gcc/testsuite/gcc.c-torture/execute/930621-1.c | 29 + gcc/testsuite/gcc.c-torture/execute/930622-1.c | 22 + gcc/testsuite/gcc.c-torture/execute/930622-2.c | 24 + gcc/testsuite/gcc.c-torture/execute/930628-1.c | 27 + gcc/testsuite/gcc.c-torture/execute/930630-1.c | 29 + gcc/testsuite/gcc.c-torture/execute/930702-1.c | 14 + gcc/testsuite/gcc.c-torture/execute/930713-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/930718-1.c | 34 + gcc/testsuite/gcc.c-torture/execute/930719-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/930725-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/930818-1.c | 15 + gcc/testsuite/gcc.c-torture/execute/930916-1.c | 13 + gcc/testsuite/gcc.c-torture/execute/930921-1.c | 15 + gcc/testsuite/gcc.c-torture/execute/930929-1.c | 36 + gcc/testsuite/gcc.c-torture/execute/930930-1.c | 35 + gcc/testsuite/gcc.c-torture/execute/930930-2.c | 30 + gcc/testsuite/gcc.c-torture/execute/931002-1.c | 28 + gcc/testsuite/gcc.c-torture/execute/931004-1.c | 30 + gcc/testsuite/gcc.c-torture/execute/931004-10.c | 44 ++ gcc/testsuite/gcc.c-torture/execute/931004-11.c | 50 ++ gcc/testsuite/gcc.c-torture/execute/931004-12.c | 50 ++ gcc/testsuite/gcc.c-torture/execute/931004-12.x | 6 + gcc/testsuite/gcc.c-torture/execute/931004-13.c | 60 ++ gcc/testsuite/gcc.c-torture/execute/931004-14.c | 56 ++ gcc/testsuite/gcc.c-torture/execute/931004-2.c | 38 + gcc/testsuite/gcc.c-torture/execute/931004-3.c | 30 + gcc/testsuite/gcc.c-torture/execute/931004-4.c | 38 + gcc/testsuite/gcc.c-torture/execute/931004-5.c | 40 ++ gcc/testsuite/gcc.c-torture/execute/931004-6.c | 44 ++ gcc/testsuite/gcc.c-torture/execute/931004-7.c | 30 + gcc/testsuite/gcc.c-torture/execute/931004-8.c | 38 + gcc/testsuite/gcc.c-torture/execute/931004-9.c | 40 ++ gcc/testsuite/gcc.c-torture/execute/931005-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/931009-1.c | 26 + gcc/testsuite/gcc.c-torture/execute/931012-1.c | 13 + gcc/testsuite/gcc.c-torture/execute/931017-1.c | 54 ++ gcc/testsuite/gcc.c-torture/execute/931018-1.c | 18 + gcc/testsuite/gcc.c-torture/execute/931031-1.c | 34 + gcc/testsuite/gcc.c-torture/execute/931102-1.c | 30 + gcc/testsuite/gcc.c-torture/execute/931102-2.c | 31 + gcc/testsuite/gcc.c-torture/execute/931110-1.c | 18 + gcc/testsuite/gcc.c-torture/execute/931110-2.c | 12 + gcc/testsuite/gcc.c-torture/execute/931208-1.c | 14 + gcc/testsuite/gcc.c-torture/execute/931228-1.c | 15 + gcc/testsuite/gcc.c-torture/execute/940115-1.c | 13 + gcc/testsuite/gcc.c-torture/execute/940122-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/941014-1.c | 15 + gcc/testsuite/gcc.c-torture/execute/941014-1.x | 15 + gcc/testsuite/gcc.c-torture/execute/941014-2.c | 33 + gcc/testsuite/gcc.c-torture/execute/941015-1.c | 35 + gcc/testsuite/gcc.c-torture/execute/941021-1.c | 20 + gcc/testsuite/gcc.c-torture/execute/941025-1.c | 12 + gcc/testsuite/gcc.c-torture/execute/941031-1.c | 27 + gcc/testsuite/gcc.c-torture/execute/941101-1.c | 15 + gcc/testsuite/gcc.c-torture/execute/941110-1.c | 16 + gcc/testsuite/gcc.c-torture/execute/941202-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/950221-1.c | 55 ++ gcc/testsuite/gcc.c-torture/execute/950322-1.c | 30 + gcc/testsuite/gcc.c-torture/execute/950426-1.c | 32 + gcc/testsuite/gcc.c-torture/execute/950426-2.c | 13 + gcc/testsuite/gcc.c-torture/execute/950503-1.c | 15 + gcc/testsuite/gcc.c-torture/execute/950511-1.c | 11 + gcc/testsuite/gcc.c-torture/execute/950512-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/950605-1.c | 12 + gcc/testsuite/gcc.c-torture/execute/950607-1.c | 9 + gcc/testsuite/gcc.c-torture/execute/950607-2.c | 41 ++ gcc/testsuite/gcc.c-torture/execute/950612-1.c | 48 ++ gcc/testsuite/gcc.c-torture/execute/950621-1.c | 20 + gcc/testsuite/gcc.c-torture/execute/950628-1.c | 31 + gcc/testsuite/gcc.c-torture/execute/950704-1.c | 59 ++ gcc/testsuite/gcc.c-torture/execute/950706-1.c | 16 + gcc/testsuite/gcc.c-torture/execute/950710-1.c | 54 ++ gcc/testsuite/gcc.c-torture/execute/950714-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/950809-1.c | 33 + gcc/testsuite/gcc.c-torture/execute/950906-1.c | 16 + gcc/testsuite/gcc.c-torture/execute/950915-1.c | 15 + gcc/testsuite/gcc.c-torture/execute/950929-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/951003-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/951115-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/951204-1.c | 18 + gcc/testsuite/gcc.c-torture/execute/960116-1.c | 20 + gcc/testsuite/gcc.c-torture/execute/960117-1.c | 46 ++ gcc/testsuite/gcc.c-torture/execute/960209-1.c | 43 ++ gcc/testsuite/gcc.c-torture/execute/960215-1.c | 25 + gcc/testsuite/gcc.c-torture/execute/960218-1.c | 22 + gcc/testsuite/gcc.c-torture/execute/960219-1.c | 11 + gcc/testsuite/gcc.c-torture/execute/960301-1.c | 22 + gcc/testsuite/gcc.c-torture/execute/960302-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/960311-1.c | 69 ++ gcc/testsuite/gcc.c-torture/execute/960311-2.c | 69 ++ gcc/testsuite/gcc.c-torture/execute/960311-3.c | 69 ++ gcc/testsuite/gcc.c-torture/execute/960312-1.c | 34 + gcc/testsuite/gcc.c-torture/execute/960312-1.x | 7 + gcc/testsuite/gcc.c-torture/execute/960317-1.c | 22 + gcc/testsuite/gcc.c-torture/execute/960321-1.c | 14 + gcc/testsuite/gcc.c-torture/execute/960326-1.c | 16 + gcc/testsuite/gcc.c-torture/execute/960327-1.c | 30 + gcc/testsuite/gcc.c-torture/execute/960402-1.c | 11 + gcc/testsuite/gcc.c-torture/execute/960405-1.c | 13 + gcc/testsuite/gcc.c-torture/execute/960416-1.c | 63 ++ gcc/testsuite/gcc.c-torture/execute/960419-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/960419-2.c | 13 + gcc/testsuite/gcc.c-torture/execute/960512-1.c | 19 + gcc/testsuite/gcc.c-torture/execute/960513-1.c | 25 + gcc/testsuite/gcc.c-torture/execute/960521-1.c | 30 + gcc/testsuite/gcc.c-torture/execute/960608-1.c | 34 + gcc/testsuite/gcc.c-torture/execute/960801-1.c | 32 + gcc/testsuite/gcc.c-torture/execute/960802-1.c | 36 + gcc/testsuite/gcc.c-torture/execute/960830-1.c | 22 + gcc/testsuite/gcc.c-torture/execute/960909-1.c | 29 + gcc/testsuite/gcc.c-torture/execute/961004-1.c | 22 + gcc/testsuite/gcc.c-torture/execute/961017-1.c | 8 + gcc/testsuite/gcc.c-torture/execute/961017-2.c | 32 + gcc/testsuite/gcc.c-torture/execute/961026-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/961112-1.c | 13 + gcc/testsuite/gcc.c-torture/execute/961122-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/961122-2.c | 12 + gcc/testsuite/gcc.c-torture/execute/961125-1.c | 33 + gcc/testsuite/gcc.c-torture/execute/961206-1.c | 52 ++ gcc/testsuite/gcc.c-torture/execute/961213-1.c | 22 + gcc/testsuite/gcc.c-torture/execute/961223-1.c | 19 + gcc/testsuite/gcc.c-torture/execute/970214-1.c | 5 + gcc/testsuite/gcc.c-torture/execute/970214-2.c | 5 + gcc/testsuite/gcc.c-torture/execute/970217-1.c | 10 + gcc/testsuite/gcc.c-torture/execute/970923-1.c | 27 + gcc/testsuite/gcc.c-torture/execute/980205.c | 20 + gcc/testsuite/gcc.c-torture/execute/980223.c | 31 + gcc/testsuite/gcc.c-torture/execute/980424-1.c | 22 + gcc/testsuite/gcc.c-torture/execute/980505-1.c | 11 + gcc/testsuite/gcc.c-torture/execute/980505-2.c | 22 + gcc/testsuite/gcc.c-torture/execute/980506-1.c | 26 + gcc/testsuite/gcc.c-torture/execute/980506-2.c | 22 + gcc/testsuite/gcc.c-torture/execute/980506-3.c | 24 + gcc/testsuite/gcc.c-torture/execute/980526-1.c | 37 + gcc/testsuite/gcc.c-torture/execute/980526-2.c | 57 ++ gcc/testsuite/gcc.c-torture/execute/980526-3.c | 20 + gcc/testsuite/gcc.c-torture/execute/980602-1.c | 10 + gcc/testsuite/gcc.c-torture/execute/980602-2.c | 21 + gcc/testsuite/gcc.c-torture/execute/980604-1.c | 20 + gcc/testsuite/gcc.c-torture/execute/980605-1.c | 78 +++ gcc/testsuite/gcc.c-torture/execute/980608-1.c | 36 + gcc/testsuite/gcc.c-torture/execute/980612-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/980617-1.c | 14 + gcc/testsuite/gcc.c-torture/execute/980618-1.c | 16 + gcc/testsuite/gcc.c-torture/execute/980701-1.c | 22 + gcc/testsuite/gcc.c-torture/execute/980707-1.c | 45 ++ gcc/testsuite/gcc.c-torture/execute/980709-1.c | 14 + gcc/testsuite/gcc.c-torture/execute/980709-1.x | 20 + gcc/testsuite/gcc.c-torture/execute/980716-1.c | 26 + gcc/testsuite/gcc.c-torture/execute/980929-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/981001-1.c | 38 + gcc/testsuite/gcc.c-torture/execute/981019-1.c | 44 ++ gcc/testsuite/gcc.c-torture/execute/981130-1.c | 30 + gcc/testsuite/gcc.c-torture/execute/981130-1.x | 22 + gcc/testsuite/gcc.c-torture/execute/981206-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/990106-1.c | 16 + gcc/testsuite/gcc.c-torture/execute/990106-2.c | 22 + gcc/testsuite/gcc.c-torture/execute/990117-1.c | 16 + gcc/testsuite/gcc.c-torture/execute/990127-1.c | 31 + gcc/testsuite/gcc.c-torture/execute/990127-2.c | 20 + gcc/testsuite/gcc.c-torture/execute/990127-2.x | 15 + gcc/testsuite/gcc.c-torture/execute/990128-1.c | 50 ++ gcc/testsuite/gcc.c-torture/execute/990130-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/990208-1.c | 50 ++ gcc/testsuite/gcc.c-torture/execute/990211-1.c | 61 ++ gcc/testsuite/gcc.c-torture/execute/990222-1.c | 11 + gcc/testsuite/gcc.c-torture/execute/990324-1.c | 13 + gcc/testsuite/gcc.c-torture/execute/990326-1.c | 407 +++++++++++ gcc/testsuite/gcc.c-torture/execute/990404-1.c | 27 + gcc/testsuite/gcc.c-torture/execute/990413-2.c | 50 ++ gcc/testsuite/gcc.c-torture/execute/990413-2.x | 3 + gcc/testsuite/gcc.c-torture/execute/990513-1.c | 26 + gcc/testsuite/gcc.c-torture/execute/990524-1.c | 26 + gcc/testsuite/gcc.c-torture/execute/990525-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/990525-2.c | 39 ++ gcc/testsuite/gcc.c-torture/execute/990527-1.c | 30 + gcc/testsuite/gcc.c-torture/execute/990531-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/990604-1.c | 19 + gcc/testsuite/gcc.c-torture/execute/990628-1.c | 56 ++ gcc/testsuite/gcc.c-torture/execute/990804-1.c | 30 + gcc/testsuite/gcc.c-torture/execute/990811-1.c | 31 + gcc/testsuite/gcc.c-torture/execute/990826-0.c | 27 + gcc/testsuite/gcc.c-torture/execute/990826-0.x | 20 + gcc/testsuite/gcc.c-torture/execute/990827-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/990829-1.c | 15 + gcc/testsuite/gcc.c-torture/execute/990923-1.c | 19 + gcc/testsuite/gcc.c-torture/execute/991014-1.c | 54 ++ gcc/testsuite/gcc.c-torture/execute/991016-1.c | 55 ++ gcc/testsuite/gcc.c-torture/execute/991019-1.c | 28 + gcc/testsuite/gcc.c-torture/execute/991023-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/991030-1.c | 9 + gcc/testsuite/gcc.c-torture/execute/991112-1.c | 19 + gcc/testsuite/gcc.c-torture/execute/991118-1.c | 79 +++ gcc/testsuite/gcc.c-torture/execute/991201-1.c | 39 ++ gcc/testsuite/gcc.c-torture/execute/991202-1.c | 16 + gcc/testsuite/gcc.c-torture/execute/991202-2.c | 17 + gcc/testsuite/gcc.c-torture/execute/991202-3.c | 22 + gcc/testsuite/gcc.c-torture/execute/991216-1.c | 116 +++ gcc/testsuite/gcc.c-torture/execute/991216-2.c | 40 ++ gcc/testsuite/gcc.c-torture/execute/991216-4.c | 16 + gcc/testsuite/gcc.c-torture/execute/991221-1.c | 13 + gcc/testsuite/gcc.c-torture/execute/991227-1.c | 11 + gcc/testsuite/gcc.c-torture/execute/991228-1.c | 25 + gcc/testsuite/gcc.c-torture/execute/align-1.c | 9 + gcc/testsuite/gcc.c-torture/execute/align-2.c | 50 ++ gcc/testsuite/gcc.c-torture/execute/align-3.c | 12 + gcc/testsuite/gcc.c-torture/execute/align-nest.c | 28 + gcc/testsuite/gcc.c-torture/execute/alloca-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/anon-1.c | 29 + gcc/testsuite/gcc.c-torture/execute/arith-1.c | 15 + .../gcc.c-torture/execute/arith-rand-ll.c | 114 +++ gcc/testsuite/gcc.c-torture/execute/arith-rand.c | 114 +++ gcc/testsuite/gcc.c-torture/execute/ashldi-1.c | 221 ++++++ gcc/testsuite/gcc.c-torture/execute/ashrdi-1.c | 335 +++++++++ gcc/testsuite/gcc.c-torture/execute/bcp-1.c | 91 +++ gcc/testsuite/gcc.c-torture/execute/bf-layout-1.c | 9 + gcc/testsuite/gcc.c-torture/execute/bf-pack-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/bf-sign-1.c | 18 + gcc/testsuite/gcc.c-torture/execute/bf-sign-2.c | 66 ++ gcc/testsuite/gcc.c-torture/execute/bf64-1.c | 40 ++ gcc/testsuite/gcc.c-torture/execute/bf64-1.x | 8 + gcc/testsuite/gcc.c-torture/execute/bitfld-1.c | 54 ++ gcc/testsuite/gcc.c-torture/execute/bitfld-2.c | 28 + gcc/testsuite/gcc.c-torture/execute/bitfld-3.c | 54 ++ gcc/testsuite/gcc.c-torture/execute/bitfld-4.c | 21 + gcc/testsuite/gcc.c-torture/execute/bitfld-4.x | 7 + gcc/testsuite/gcc.c-torture/execute/bitfld-5.c | 35 + .../gcc.c-torture/execute/built-in-setjmp.c | 39 ++ .../gcc.c-torture/execute/builtin-bitops-1.c | 263 +++++++ .../gcc.c-torture/execute/builtin-constant.c | 26 + .../gcc.c-torture/execute/builtin-prefetch-1.c | 69 ++ .../gcc.c-torture/execute/builtin-prefetch-2.c | 152 ++++ .../gcc.c-torture/execute/builtin-prefetch-3.c | 113 +++ .../gcc.c-torture/execute/builtin-prefetch-4.c | 271 +++++++ .../gcc.c-torture/execute/builtin-prefetch-5.c | 60 ++ .../gcc.c-torture/execute/builtin-prefetch-6.c | 46 ++ .../execute/builtin-types-compatible-p.c | 35 + .../execute/builtins/20010124-1-lib.c | 50 ++ .../gcc.c-torture/execute/builtins/20010124-1.c | 30 + .../gcc.c-torture/execute/builtins/abs-1-lib.c | 22 + .../gcc.c-torture/execute/builtins/abs-1.c | 22 + .../gcc.c-torture/execute/builtins/abs-1.x | 2 + .../gcc.c-torture/execute/builtins/abs-2-lib.c | 1 + .../gcc.c-torture/execute/builtins/abs-2.c | 106 +++ .../gcc.c-torture/execute/builtins/abs-3-lib.c | 1 + .../gcc.c-torture/execute/builtins/abs-3.c | 102 +++ .../gcc.c-torture/execute/builtins/builtins.exp | 54 ++ gcc/testsuite/gcc.c-torture/execute/builtins/chk.h | 89 +++ .../gcc.c-torture/execute/builtins/complex-1-lib.c | 70 ++ .../gcc.c-torture/execute/builtins/complex-1.c | 102 +++ .../gcc.c-torture/execute/builtins/fprintf-lib.c | 1 + .../gcc.c-torture/execute/builtins/fprintf.c | 61 ++ .../gcc.c-torture/execute/builtins/fprintf.x | 7 + .../gcc.c-torture/execute/builtins/fputs-lib.c | 24 + .../gcc.c-torture/execute/builtins/fputs.c | 65 ++ .../gcc.c-torture/execute/builtins/lib/abs.c | 41 ++ .../gcc.c-torture/execute/builtins/lib/bfill.c | 16 + .../gcc.c-torture/execute/builtins/lib/bzero.c | 16 + .../gcc.c-torture/execute/builtins/lib/chk.c | 478 +++++++++++++ .../gcc.c-torture/execute/builtins/lib/fprintf.c | 37 + .../gcc.c-torture/execute/builtins/lib/main.c | 25 + .../gcc.c-torture/execute/builtins/lib/memchr.c | 22 + .../gcc.c-torture/execute/builtins/lib/memcmp.c | 23 + .../gcc.c-torture/execute/builtins/lib/memmove.c | 32 + .../gcc.c-torture/execute/builtins/lib/mempcpy.c | 22 + .../gcc.c-torture/execute/builtins/lib/memset.c | 20 + .../gcc.c-torture/execute/builtins/lib/printf.c | 38 + .../gcc.c-torture/execute/builtins/lib/sprintf.c | 22 + .../gcc.c-torture/execute/builtins/lib/stpcpy.c | 18 + .../gcc.c-torture/execute/builtins/lib/strcat.c | 20 + .../gcc.c-torture/execute/builtins/lib/strchr.c | 28 + .../gcc.c-torture/execute/builtins/lib/strcmp.c | 19 + .../gcc.c-torture/execute/builtins/lib/strcpy.c | 15 + .../gcc.c-torture/execute/builtins/lib/strcspn.c | 22 + .../gcc.c-torture/execute/builtins/lib/strlen.c | 20 + .../gcc.c-torture/execute/builtins/lib/strncat.c | 29 + .../gcc.c-torture/execute/builtins/lib/strncmp.c | 27 + .../gcc.c-torture/execute/builtins/lib/strncpy.c | 21 + .../gcc.c-torture/execute/builtins/lib/strpbrk.c | 21 + .../gcc.c-torture/execute/builtins/lib/strrchr.c | 32 + .../gcc.c-torture/execute/builtins/lib/strspn.c | 25 + .../gcc.c-torture/execute/builtins/lib/strstr.c | 29 + .../gcc.c-torture/execute/builtins/memchr-lib.c | 1 + .../gcc.c-torture/execute/builtins/memchr.c | 38 + .../gcc.c-torture/execute/builtins/memcmp-lib.c | 1 + .../gcc.c-torture/execute/builtins/memcmp.c | 41 ++ .../execute/builtins/memcpy-chk-lib.c | 1 + .../gcc.c-torture/execute/builtins/memcpy-chk.c | 479 +++++++++++++ .../gcc.c-torture/execute/builtins/memmove-2-lib.c | 7 + .../gcc.c-torture/execute/builtins/memmove-2.c | 36 + .../execute/builtins/memmove-chk-lib.c | 1 + .../gcc.c-torture/execute/builtins/memmove-chk.c | 579 +++++++++++++++ .../gcc.c-torture/execute/builtins/memmove-lib.c | 7 + .../gcc.c-torture/execute/builtins/memmove.c | 90 +++ .../execute/builtins/memops-asm-lib.c | 97 +++ .../gcc.c-torture/execute/builtins/memops-asm.c | 51 ++ .../gcc.c-torture/execute/builtins/mempcpy-2-lib.c | 1 + .../gcc.c-torture/execute/builtins/mempcpy-2.c | 153 ++++ .../execute/builtins/mempcpy-chk-lib.c | 1 + .../gcc.c-torture/execute/builtins/mempcpy-chk.c | 487 +++++++++++++ .../gcc.c-torture/execute/builtins/mempcpy-lib.c | 1 + .../gcc.c-torture/execute/builtins/mempcpy.c | 68 ++ .../execute/builtins/memset-chk-lib.c | 1 + .../gcc.c-torture/execute/builtins/memset-chk.c | 721 +++++++++++++++++++ .../gcc.c-torture/execute/builtins/memset-lib.c | 1 + .../gcc.c-torture/execute/builtins/memset.c | 36 + .../gcc.c-torture/execute/builtins/pr22237-lib.c | 27 + .../gcc.c-torture/execute/builtins/pr22237.c | 44 ++ .../execute/builtins/pr23484-chk-lib.c | 1 + .../gcc.c-torture/execute/builtins/pr23484-chk.c | 67 ++ .../gcc.c-torture/execute/builtins/printf-lib.c | 1 + .../gcc.c-torture/execute/builtins/printf.c | 52 ++ .../execute/builtins/snprintf-chk-lib.c | 1 + .../gcc.c-torture/execute/builtins/snprintf-chk.c | 220 ++++++ .../execute/builtins/sprintf-chk-lib.c | 1 + .../gcc.c-torture/execute/builtins/sprintf-chk.c | 197 ++++++ .../gcc.c-torture/execute/builtins/sprintf-lib.c | 1 + .../gcc.c-torture/execute/builtins/sprintf.c | 71 ++ .../execute/builtins/stpcpy-chk-lib.c | 1 + .../gcc.c-torture/execute/builtins/stpcpy-chk.c | 265 +++++++ .../execute/builtins/strcat-chk-lib.c | 1 + .../gcc.c-torture/execute/builtins/strcat-chk.c | 204 ++++++ .../gcc.c-torture/execute/builtins/strcat-lib.c | 1 + .../gcc.c-torture/execute/builtins/strcat.c | 81 +++ .../gcc.c-torture/execute/builtins/strchr-lib.c | 8 + .../gcc.c-torture/execute/builtins/strchr.c | 36 + .../gcc.c-torture/execute/builtins/strcmp-lib.c | 1 + .../gcc.c-torture/execute/builtins/strcmp.c | 48 ++ .../gcc.c-torture/execute/builtins/strcpy-2-lib.c | 1 + .../gcc.c-torture/execute/builtins/strcpy-2.c | 47 ++ .../execute/builtins/strcpy-chk-lib.c | 1 + .../gcc.c-torture/execute/builtins/strcpy-chk.c | 234 +++++++ .../gcc.c-torture/execute/builtins/strcpy-lib.c | 1 + .../gcc.c-torture/execute/builtins/strcpy.c | 41 ++ .../gcc.c-torture/execute/builtins/strcspn-lib.c | 1 + .../gcc.c-torture/execute/builtins/strcspn.c | 54 ++ .../gcc.c-torture/execute/builtins/strlen-2-lib.c | 1 + .../gcc.c-torture/execute/builtins/strlen-2.c | 41 ++ .../gcc.c-torture/execute/builtins/strlen-3-lib.c | 1 + .../gcc.c-torture/execute/builtins/strlen-3.c | 70 ++ .../gcc.c-torture/execute/builtins/strlen-lib.c | 1 + .../gcc.c-torture/execute/builtins/strlen.c | 71 ++ .../execute/builtins/strncat-chk-lib.c | 1 + .../gcc.c-torture/execute/builtins/strncat-chk.c | 229 ++++++ .../gcc.c-torture/execute/builtins/strncat-lib.c | 1 + .../gcc.c-torture/execute/builtins/strncat.c | 82 +++ .../gcc.c-torture/execute/builtins/strncmp-2-lib.c | 1 + .../gcc.c-torture/execute/builtins/strncmp-2.c | 173 +++++ .../gcc.c-torture/execute/builtins/strncmp-lib.c | 1 + .../gcc.c-torture/execute/builtins/strncmp.c | 73 ++ .../execute/builtins/strncpy-chk-lib.c | 1 + .../gcc.c-torture/execute/builtins/strncpy-chk.c | 227 ++++++ .../gcc.c-torture/execute/builtins/strncpy-lib.c | 1 + .../gcc.c-torture/execute/builtins/strncpy.c | 75 ++ .../gcc.c-torture/execute/builtins/strpbrk-lib.c | 1 + .../gcc.c-torture/execute/builtins/strpbrk.c | 42 ++ .../gcc.c-torture/execute/builtins/strpcpy-2-lib.c | 1 + .../gcc.c-torture/execute/builtins/strpcpy-2.c | 45 ++ .../gcc.c-torture/execute/builtins/strpcpy-lib.c | 1 + .../gcc.c-torture/execute/builtins/strpcpy.c | 60 ++ .../gcc.c-torture/execute/builtins/strrchr-lib.c | 8 + .../gcc.c-torture/execute/builtins/strrchr.c | 49 ++ .../gcc.c-torture/execute/builtins/strspn-lib.c | 1 + .../gcc.c-torture/execute/builtins/strspn.c | 54 ++ .../execute/builtins/strstr-asm-lib.c | 37 + .../gcc.c-torture/execute/builtins/strstr-asm.c | 45 ++ .../gcc.c-torture/execute/builtins/strstr-lib.c | 1 + .../gcc.c-torture/execute/builtins/strstr.c | 33 + .../execute/builtins/vsnprintf-chk-lib.c | 1 + .../gcc.c-torture/execute/builtins/vsnprintf-chk.c | 321 +++++++++ .../execute/builtins/vsprintf-chk-lib.c | 1 + .../gcc.c-torture/execute/builtins/vsprintf-chk.c | 290 ++++++++ gcc/testsuite/gcc.c-torture/execute/call-trap-1.c | 26 + gcc/testsuite/gcc.c-torture/execute/cbrt.c | 92 +++ gcc/testsuite/gcc.c-torture/execute/cmpdi-1.c | 218 ++++++ gcc/testsuite/gcc.c-torture/execute/cmpsf-1.c | 161 +++++ gcc/testsuite/gcc.c-torture/execute/cmpsi-1.c | 32 + gcc/testsuite/gcc.c-torture/execute/cmpsi-2.c | 199 ++++++ gcc/testsuite/gcc.c-torture/execute/comp-goto-1.c | 164 +++++ gcc/testsuite/gcc.c-torture/execute/comp-goto-2.c | 36 + gcc/testsuite/gcc.c-torture/execute/compare-1.c | 119 ++++ gcc/testsuite/gcc.c-torture/execute/compare-2.c | 24 + gcc/testsuite/gcc.c-torture/execute/compare-3.c | 86 +++ gcc/testsuite/gcc.c-torture/execute/complex-1.c | 40 ++ gcc/testsuite/gcc.c-torture/execute/complex-2.c | 27 + gcc/testsuite/gcc.c-torture/execute/complex-3.c | 25 + gcc/testsuite/gcc.c-torture/execute/complex-4.c | 9 + gcc/testsuite/gcc.c-torture/execute/complex-5.c | 20 + gcc/testsuite/gcc.c-torture/execute/complex-6.c | 59 ++ gcc/testsuite/gcc.c-torture/execute/complex-7.c | 56 ++ gcc/testsuite/gcc.c-torture/execute/compndlit-1.c | 25 + .../gcc.c-torture/execute/const-addr-expr-1.c | 33 + gcc/testsuite/gcc.c-torture/execute/conversion.c | 551 +++++++++++++++ gcc/testsuite/gcc.c-torture/execute/cvt-1.c | 28 + gcc/testsuite/gcc.c-torture/execute/cvt-1.x | 7 + gcc/testsuite/gcc.c-torture/execute/dbra-1.c | 95 +++ gcc/testsuite/gcc.c-torture/execute/divcmp-1.c | 356 ++++++++++ gcc/testsuite/gcc.c-torture/execute/divcmp-2.c | 92 +++ gcc/testsuite/gcc.c-torture/execute/divcmp-3.c | 97 +++ gcc/testsuite/gcc.c-torture/execute/divcmp-4.c | 202 ++++++ gcc/testsuite/gcc.c-torture/execute/divcmp-5.c | 31 + gcc/testsuite/gcc.c-torture/execute/divconst-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/divconst-2.c | 39 ++ gcc/testsuite/gcc.c-torture/execute/divconst-3.c | 12 + gcc/testsuite/gcc.c-torture/execute/divmod-1.c | 77 ++ gcc/testsuite/gcc.c-torture/execute/doloop-1.c | 18 + gcc/testsuite/gcc.c-torture/execute/doloop-2.c | 18 + gcc/testsuite/gcc.c-torture/execute/eeprof-1.c | 73 ++ gcc/testsuite/gcc.c-torture/execute/eeprof-1.x | 5 + gcc/testsuite/gcc.c-torture/execute/enum-1.c | 43 ++ gcc/testsuite/gcc.c-torture/execute/enum-2.c | 22 + gcc/testsuite/gcc.c-torture/execute/enum-3.c | 24 + gcc/testsuite/gcc.c-torture/execute/execute.exp | 50 ++ gcc/testsuite/gcc.c-torture/execute/extzvsi.c | 41 ++ gcc/testsuite/gcc.c-torture/execute/ffs-1.c | 12 + gcc/testsuite/gcc.c-torture/execute/ffs-2.c | 44 ++ gcc/testsuite/gcc.c-torture/execute/float-floor.c | 21 + .../gcc.c-torture/execute/floatunsisf-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/fprintf-1.c | 23 + .../gcc.c-torture/execute/fprintf-chk-1.c | 49 ++ .../gcc.c-torture/execute/frame-address.c | 44 ++ gcc/testsuite/gcc.c-torture/execute/func-ptr-1.c | 16 + gcc/testsuite/gcc.c-torture/execute/gofast.c | 99 +++ .../gcc.c-torture/execute/ieee/20000320-1.c | 104 +++ .../gcc.c-torture/execute/ieee/20000320-1.x | 10 + .../gcc.c-torture/execute/ieee/20001122-1.c | 22 + .../gcc.c-torture/execute/ieee/20010114-2.c | 31 + .../gcc.c-torture/execute/ieee/20010114-2.x | 6 + .../gcc.c-torture/execute/ieee/20010226-1.c | 24 + .../gcc.c-torture/execute/ieee/20011123-1.c | 12 + .../gcc.c-torture/execute/ieee/20030331-1.c | 32 + .../gcc.c-torture/execute/ieee/20030331-1.x | 6 + .../gcc.c-torture/execute/ieee/20041213-1.c | 17 + .../gcc.c-torture/execute/ieee/920518-1.c | 8 + .../gcc.c-torture/execute/ieee/920518-1.x | 6 + .../gcc.c-torture/execute/ieee/920810-1.c | 3 + .../gcc.c-torture/execute/ieee/930529-1.c | 27 + .../gcc.c-torture/execute/ieee/980619-1.c | 23 + .../gcc.c-torture/execute/ieee/980619-1.x | 15 + gcc/testsuite/gcc.c-torture/execute/ieee/acc1.c | 18 + gcc/testsuite/gcc.c-torture/execute/ieee/acc2.c | 19 + .../gcc.c-torture/execute/ieee/builtin-nan-1.c | 17 + .../gcc.c-torture/execute/ieee/compare-fp-1.c | 189 +++++ .../gcc.c-torture/execute/ieee/compare-fp-1.x | 6 + .../gcc.c-torture/execute/ieee/compare-fp-2.c | 24 + .../gcc.c-torture/execute/ieee/compare-fp-3.c | 97 +++ .../gcc.c-torture/execute/ieee/compare-fp-3.x | 2 + .../gcc.c-torture/execute/ieee/compare-fp-4.c | 190 +++++ .../gcc.c-torture/execute/ieee/compare-fp-4.x | 23 + .../gcc.c-torture/execute/ieee/copysign1.c | 76 ++ .../gcc.c-torture/execute/ieee/copysign2.c | 70 ++ .../gcc.c-torture/execute/ieee/fp-cmp-1.c | 43 ++ .../gcc.c-torture/execute/ieee/fp-cmp-1.x | 16 + .../gcc.c-torture/execute/ieee/fp-cmp-2.c | 43 ++ .../gcc.c-torture/execute/ieee/fp-cmp-2.x | 22 + .../gcc.c-torture/execute/ieee/fp-cmp-3.c | 43 ++ .../gcc.c-torture/execute/ieee/fp-cmp-3.x | 16 + .../gcc.c-torture/execute/ieee/fp-cmp-4.c | 135 ++++ .../gcc.c-torture/execute/ieee/fp-cmp-4e.c | 10 + .../gcc.c-torture/execute/ieee/fp-cmp-4f.c | 2 + .../gcc.c-torture/execute/ieee/fp-cmp-4f.x | 6 + .../gcc.c-torture/execute/ieee/fp-cmp-4l.c | 2 + .../gcc.c-torture/execute/ieee/fp-cmp-5.c | 131 ++++ .../gcc.c-torture/execute/ieee/fp-cmp-6.c | 39 ++ .../gcc.c-torture/execute/ieee/fp-cmp-6.x | 16 + .../gcc.c-torture/execute/ieee/fp-cmp-7.c | 14 + .../gcc.c-torture/execute/ieee/fp-cmp-8.c | 145 ++++ .../gcc.c-torture/execute/ieee/fp-cmp-8e.c | 10 + .../gcc.c-torture/execute/ieee/fp-cmp-8f.c | 2 + .../gcc.c-torture/execute/ieee/fp-cmp-8f.x | 6 + .../gcc.c-torture/execute/ieee/fp-cmp-8l.c | 2 + gcc/testsuite/gcc.c-torture/execute/ieee/hugeval.c | 27 + gcc/testsuite/gcc.c-torture/execute/ieee/hugeval.x | 23 + gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp | 79 +++ gcc/testsuite/gcc.c-torture/execute/ieee/inf-1.c | 44 ++ gcc/testsuite/gcc.c-torture/execute/ieee/inf-2.c | 83 +++ gcc/testsuite/gcc.c-torture/execute/ieee/inf-3.c | 79 +++ .../gcc.c-torture/execute/ieee/minuszero.c | 22 + .../execute/ieee/mul-subnormal-single-1.c | 75 ++ .../execute/ieee/mul-subnormal-single-1.x | 16 + gcc/testsuite/gcc.c-torture/execute/ieee/mzero2.c | 58 ++ gcc/testsuite/gcc.c-torture/execute/ieee/mzero2.x | 6 + gcc/testsuite/gcc.c-torture/execute/ieee/mzero3.c | 51 ++ gcc/testsuite/gcc.c-torture/execute/ieee/mzero4.c | 58 ++ gcc/testsuite/gcc.c-torture/execute/ieee/mzero5.c | 29 + gcc/testsuite/gcc.c-torture/execute/ieee/mzero6.c | 24 + gcc/testsuite/gcc.c-torture/execute/ieee/pr28634.c | 15 + .../gcc.c-torture/execute/ieee/pr29302-1.c | 16 + gcc/testsuite/gcc.c-torture/execute/ieee/pr30704.c | 55 ++ gcc/testsuite/gcc.c-torture/execute/ieee/pr30704.x | 5 + gcc/testsuite/gcc.c-torture/execute/ieee/pr36332.c | 15 + gcc/testsuite/gcc.c-torture/execute/ieee/pr38016.c | 1 + gcc/testsuite/gcc.c-torture/execute/ieee/pr38016.x | 2 + gcc/testsuite/gcc.c-torture/execute/ieee/pr50310.c | 73 ++ gcc/testsuite/gcc.c-torture/execute/ieee/rbug.c | 55 ++ gcc/testsuite/gcc.c-torture/execute/ieee/rbug.x | 10 + .../gcc.c-torture/execute/ieee/unsafe-fp-assoc-1.c | 39 ++ .../gcc.c-torture/execute/ieee/unsafe-fp-assoc-1.x | 5 + .../gcc.c-torture/execute/ieee/unsafe-fp-assoc.c | 19 + .../gcc.c-torture/execute/ifcvt-onecmpl-abs-1.c | 19 + gcc/testsuite/gcc.c-torture/execute/index-1.c | 20 + gcc/testsuite/gcc.c-torture/execute/inst-check.c | 14 + gcc/testsuite/gcc.c-torture/execute/int-compare.c | 108 +++ gcc/testsuite/gcc.c-torture/execute/ipa-sra-1.c | 29 + gcc/testsuite/gcc.c-torture/execute/ipa-sra-2.c | 40 ++ gcc/testsuite/gcc.c-torture/execute/ipa-sra-2.x | 3 + gcc/testsuite/gcc.c-torture/execute/longlong.c | 39 ++ gcc/testsuite/gcc.c-torture/execute/loop-1.c | 18 + gcc/testsuite/gcc.c-torture/execute/loop-10.c | 31 + gcc/testsuite/gcc.c-torture/execute/loop-11.c | 20 + gcc/testsuite/gcc.c-torture/execute/loop-12.c | 25 + gcc/testsuite/gcc.c-torture/execute/loop-13.c | 36 + gcc/testsuite/gcc.c-torture/execute/loop-14.c | 20 + gcc/testsuite/gcc.c-torture/execute/loop-15.c | 40 ++ gcc/testsuite/gcc.c-torture/execute/loop-2.c | 17 + gcc/testsuite/gcc.c-torture/execute/loop-2b.c | 22 + gcc/testsuite/gcc.c-torture/execute/loop-2c.c | 23 + gcc/testsuite/gcc.c-torture/execute/loop-2d.c | 18 + gcc/testsuite/gcc.c-torture/execute/loop-2e.c | 39 ++ gcc/testsuite/gcc.c-torture/execute/loop-2f.c | 63 ++ gcc/testsuite/gcc.c-torture/execute/loop-2f.x | 5 + gcc/testsuite/gcc.c-torture/execute/loop-2g.c | 63 ++ gcc/testsuite/gcc.c-torture/execute/loop-2g.x | 5 + gcc/testsuite/gcc.c-torture/execute/loop-3.c | 27 + gcc/testsuite/gcc.c-torture/execute/loop-3b.c | 28 + gcc/testsuite/gcc.c-torture/execute/loop-3c.c | 31 + gcc/testsuite/gcc.c-torture/execute/loop-4.c | 16 + gcc/testsuite/gcc.c-torture/execute/loop-4b.c | 21 + gcc/testsuite/gcc.c-torture/execute/loop-5.c | 36 + gcc/testsuite/gcc.c-torture/execute/loop-6.c | 15 + gcc/testsuite/gcc.c-torture/execute/loop-7.c | 19 + gcc/testsuite/gcc.c-torture/execute/loop-8.c | 23 + gcc/testsuite/gcc.c-torture/execute/loop-9.c | 21 + .../gcc.c-torture/execute/loop-ivopts-1.c | 30 + .../gcc.c-torture/execute/loop-ivopts-2.c | 50 ++ gcc/testsuite/gcc.c-torture/execute/lshrdi-1.c | 221 ++++++ gcc/testsuite/gcc.c-torture/execute/mayalias-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/mayalias-2.c | 16 + gcc/testsuite/gcc.c-torture/execute/mayalias-3.c | 26 + gcc/testsuite/gcc.c-torture/execute/medce-1.c | 33 + gcc/testsuite/gcc.c-torture/execute/memcpy-1.c | 63 ++ gcc/testsuite/gcc.c-torture/execute/memcpy-2.c | 75 ++ gcc/testsuite/gcc.c-torture/execute/memcpy-bi.c | 53 ++ gcc/testsuite/gcc.c-torture/execute/memset-1.c | 96 +++ gcc/testsuite/gcc.c-torture/execute/memset-2.c | 334 +++++++++ gcc/testsuite/gcc.c-torture/execute/memset-3.c | 208 ++++++ gcc/testsuite/gcc.c-torture/execute/mod-1.c | 11 + .../gcc.c-torture/execute/mode-dependent-address.c | 49 ++ .../gcc.c-torture/execute/mode-dependent-address.x | 7 + gcc/testsuite/gcc.c-torture/execute/multdi-1.c | 20 + gcc/testsuite/gcc.c-torture/execute/multi-ix.c | 203 ++++++ gcc/testsuite/gcc.c-torture/execute/nest-align-1.c | 40 ++ gcc/testsuite/gcc.c-torture/execute/nest-stdar-1.c | 19 + gcc/testsuite/gcc.c-torture/execute/nestfunc-1.c | 28 + gcc/testsuite/gcc.c-torture/execute/nestfunc-2.c | 49 ++ gcc/testsuite/gcc.c-torture/execute/nestfunc-3.c | 60 ++ gcc/testsuite/gcc.c-torture/execute/nestfunc-4.c | 37 + gcc/testsuite/gcc.c-torture/execute/nestfunc-5.c | 36 + gcc/testsuite/gcc.c-torture/execute/nestfunc-6.c | 29 + gcc/testsuite/gcc.c-torture/execute/nestfunc-7.c | 44 ++ gcc/testsuite/gcc.c-torture/execute/p18298.c | 18 + gcc/testsuite/gcc.c-torture/execute/packed-1.c | 19 + gcc/testsuite/gcc.c-torture/execute/packed-2.c | 12 + gcc/testsuite/gcc.c-torture/execute/pending-4.c | 33 + gcc/testsuite/gcc.c-torture/execute/postmod-1.c | 62 ++ gcc/testsuite/gcc.c-torture/execute/pr15262-1.c | 47 ++ gcc/testsuite/gcc.c-torture/execute/pr15262-2.c | 37 + gcc/testsuite/gcc.c-torture/execute/pr15262.c | 48 ++ gcc/testsuite/gcc.c-torture/execute/pr15296.c | 73 ++ gcc/testsuite/gcc.c-torture/execute/pr16790-1.c | 41 ++ gcc/testsuite/gcc.c-torture/execute/pr17078-1.c | 25 + gcc/testsuite/gcc.c-torture/execute/pr17133.c | 27 + gcc/testsuite/gcc.c-torture/execute/pr17252.c | 21 + gcc/testsuite/gcc.c-torture/execute/pr17377.c | 59 ++ gcc/testsuite/gcc.c-torture/execute/pr19005.c | 38 + gcc/testsuite/gcc.c-torture/execute/pr19515.c | 17 + gcc/testsuite/gcc.c-torture/execute/pr19606.c | 34 + gcc/testsuite/gcc.c-torture/execute/pr19687.c | 18 + gcc/testsuite/gcc.c-torture/execute/pr19689.c | 19 + gcc/testsuite/gcc.c-torture/execute/pr19689.x | 7 + gcc/testsuite/gcc.c-torture/execute/pr20100-1.c | 76 ++ gcc/testsuite/gcc.c-torture/execute/pr20187-1.c | 15 + gcc/testsuite/gcc.c-torture/execute/pr20466-1.c | 26 + gcc/testsuite/gcc.c-torture/execute/pr20527-1.c | 81 +++ gcc/testsuite/gcc.c-torture/execute/pr20601-1.c | 122 ++++ gcc/testsuite/gcc.c-torture/execute/pr20621-1.c | 6 + gcc/testsuite/gcc.c-torture/execute/pr21173.c | 21 + gcc/testsuite/gcc.c-torture/execute/pr21331.c | 15 + gcc/testsuite/gcc.c-torture/execute/pr21964-1.c | 16 + gcc/testsuite/gcc.c-torture/execute/pr22061-1.c | 16 + gcc/testsuite/gcc.c-torture/execute/pr22061-2.c | 7 + gcc/testsuite/gcc.c-torture/execute/pr22061-3.c | 18 + gcc/testsuite/gcc.c-torture/execute/pr22061-4.c | 22 + gcc/testsuite/gcc.c-torture/execute/pr22098-1.c | 14 + gcc/testsuite/gcc.c-torture/execute/pr22098-2.c | 14 + gcc/testsuite/gcc.c-torture/execute/pr22098-3.c | 16 + gcc/testsuite/gcc.c-torture/execute/pr22348.c | 15 + gcc/testsuite/gcc.c-torture/execute/pr22429.c | 17 + gcc/testsuite/gcc.c-torture/execute/pr22493-1.c | 18 + gcc/testsuite/gcc.c-torture/execute/pr22493-1.x | 2 + gcc/testsuite/gcc.c-torture/execute/pr22630.c | 23 + gcc/testsuite/gcc.c-torture/execute/pr23047.c | 16 + gcc/testsuite/gcc.c-torture/execute/pr23047.x | 2 + gcc/testsuite/gcc.c-torture/execute/pr23135.c | 134 ++++ gcc/testsuite/gcc.c-torture/execute/pr23324.c | 133 ++++ gcc/testsuite/gcc.c-torture/execute/pr23467.c | 18 + gcc/testsuite/gcc.c-torture/execute/pr23604.c | 22 + gcc/testsuite/gcc.c-torture/execute/pr23941.c | 9 + gcc/testsuite/gcc.c-torture/execute/pr24135.c | 46 ++ gcc/testsuite/gcc.c-torture/execute/pr24141.c | 33 + gcc/testsuite/gcc.c-torture/execute/pr24142.c | 19 + gcc/testsuite/gcc.c-torture/execute/pr24716.c | 59 ++ gcc/testsuite/gcc.c-torture/execute/pr24851.c | 17 + gcc/testsuite/gcc.c-torture/execute/pr25125.c | 27 + gcc/testsuite/gcc.c-torture/execute/pr25737.c | 23 + gcc/testsuite/gcc.c-torture/execute/pr27073.c | 25 + gcc/testsuite/gcc.c-torture/execute/pr27260.c | 33 + gcc/testsuite/gcc.c-torture/execute/pr27285.c | 46 ++ gcc/testsuite/gcc.c-torture/execute/pr27364.c | 13 + gcc/testsuite/gcc.c-torture/execute/pr27671-1.c | 21 + gcc/testsuite/gcc.c-torture/execute/pr28289.c | 33 + gcc/testsuite/gcc.c-torture/execute/pr28403.c | 23 + gcc/testsuite/gcc.c-torture/execute/pr28651.c | 19 + gcc/testsuite/gcc.c-torture/execute/pr28778.c | 33 + gcc/testsuite/gcc.c-torture/execute/pr28982a.c | 65 ++ gcc/testsuite/gcc.c-torture/execute/pr28982b.c | 58 ++ gcc/testsuite/gcc.c-torture/execute/pr29006.c | 3 + gcc/testsuite/gcc.c-torture/execute/pr29156.c | 32 + gcc/testsuite/gcc.c-torture/execute/pr29695-1.c | 83 +++ gcc/testsuite/gcc.c-torture/execute/pr29695-2.c | 80 +++ gcc/testsuite/gcc.c-torture/execute/pr29797-1.c | 14 + gcc/testsuite/gcc.c-torture/execute/pr29797-1.x | 7 + gcc/testsuite/gcc.c-torture/execute/pr29797-2.c | 14 + gcc/testsuite/gcc.c-torture/execute/pr29798.c | 26 + gcc/testsuite/gcc.c-torture/execute/pr30185.c | 28 + gcc/testsuite/gcc.c-torture/execute/pr30778.c | 34 + gcc/testsuite/gcc.c-torture/execute/pr31072.c | 10 + gcc/testsuite/gcc.c-torture/execute/pr31136.c | 17 + gcc/testsuite/gcc.c-torture/execute/pr31169.c | 51 ++ gcc/testsuite/gcc.c-torture/execute/pr31448-2.c | 36 + gcc/testsuite/gcc.c-torture/execute/pr31448.c | 36 + gcc/testsuite/gcc.c-torture/execute/pr31448.x | 7 + gcc/testsuite/gcc.c-torture/execute/pr31605.c | 13 + gcc/testsuite/gcc.c-torture/execute/pr32244-1.c | 20 + gcc/testsuite/gcc.c-torture/execute/pr32500.c | 26 + gcc/testsuite/gcc.c-torture/execute/pr33142.c | 16 + gcc/testsuite/gcc.c-torture/execute/pr33382.c | 21 + gcc/testsuite/gcc.c-torture/execute/pr33631.c | 14 + gcc/testsuite/gcc.c-torture/execute/pr33669.c | 40 ++ gcc/testsuite/gcc.c-torture/execute/pr33779-1.c | 14 + gcc/testsuite/gcc.c-torture/execute/pr33779-2.c | 12 + gcc/testsuite/gcc.c-torture/execute/pr33870-1.c | 94 +++ gcc/testsuite/gcc.c-torture/execute/pr33870.c | 87 +++ gcc/testsuite/gcc.c-torture/execute/pr33992.c | 37 + gcc/testsuite/gcc.c-torture/execute/pr34070-1.c | 13 + gcc/testsuite/gcc.c-torture/execute/pr34070-2.c | 13 + gcc/testsuite/gcc.c-torture/execute/pr34099-2.c | 47 ++ gcc/testsuite/gcc.c-torture/execute/pr34099.c | 16 + gcc/testsuite/gcc.c-torture/execute/pr34130.c | 12 + gcc/testsuite/gcc.c-torture/execute/pr34154.c | 16 + gcc/testsuite/gcc.c-torture/execute/pr34176.c | 68 ++ gcc/testsuite/gcc.c-torture/execute/pr34415.c | 34 + gcc/testsuite/gcc.c-torture/execute/pr34456.c | 30 + gcc/testsuite/gcc.c-torture/execute/pr34768-1.c | 26 + gcc/testsuite/gcc.c-torture/execute/pr34768-2.c | 28 + gcc/testsuite/gcc.c-torture/execute/pr34971.c | 22 + gcc/testsuite/gcc.c-torture/execute/pr34982.c | 15 + gcc/testsuite/gcc.c-torture/execute/pr35163.c | 15 + gcc/testsuite/gcc.c-torture/execute/pr35231.c | 16 + gcc/testsuite/gcc.c-torture/execute/pr35390.c | 13 + gcc/testsuite/gcc.c-torture/execute/pr35456.c | 21 + gcc/testsuite/gcc.c-torture/execute/pr35456.x | 3 + gcc/testsuite/gcc.c-torture/execute/pr35472.c | 22 + gcc/testsuite/gcc.c-torture/execute/pr35800.c | 103 +++ gcc/testsuite/gcc.c-torture/execute/pr36034-1.c | 32 + gcc/testsuite/gcc.c-torture/execute/pr36034-2.c | 32 + gcc/testsuite/gcc.c-torture/execute/pr36038.c | 43 ++ gcc/testsuite/gcc.c-torture/execute/pr36077.c | 13 + gcc/testsuite/gcc.c-torture/execute/pr36093.c | 28 + gcc/testsuite/gcc.c-torture/execute/pr36321.c | 26 + gcc/testsuite/gcc.c-torture/execute/pr36339.c | 32 + gcc/testsuite/gcc.c-torture/execute/pr36343.c | 32 + gcc/testsuite/gcc.c-torture/execute/pr36691.c | 17 + gcc/testsuite/gcc.c-torture/execute/pr36765.c | 15 + gcc/testsuite/gcc.c-torture/execute/pr37102.c | 25 + gcc/testsuite/gcc.c-torture/execute/pr37125.c | 23 + gcc/testsuite/gcc.c-torture/execute/pr37573.c | 65 ++ gcc/testsuite/gcc.c-torture/execute/pr37573.x | 7 + gcc/testsuite/gcc.c-torture/execute/pr37882.c | 15 + gcc/testsuite/gcc.c-torture/execute/pr37924.c | 50 ++ gcc/testsuite/gcc.c-torture/execute/pr37931.c | 23 + gcc/testsuite/gcc.c-torture/execute/pr38048-1.c | 22 + gcc/testsuite/gcc.c-torture/execute/pr38048-2.c | 28 + gcc/testsuite/gcc.c-torture/execute/pr38051.c | 215 ++++++ gcc/testsuite/gcc.c-torture/execute/pr38151.c | 46 ++ gcc/testsuite/gcc.c-torture/execute/pr38151.x | 2 + gcc/testsuite/gcc.c-torture/execute/pr38212.c | 22 + gcc/testsuite/gcc.c-torture/execute/pr38236.c | 22 + gcc/testsuite/gcc.c-torture/execute/pr38422.c | 24 + gcc/testsuite/gcc.c-torture/execute/pr38533.c | 21 + gcc/testsuite/gcc.c-torture/execute/pr38819.c | 29 + gcc/testsuite/gcc.c-torture/execute/pr38969.c | 25 + gcc/testsuite/gcc.c-torture/execute/pr39100.c | 65 ++ gcc/testsuite/gcc.c-torture/execute/pr39120.c | 18 + gcc/testsuite/gcc.c-torture/execute/pr39228.c | 36 + gcc/testsuite/gcc.c-torture/execute/pr39228.x | 10 + gcc/testsuite/gcc.c-torture/execute/pr39233.c | 18 + gcc/testsuite/gcc.c-torture/execute/pr39240.c | 105 +++ gcc/testsuite/gcc.c-torture/execute/pr39339.c | 81 +++ gcc/testsuite/gcc.c-torture/execute/pr39501.c | 83 +++ gcc/testsuite/gcc.c-torture/execute/pr39501.x | 2 + gcc/testsuite/gcc.c-torture/execute/pr40022.c | 51 ++ gcc/testsuite/gcc.c-torture/execute/pr40057.c | 37 + gcc/testsuite/gcc.c-torture/execute/pr40386.c | 99 +++ gcc/testsuite/gcc.c-torture/execute/pr40386.x | 2 + gcc/testsuite/gcc.c-torture/execute/pr40404.c | 19 + gcc/testsuite/gcc.c-torture/execute/pr40493.c | 82 +++ gcc/testsuite/gcc.c-torture/execute/pr40579.c | 28 + gcc/testsuite/gcc.c-torture/execute/pr40657.c | 23 + gcc/testsuite/gcc.c-torture/execute/pr40668.c | 40 ++ gcc/testsuite/gcc.c-torture/execute/pr40747.c | 22 + gcc/testsuite/gcc.c-torture/execute/pr41239.c | 67 ++ gcc/testsuite/gcc.c-torture/execute/pr41317.c | 28 + gcc/testsuite/gcc.c-torture/execute/pr41395-1.c | 28 + gcc/testsuite/gcc.c-torture/execute/pr41395-2.c | 35 + gcc/testsuite/gcc.c-torture/execute/pr41463.c | 56 ++ gcc/testsuite/gcc.c-torture/execute/pr41750.c | 68 ++ gcc/testsuite/gcc.c-torture/execute/pr41917.c | 21 + gcc/testsuite/gcc.c-torture/execute/pr41919.c | 39 ++ gcc/testsuite/gcc.c-torture/execute/pr41935.c | 25 + gcc/testsuite/gcc.c-torture/execute/pr42006.c | 33 + gcc/testsuite/gcc.c-torture/execute/pr42142.c | 26 + gcc/testsuite/gcc.c-torture/execute/pr42154.c | 18 + gcc/testsuite/gcc.c-torture/execute/pr42231.c | 35 + gcc/testsuite/gcc.c-torture/execute/pr42248.c | 27 + gcc/testsuite/gcc.c-torture/execute/pr42269-2.c | 15 + gcc/testsuite/gcc.c-torture/execute/pr42512.c | 13 + gcc/testsuite/gcc.c-torture/execute/pr42544.c | 14 + gcc/testsuite/gcc.c-torture/execute/pr42570.c | 9 + gcc/testsuite/gcc.c-torture/execute/pr42614.c | 68 ++ gcc/testsuite/gcc.c-torture/execute/pr42691.c | 41 ++ gcc/testsuite/gcc.c-torture/execute/pr42721.c | 21 + gcc/testsuite/gcc.c-torture/execute/pr42833.c | 171 +++++ gcc/testsuite/gcc.c-torture/execute/pr43008.c | 23 + gcc/testsuite/gcc.c-torture/execute/pr43220.c | 28 + gcc/testsuite/gcc.c-torture/execute/pr43236.c | 32 + gcc/testsuite/gcc.c-torture/execute/pr43269.c | 31 + gcc/testsuite/gcc.c-torture/execute/pr43385.c | 59 ++ gcc/testsuite/gcc.c-torture/execute/pr43438.c | 23 + gcc/testsuite/gcc.c-torture/execute/pr43560.c | 28 + gcc/testsuite/gcc.c-torture/execute/pr43629.c | 13 + gcc/testsuite/gcc.c-torture/execute/pr43783.c | 21 + gcc/testsuite/gcc.c-torture/execute/pr43784.c | 33 + gcc/testsuite/gcc.c-torture/execute/pr43835.c | 51 ++ gcc/testsuite/gcc.c-torture/execute/pr43987.c | 20 + gcc/testsuite/gcc.c-torture/execute/pr44164.c | 24 + gcc/testsuite/gcc.c-torture/execute/pr44202-1.c | 30 + gcc/testsuite/gcc.c-torture/execute/pr44468.c | 60 ++ gcc/testsuite/gcc.c-torture/execute/pr44555.c | 16 + gcc/testsuite/gcc.c-torture/execute/pr44575.c | 49 ++ gcc/testsuite/gcc.c-torture/execute/pr44683.c | 18 + gcc/testsuite/gcc.c-torture/execute/pr44683.x | 6 + gcc/testsuite/gcc.c-torture/execute/pr44828.c | 19 + gcc/testsuite/gcc.c-torture/execute/pr44852.c | 22 + gcc/testsuite/gcc.c-torture/execute/pr44858.c | 28 + gcc/testsuite/gcc.c-torture/execute/pr44942.c | 70 ++ gcc/testsuite/gcc.c-torture/execute/pr45034.c | 45 ++ gcc/testsuite/gcc.c-torture/execute/pr45070.c | 52 ++ gcc/testsuite/gcc.c-torture/execute/pr45262.c | 33 + gcc/testsuite/gcc.c-torture/execute/pr45695.c | 32 + gcc/testsuite/gcc.c-torture/execute/pr45830.c | 97 +++ gcc/testsuite/gcc.c-torture/execute/pr46019.c | 14 + gcc/testsuite/gcc.c-torture/execute/pr46316.c | 17 + gcc/testsuite/gcc.c-torture/execute/pr46909-1.c | 22 + gcc/testsuite/gcc.c-torture/execute/pr46909-2.c | 22 + gcc/testsuite/gcc.c-torture/execute/pr47148.c | 32 + gcc/testsuite/gcc.c-torture/execute/pr47155.c | 14 + gcc/testsuite/gcc.c-torture/execute/pr47237.c | 22 + gcc/testsuite/gcc.c-torture/execute/pr47299.c | 17 + gcc/testsuite/gcc.c-torture/execute/pr47337.c | 86 +++ gcc/testsuite/gcc.c-torture/execute/pr47538.c | 73 ++ gcc/testsuite/gcc.c-torture/execute/pr47925.c | 24 + gcc/testsuite/gcc.c-torture/execute/pr48197.c | 25 + gcc/testsuite/gcc.c-torture/execute/pr48717.c | 26 + gcc/testsuite/gcc.c-torture/execute/pr48809.c | 60 ++ gcc/testsuite/gcc.c-torture/execute/pr48973-1.c | 20 + gcc/testsuite/gcc.c-torture/execute/pr48973-2.c | 14 + gcc/testsuite/gcc.c-torture/execute/pr49039.c | 26 + gcc/testsuite/gcc.c-torture/execute/pr49073.c | 26 + gcc/testsuite/gcc.c-torture/execute/pr49123.c | 14 + gcc/testsuite/gcc.c-torture/execute/pr49161.c | 46 ++ gcc/testsuite/gcc.c-torture/execute/pr49186.c | 15 + gcc/testsuite/gcc.c-torture/execute/pr49218.c | 20 + gcc/testsuite/gcc.c-torture/execute/pr49279.c | 35 + gcc/testsuite/gcc.c-torture/execute/pr49390.c | 88 +++ gcc/testsuite/gcc.c-torture/execute/pr49419.c | 38 + gcc/testsuite/gcc.c-torture/execute/pr49644.c | 16 + gcc/testsuite/gcc.c-torture/execute/pr49768.c | 12 + gcc/testsuite/gcc.c-torture/execute/pr51323.c | 35 + gcc/testsuite/gcc.c-torture/execute/pr51466.c | 43 ++ gcc/testsuite/gcc.c-torture/execute/pr52129.c | 28 + gcc/testsuite/gcc.c-torture/execute/pr52286.c | 20 + gcc/testsuite/gcc.c-torture/execute/pr53084.c | 18 + gcc/testsuite/gcc.c-torture/execute/pr7284-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/pr7284-1.x | 7 + gcc/testsuite/gcc.c-torture/execute/printf-1.c | 23 + gcc/testsuite/gcc.c-torture/execute/printf-chk-1.c | 49 ++ gcc/testsuite/gcc.c-torture/execute/pta-field-1.c | 29 + gcc/testsuite/gcc.c-torture/execute/pta-field-2.c | 29 + gcc/testsuite/gcc.c-torture/execute/ptr-arith-1.c | 14 + gcc/testsuite/gcc.c-torture/execute/pure-1.c | 91 +++ .../gcc.c-torture/execute/pushpop_macro.c | 15 + gcc/testsuite/gcc.c-torture/execute/regstack-1.c | 26 + gcc/testsuite/gcc.c-torture/execute/restrict-1.c | 30 + gcc/testsuite/gcc.c-torture/execute/scope-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/shiftdi.c | 20 + gcc/testsuite/gcc.c-torture/execute/shiftdi.x | 7 + gcc/testsuite/gcc.c-torture/execute/shiftopt-1.c | 67 ++ gcc/testsuite/gcc.c-torture/execute/simd-1.c | 74 ++ gcc/testsuite/gcc.c-torture/execute/simd-2.c | 72 ++ gcc/testsuite/gcc.c-torture/execute/simd-4.c | 20 + gcc/testsuite/gcc.c-torture/execute/simd-4.x | 7 + gcc/testsuite/gcc.c-torture/execute/simd-5.c | 59 ++ gcc/testsuite/gcc.c-torture/execute/simd-6.c | 22 + gcc/testsuite/gcc.c-torture/execute/stdarg-1.c | 156 +++++ gcc/testsuite/gcc.c-torture/execute/stdarg-2.c | 180 +++++ gcc/testsuite/gcc.c-torture/execute/stdarg-3.c | 166 +++++ gcc/testsuite/gcc.c-torture/execute/stdarg-4.c | 137 ++++ gcc/testsuite/gcc.c-torture/execute/strcmp-1.c | 131 ++++ gcc/testsuite/gcc.c-torture/execute/strcpy-1.c | 75 ++ gcc/testsuite/gcc.c-torture/execute/strct-pack-1.c | 25 + gcc/testsuite/gcc.c-torture/execute/strct-pack-2.c | 13 + gcc/testsuite/gcc.c-torture/execute/strct-pack-3.c | 28 + gcc/testsuite/gcc.c-torture/execute/strct-pack-4.c | 29 + .../gcc.c-torture/execute/strct-stdarg-1.c | 61 ++ gcc/testsuite/gcc.c-torture/execute/strct-varg-1.c | 42 ++ .../gcc.c-torture/execute/string-opt-17.c | 45 ++ .../gcc.c-torture/execute/string-opt-18.c | 76 ++ gcc/testsuite/gcc.c-torture/execute/string-opt-5.c | 107 +++ gcc/testsuite/gcc.c-torture/execute/strlen-1.c | 57 ++ gcc/testsuite/gcc.c-torture/execute/strncmp-1.c | 140 ++++ gcc/testsuite/gcc.c-torture/execute/strncmp-1.x | 16 + .../gcc.c-torture/execute/struct-aliasing-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/struct-cpy-1.c | 43 ++ gcc/testsuite/gcc.c-torture/execute/struct-ini-1.c | 15 + gcc/testsuite/gcc.c-torture/execute/struct-ini-2.c | 17 + gcc/testsuite/gcc.c-torture/execute/struct-ini-3.c | 11 + gcc/testsuite/gcc.c-torture/execute/struct-ini-4.c | 15 + gcc/testsuite/gcc.c-torture/execute/struct-ret-1.c | 57 ++ gcc/testsuite/gcc.c-torture/execute/struct-ret-2.c | 29 + gcc/testsuite/gcc.c-torture/execute/switch-1.c | 57 ++ gcc/testsuite/gcc.c-torture/execute/tstdi-1.c | 139 ++++ gcc/testsuite/gcc.c-torture/execute/unroll-1.c | 19 + gcc/testsuite/gcc.c-torture/execute/usmul.c | 33 + gcc/testsuite/gcc.c-torture/execute/usmul.x | 7 + gcc/testsuite/gcc.c-torture/execute/va-arg-1.c | 24 + gcc/testsuite/gcc.c-torture/execute/va-arg-10.c | 248 +++++++ gcc/testsuite/gcc.c-torture/execute/va-arg-11.c | 29 + gcc/testsuite/gcc.c-torture/execute/va-arg-12.c | 25 + gcc/testsuite/gcc.c-torture/execute/va-arg-13.c | 38 + gcc/testsuite/gcc.c-torture/execute/va-arg-14.c | 45 ++ gcc/testsuite/gcc.c-torture/execute/va-arg-15.c | 44 ++ gcc/testsuite/gcc.c-torture/execute/va-arg-16.c | 41 ++ gcc/testsuite/gcc.c-torture/execute/va-arg-17.c | 37 + gcc/testsuite/gcc.c-torture/execute/va-arg-18.c | 24 + gcc/testsuite/gcc.c-torture/execute/va-arg-19.c | 37 + gcc/testsuite/gcc.c-torture/execute/va-arg-2.c | 292 ++++++++ gcc/testsuite/gcc.c-torture/execute/va-arg-20.c | 22 + gcc/testsuite/gcc.c-torture/execute/va-arg-21.c | 48 ++ gcc/testsuite/gcc.c-torture/execute/va-arg-22.c | 78 +++ gcc/testsuite/gcc.c-torture/execute/va-arg-23.c | 26 + gcc/testsuite/gcc.c-torture/execute/va-arg-24.c | 96 +++ gcc/testsuite/gcc.c-torture/execute/va-arg-26.c | 20 + gcc/testsuite/gcc.c-torture/execute/va-arg-4.c | 33 + gcc/testsuite/gcc.c-torture/execute/va-arg-5.c | 44 ++ gcc/testsuite/gcc.c-torture/execute/va-arg-6.c | 35 + gcc/testsuite/gcc.c-torture/execute/va-arg-7.c | 31 + gcc/testsuite/gcc.c-torture/execute/va-arg-8.c | 41 ++ gcc/testsuite/gcc.c-torture/execute/va-arg-9.c | 236 +++++++ .../gcc.c-torture/execute/va-arg-pack-1.c | 143 ++++ .../gcc.c-torture/execute/va-arg-trap-1.c | 36 + gcc/testsuite/gcc.c-torture/execute/vector-shift.c | 48 ++ .../gcc.c-torture/execute/vector-shift1.c | 17 + .../gcc.c-torture/execute/vector-shift2.c | 59 ++ .../gcc.c-torture/execute/vector-subscript-1.c | 60 ++ .../gcc.c-torture/execute/vector-subscript-2.c | 67 ++ .../gcc.c-torture/execute/vector-subscript-3.c | 26 + gcc/testsuite/gcc.c-torture/execute/vfprintf-1.c | 53 ++ .../gcc.c-torture/execute/vfprintf-chk-1.c | 73 ++ .../gcc.c-torture/execute/vla-dealloc-1.c | 28 + gcc/testsuite/gcc.c-torture/execute/vprintf-1.c | 53 ++ .../gcc.c-torture/execute/vprintf-chk-1.c | 73 ++ gcc/testsuite/gcc.c-torture/execute/vrp-1.c | 20 + gcc/testsuite/gcc.c-torture/execute/vrp-2.c | 19 + gcc/testsuite/gcc.c-torture/execute/vrp-3.c | 21 + gcc/testsuite/gcc.c-torture/execute/vrp-4.c | 20 + gcc/testsuite/gcc.c-torture/execute/vrp-5.c | 22 + gcc/testsuite/gcc.c-torture/execute/vrp-5.x | 7 + gcc/testsuite/gcc.c-torture/execute/vrp-6.c | 33 + gcc/testsuite/gcc.c-torture/execute/vrp-6.x | 7 + gcc/testsuite/gcc.c-torture/execute/vrp-7.c | 20 + gcc/testsuite/gcc.c-torture/execute/wchar_t-1.c | 17 + gcc/testsuite/gcc.c-torture/execute/widechar-1.c | 14 + gcc/testsuite/gcc.c-torture/execute/widechar-2.c | 11 + .../gcc.c-torture/execute/zero-struct-1.c | 23 + .../gcc.c-torture/execute/zero-struct-2.c | 20 + gcc/testsuite/gcc.c-torture/execute/zerolen-1.c | 32 + gcc/testsuite/gcc.c-torture/execute/zerolen-2.c | 18 + gcc/testsuite/gcc.c-torture/unsorted/386.c | 23 + gcc/testsuite/gcc.c-torture/unsorted/86.c | 19 + gcc/testsuite/gcc.c-torture/unsorted/BUG1.c | 37 + gcc/testsuite/gcc.c-torture/unsorted/BUG11.c | 29 + gcc/testsuite/gcc.c-torture/unsorted/BUG12.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/BUG13.c | 19 + gcc/testsuite/gcc.c-torture/unsorted/BUG16.c | 6 + gcc/testsuite/gcc.c-torture/unsorted/BUG17.c | 8 + gcc/testsuite/gcc.c-torture/unsorted/BUG18.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/BUG2.c | 8 + gcc/testsuite/gcc.c-torture/unsorted/BUG21.c | 22 + gcc/testsuite/gcc.c-torture/unsorted/BUG22.c | 6 + gcc/testsuite/gcc.c-torture/unsorted/BUG23.c | 18 + gcc/testsuite/gcc.c-torture/unsorted/BUG24.c | 15 + gcc/testsuite/gcc.c-torture/unsorted/BUG25.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/BUG3.c | 8 + gcc/testsuite/gcc.c-torture/unsorted/BUG4.c | 20 + gcc/testsuite/gcc.c-torture/unsorted/BUG5.c | 18 + gcc/testsuite/gcc.c-torture/unsorted/BUG6.c | 8 + gcc/testsuite/gcc.c-torture/unsorted/DFcmp.c | 280 ++++++++ gcc/testsuite/gcc.c-torture/unsorted/HIcmp.c | 280 ++++++++ gcc/testsuite/gcc.c-torture/unsorted/HIset.c | 216 ++++++ gcc/testsuite/gcc.c-torture/unsorted/PYRBUG.c | 17 + gcc/testsuite/gcc.c-torture/unsorted/QIcmp.c | 280 ++++++++ gcc/testsuite/gcc.c-torture/unsorted/QIset.c | 216 ++++++ gcc/testsuite/gcc.c-torture/unsorted/SFset.c | 216 ++++++ gcc/testsuite/gcc.c-torture/unsorted/SIcmp.c | 280 ++++++++ gcc/testsuite/gcc.c-torture/unsorted/SIset.c | 216 ++++++ gcc/testsuite/gcc.c-torture/unsorted/UHIcmp.c | 280 ++++++++ gcc/testsuite/gcc.c-torture/unsorted/UQIcmp.c | 280 ++++++++ gcc/testsuite/gcc.c-torture/unsorted/USIcmp.c | 280 ++++++++ gcc/testsuite/gcc.c-torture/unsorted/a.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/a1.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/a3.c | 12 + gcc/testsuite/gcc.c-torture/unsorted/aa.c | 8 + gcc/testsuite/gcc.c-torture/unsorted/aaa.c | 11 + gcc/testsuite/gcc.c-torture/unsorted/abs.c | 9 + gcc/testsuite/gcc.c-torture/unsorted/ac.c | 30 + gcc/testsuite/gcc.c-torture/unsorted/acc.c | 8 + gcc/testsuite/gcc.c-torture/unsorted/add.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/add386.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/addcc.c | 18 + gcc/testsuite/gcc.c-torture/unsorted/andm.c | 15 + gcc/testsuite/gcc.c-torture/unsorted/andmem.c | 22 + gcc/testsuite/gcc.c-torture/unsorted/andn.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/andok.c | 6 + gcc/testsuite/gcc.c-torture/unsorted/andsi.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/andsparc.c | 11 + gcc/testsuite/gcc.c-torture/unsorted/aos.c | 8 + gcc/testsuite/gcc.c-torture/unsorted/arr.c | 9 + gcc/testsuite/gcc.c-torture/unsorted/as.c | 14 + gcc/testsuite/gcc.c-torture/unsorted/ase.c | 10 + gcc/testsuite/gcc.c-torture/unsorted/b.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/b1.c | 11 + gcc/testsuite/gcc.c-torture/unsorted/b2.c | 24 + gcc/testsuite/gcc.c-torture/unsorted/b3.c | 12 + gcc/testsuite/gcc.c-torture/unsorted/b88.c | 12 + gcc/testsuite/gcc.c-torture/unsorted/bad.c | 26 + gcc/testsuite/gcc.c-torture/unsorted/band.c | 16 + gcc/testsuite/gcc.c-torture/unsorted/bb0.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/bb1.c | 8 + gcc/testsuite/gcc.c-torture/unsorted/bbb.c | 12 + gcc/testsuite/gcc.c-torture/unsorted/bc.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/bcopy.c | 68 ++ gcc/testsuite/gcc.c-torture/unsorted/bf.c | 31 + gcc/testsuite/gcc.c-torture/unsorted/bfins.c | 15 + gcc/testsuite/gcc.c-torture/unsorted/bfx.c | 9 + gcc/testsuite/gcc.c-torture/unsorted/bge.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/bit.c | 13 + gcc/testsuite/gcc.c-torture/unsorted/bitf.c | 17 + gcc/testsuite/gcc.c-torture/unsorted/bitw.c | 9 + gcc/testsuite/gcc.c-torture/unsorted/blk.c | 18 + gcc/testsuite/gcc.c-torture/unsorted/bt.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/bt386.c | 18 + gcc/testsuite/gcc.c-torture/unsorted/bug.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/bugc.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/buns.c | 12 + gcc/testsuite/gcc.c-torture/unsorted/bx.c | 12 + gcc/testsuite/gcc.c-torture/unsorted/c.c | 17 + gcc/testsuite/gcc.c-torture/unsorted/c1.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/c2.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/call.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/call386.c | 20 + gcc/testsuite/gcc.c-torture/unsorted/callind.c | 8 + gcc/testsuite/gcc.c-torture/unsorted/cc.c | 96 +++ gcc/testsuite/gcc.c-torture/unsorted/charmtst.c | 15 + gcc/testsuite/gcc.c-torture/unsorted/cmb.c | 6 + gcc/testsuite/gcc.c-torture/unsorted/cmp.c | 11 + gcc/testsuite/gcc.c-torture/unsorted/cmphi.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/cmpsi386.c | 14 + gcc/testsuite/gcc.c-torture/unsorted/cmul.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/cn1.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/comb.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/consec.c | 17 + gcc/testsuite/gcc.c-torture/unsorted/const.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/conv.c | 32 + gcc/testsuite/gcc.c-torture/unsorted/conv_tst.c | 66 ++ gcc/testsuite/gcc.c-torture/unsorted/cp.c | 42 ++ gcc/testsuite/gcc.c-torture/unsorted/csebug.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/cvt.c | 9 + gcc/testsuite/gcc.c-torture/unsorted/d.c | 19 + gcc/testsuite/gcc.c-torture/unsorted/dbl_parm.c | 10 + gcc/testsuite/gcc.c-torture/unsorted/dblbug.c | 21 + gcc/testsuite/gcc.c-torture/unsorted/ddd.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/dead.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/delay.c | 11 + gcc/testsuite/gcc.c-torture/unsorted/di.c | 12 + gcc/testsuite/gcc.c-torture/unsorted/dic.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/dilayout.c | 33 + gcc/testsuite/gcc.c-torture/unsorted/dimove.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/dimul.c | 6 + gcc/testsuite/gcc.c-torture/unsorted/div.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/divdf.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/dm.c | 24 + gcc/testsuite/gcc.c-torture/unsorted/dshift.c | 10 + gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.c | 59 ++ gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.x | 40 ++ gcc/testsuite/gcc.c-torture/unsorted/e.c | 10 + gcc/testsuite/gcc.c-torture/unsorted/ex.c | 11 + gcc/testsuite/gcc.c-torture/unsorted/ext.c | 23 + gcc/testsuite/gcc.c-torture/unsorted/f1.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/f2.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/fdmul.c | 2 + gcc/testsuite/gcc.c-torture/unsorted/flo.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/float.c | 6 + gcc/testsuite/gcc.c-torture/unsorted/flt_const.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/fnul.c | 23 + gcc/testsuite/gcc.c-torture/unsorted/foo.c | 8 + gcc/testsuite/gcc.c-torture/unsorted/forgetcc.c | 11 + gcc/testsuite/gcc.c-torture/unsorted/fq.c | 25 + gcc/testsuite/gcc.c-torture/unsorted/g.c | 9 + gcc/testsuite/gcc.c-torture/unsorted/gen_tst.c | 67 ++ gcc/testsuite/gcc.c-torture/unsorted/glob.c | 12 + gcc/testsuite/gcc.c-torture/unsorted/gronk.c | 8 + gcc/testsuite/gcc.c-torture/unsorted/hi.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/hibug.c | 15 + gcc/testsuite/gcc.c-torture/unsorted/i++.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/i.c | 8 + gcc/testsuite/gcc.c-torture/unsorted/ic.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/icmp.c | 10 + gcc/testsuite/gcc.c-torture/unsorted/ifreg.c | 12 + gcc/testsuite/gcc.c-torture/unsorted/imm.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/isinf.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/jmp.c | 20 + gcc/testsuite/gcc.c-torture/unsorted/jumptab.c | 20 + gcc/testsuite/gcc.c-torture/unsorted/l.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/layout.c | 13 + gcc/testsuite/gcc.c-torture/unsorted/lbug.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/ll1.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/llbug.c | 13 + gcc/testsuite/gcc.c-torture/unsorted/lll.c | 45 ++ gcc/testsuite/gcc.c-torture/unsorted/load8.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/loadhicc.c | 15 + gcc/testsuite/gcc.c-torture/unsorted/log2.c | 6 + gcc/testsuite/gcc.c-torture/unsorted/logic.c | 37 + gcc/testsuite/gcc.c-torture/unsorted/loop-1.c | 11 + gcc/testsuite/gcc.c-torture/unsorted/loop386.c | 15 + gcc/testsuite/gcc.c-torture/unsorted/lop.c | 6 + gcc/testsuite/gcc.c-torture/unsorted/m1.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/m2.c | 44 ++ gcc/testsuite/gcc.c-torture/unsorted/m5.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/m68.c | 14 + gcc/testsuite/gcc.c-torture/unsorted/mbyte.c | 14 + gcc/testsuite/gcc.c-torture/unsorted/mchar.c | 11 + gcc/testsuite/gcc.c-torture/unsorted/mcmp.c | 9 + gcc/testsuite/gcc.c-torture/unsorted/mdouble.c | 6 + gcc/testsuite/gcc.c-torture/unsorted/memtst.c | 26 + gcc/testsuite/gcc.c-torture/unsorted/miscomp.c | 15 + gcc/testsuite/gcc.c-torture/unsorted/mm.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/mod.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/modcc.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/move.c | 9 + gcc/testsuite/gcc.c-torture/unsorted/move_qhi.c | 12 + gcc/testsuite/gcc.c-torture/unsorted/mregtst.c | 17 + gcc/testsuite/gcc.c-torture/unsorted/msp.c | 10 + gcc/testsuite/gcc.c-torture/unsorted/mtst.c | 17 + gcc/testsuite/gcc.c-torture/unsorted/mu.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/mul.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/mword.c | 29 + gcc/testsuite/gcc.c-torture/unsorted/mword1.c | 12 + gcc/testsuite/gcc.c-torture/unsorted/n.c | 6 + gcc/testsuite/gcc.c-torture/unsorted/n1.c | 10 + gcc/testsuite/gcc.c-torture/unsorted/nand.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/neg.c | 1 + gcc/testsuite/gcc.c-torture/unsorted/o.c | 12 + gcc/testsuite/gcc.c-torture/unsorted/omit.c | 11 + gcc/testsuite/gcc.c-torture/unsorted/opout.c | 10 + gcc/testsuite/gcc.c-torture/unsorted/opt.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/or.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/or386.c | 13 + gcc/testsuite/gcc.c-torture/unsorted/p.c | 6 + gcc/testsuite/gcc.c-torture/unsorted/parms.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/pass.c | 13 + gcc/testsuite/gcc.c-torture/unsorted/pmt.c | 6 + gcc/testsuite/gcc.c-torture/unsorted/poor.c | 34 + gcc/testsuite/gcc.c-torture/unsorted/pp.c | 9 + gcc/testsuite/gcc.c-torture/unsorted/pret-arg.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/pyr.c | 11 + gcc/testsuite/gcc.c-torture/unsorted/pyr2.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/q.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/r.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/r1.c | 29 + gcc/testsuite/gcc.c-torture/unsorted/rel.c | 8 + gcc/testsuite/gcc.c-torture/unsorted/rmsc.c | 46 ++ gcc/testsuite/gcc.c-torture/unsorted/round.c | 13 + gcc/testsuite/gcc.c-torture/unsorted/run.c | 11 + gcc/testsuite/gcc.c-torture/unsorted/s.c | 24 + gcc/testsuite/gcc.c-torture/unsorted/sar.c | 10 + gcc/testsuite/gcc.c-torture/unsorted/sc.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/scal.c | 19 + gcc/testsuite/gcc.c-torture/unsorted/scc.c | 11 + gcc/testsuite/gcc.c-torture/unsorted/scond.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/selfrec.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/seq.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/set386.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/set88.c | 9 + gcc/testsuite/gcc.c-torture/unsorted/sh.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/shand.c | 11 + gcc/testsuite/gcc.c-torture/unsorted/shft.c | 15 + gcc/testsuite/gcc.c-torture/unsorted/shift.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/shloop.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/shm.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/signext.c | 27 + gcc/testsuite/gcc.c-torture/unsorted/signext2.c | 11 + gcc/testsuite/gcc.c-torture/unsorted/sim.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/simple.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/sne.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/sound.c | 13 + gcc/testsuite/gcc.c-torture/unsorted/sparcbug.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/speed.c | 8 + gcc/testsuite/gcc.c-torture/unsorted/stor.c | 12 + gcc/testsuite/gcc.c-torture/unsorted/store0.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/storecc.c | 6 + gcc/testsuite/gcc.c-torture/unsorted/str.c | 13 + gcc/testsuite/gcc.c-torture/unsorted/stru.c | 9 + gcc/testsuite/gcc.c-torture/unsorted/structret.c | 69 ++ gcc/testsuite/gcc.c-torture/unsorted/stuct.c | 22 + gcc/testsuite/gcc.c-torture/unsorted/sub32.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/subcc.c | 33 + gcc/testsuite/gcc.c-torture/unsorted/subcse.c | 6 + gcc/testsuite/gcc.c-torture/unsorted/sym.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/symconst.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/t.c | 18 + gcc/testsuite/gcc.c-torture/unsorted/test-flow.c | 12 + gcc/testsuite/gcc.c-torture/unsorted/test-loop.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/test.c | 6 + gcc/testsuite/gcc.c-torture/unsorted/time.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/tmp.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/trivial.c | 1 + gcc/testsuite/gcc.c-torture/unsorted/trunc.c | 11 + gcc/testsuite/gcc.c-torture/unsorted/u.c | 1 + gcc/testsuite/gcc.c-torture/unsorted/udconvert.c | 30 + gcc/testsuite/gcc.c-torture/unsorted/udivmod4.c | 56 ++ gcc/testsuite/gcc.c-torture/unsorted/uns.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/uns_tst.c | 19 + gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp | 60 ++ gcc/testsuite/gcc.c-torture/unsorted/uuarg.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/v.c | 11 + gcc/testsuite/gcc.c-torture/unsorted/w.c | 1 + gcc/testsuite/gcc.c-torture/unsorted/ww.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/x.c | 1 + gcc/testsuite/gcc.c-torture/unsorted/xb.c | 17 + gcc/testsuite/gcc.c-torture/unsorted/xbg.c | 14 + gcc/testsuite/gcc.c-torture/unsorted/xc.c | 11 + gcc/testsuite/gcc.c-torture/unsorted/xcsebug.c | 14 + gcc/testsuite/gcc.c-torture/unsorted/xdi.c | 15 + gcc/testsuite/gcc.c-torture/unsorted/xfoo.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/xi.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/xlop.c | 11 + gcc/testsuite/gcc.c-torture/unsorted/xmtst.c | 26 + gcc/testsuite/gcc.c-torture/unsorted/xneg.c | 5 + gcc/testsuite/gcc.c-torture/unsorted/xopt.c | 35 + gcc/testsuite/gcc.c-torture/unsorted/xor.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/xorn.c | 31 + gcc/testsuite/gcc.c-torture/unsorted/xp.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/xpp.c | 12 + gcc/testsuite/gcc.c-torture/unsorted/xs.c | 9 + gcc/testsuite/gcc.c-torture/unsorted/xsh.c | 7 + gcc/testsuite/gcc.c-torture/unsorted/xz.c | 4 + gcc/testsuite/gcc.c-torture/unsorted/xzz.c | 4 + 2935 files changed, 90783 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/ChangeLog.0 create mode 100644 gcc/testsuite/gcc.c-torture/compat/strct-layout.c create mode 100644 gcc/testsuite/gcc.c-torture/compat/struct-align.c create mode 100644 gcc/testsuite/gcc.c-torture/compat/struct-big.c create mode 100644 gcc/testsuite/gcc.c-torture/compat/struct-i.c create mode 100644 gcc/testsuite/gcc.c-torture/compat/struct-ic.c create mode 100644 gcc/testsuite/gcc.c-torture/compat/struct-ii.c create mode 100644 gcc/testsuite/gcc.c-torture/compat/struct-ret-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000105-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000105-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000120-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000120-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000127-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000211-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000211-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000224-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000314-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000314-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000319-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000326-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000326-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000329-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000403-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000403-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000405-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000405-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000405-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000412-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000412-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000420-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000420-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000427-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000502-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000504-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000511-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000517-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000518-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000523-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000605-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000606-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000609-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000629-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000701-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000717-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000718.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000728-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000802-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000803-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000804-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000818-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000825-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000827-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000922-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20000923-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20001018-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20001024-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20001109-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20001109-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20001116-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20001121-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20001123-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20001123-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20001205-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20001212-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20001221-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20001222-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20001226-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/200031109-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010102-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010107-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010112-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010113-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010114-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010114-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010117-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010117-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010118-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010124-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010202-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010209-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010226-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010227-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010313-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010320-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010326-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010327-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010328-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010329-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010404-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010408-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010421-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010423-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010426-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010503-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010510-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010518-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010518-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010525-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010605-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010605-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010605-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010610-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010611-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010701-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010706-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010711-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010711-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010714-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010824-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010903-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010903-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010911-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20011010-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20011023-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20011029-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20011106-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20011106-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20011109-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20011114-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20011114-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20011114-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20011114-4.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20011119-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20011119-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20011130-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20011130-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20011205-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20011217-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20011217-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20011218-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20011219-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20011219-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20011229-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20011229-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020103-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020106-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020109-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020109-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020110.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020116-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020120-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020121-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020129-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020206-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020210-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020303-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020304-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020304-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020309-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020309-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020312-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020314-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020315-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020318-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020319-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020320-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020323-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020330-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020409-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020415-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020418-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020530-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020604-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020605-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020701-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020706-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020706-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020709-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020710-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020715-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020807-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020910-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020926-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020927-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20020930-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20021001-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20021007-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20021008-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20021015-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20021015-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20021103-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20021108-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20021110.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20021119-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20021120-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20021120-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20021124-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20021204-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20021205-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20021212-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20021230-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030109-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030110-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030125-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030206-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030216-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030219-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030220-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030224-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030305-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030310-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030314-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030319-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030320-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030323-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030330-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030331-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030405-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030410-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030415-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030416-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030418-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030503-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030518-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030530-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030530-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030604-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030605-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030612-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030624-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030703-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030704-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030707-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030708-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030716-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030725-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030804-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030821-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030823-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030902-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030903-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030904-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030907-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030910-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030917-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030921-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20031002-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20031010-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20031011-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20031011-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20031023-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20031023-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20031023-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20031023-4.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20031031-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20031031-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20031102-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20031112-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20031113-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20031124-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20031125-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20031125-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20031203-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20031203-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20031203-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20031208-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20031220-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20031220-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20031227-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20031231-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040101-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040109-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040121-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040124-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040130-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040202-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040209-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040214-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040214-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040216-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040219-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040220-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040303-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040303-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040304-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040309-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040310-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040317-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040317-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040317-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040323-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040401-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040415-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040415-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040419-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040602-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040610-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040611-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040614-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040621-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040624-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040705-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040708-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040709-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040726-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040726-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040727-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040730-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040817-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040824-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040901-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040907-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040908-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040909-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040914-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040916-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20041005-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20041007-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20041018-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20041026-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20041119-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20041211-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20050105-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20050113-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20050119-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20050122-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20050122-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20050202-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20050206-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20050210-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20050215-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20050215-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20050215-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20050217-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20050303-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20050328-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20050423-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20050510-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20050516-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20050520-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20050622-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20050721-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20050801-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20050801-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20051207-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20051216-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20051228-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20060109-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20060202-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20060208-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20060215-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20060217-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20060309-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20060419-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20060421-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20060609-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20060625-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20060823-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20060826-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20060904-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20061005-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20061214-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20070121.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20070129.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20070419-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20070501-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20070520-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20070522-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20070529-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20070529-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20070531-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20070531-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20070603-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20070603-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20070605-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20070827-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20070905-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20070906-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20070915-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20070919-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20071027-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20071102-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20071105-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20071107-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20071108-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20071114-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20071117-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20071118-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20071128-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20071203-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20071207-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20071214-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20080114-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20080124-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20080419-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20080613-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20080625-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20080628-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20080704-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20080721-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20080806-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20080812-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20080820-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20080903-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20080910-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20080922-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20080929-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20081101-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20081108-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20081108-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20081108-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20081119-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20081203-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20090107-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20090114-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20090209-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20090303-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20090303-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20090328-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20090331-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20090401-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20090518-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20090519-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20090721-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20090907-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20090917-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20091215-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20100609-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20100907.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20100915-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20101217-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20110126-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20110131-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20110906-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20110913-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20121107-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/900116-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/900216-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/900313-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/900407-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/900516-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920301-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920409-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920409-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920410-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920410-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920411-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920413-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920415-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920428-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920428-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920428-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920428-4.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920428-5.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920428-6.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920428-7.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920501-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920501-10.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920501-11.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920501-12.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920501-13.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920501-15.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920501-16.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920501-17.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920501-18.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920501-19.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920501-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920501-20.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920501-21.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920501-22.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920501-23.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920501-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920501-4.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920501-6.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920501-7.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920501-8.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920501-9.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920502-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920502-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920520-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920521-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920529-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920608-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920611-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920615-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920617-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920617-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920623-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920624-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920625-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920625-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920626-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920701-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920702-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920706-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920710-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920711-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920721-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920723-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920729-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920806-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920808-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920809-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920817-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920820-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920821-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920821-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920825-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920825-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920826-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920828-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920829-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920831-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920902-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920909-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920917-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920928-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920928-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920928-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920928-4.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920928-5.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/920928-6.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/921004-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/921011-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/921011-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/921012-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/921012-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/921013-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/921019-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/921021-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/921024-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/921026-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/921103-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/921109-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/921111-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/921116-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/921118-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/921126-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/921202-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/921202-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/921203-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/921203-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/921206-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/921227-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930109-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930109-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930111-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930117-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930118-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930120-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930126-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930210-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930217-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930222-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930325-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930326-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930411-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930421-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930427-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930503-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930503-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930506-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930506-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930510-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930513-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930513-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930513-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930523-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930525-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930527-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930529-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930530-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930602-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930603-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930607-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930611-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930618-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930621-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930623-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930702-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930926-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/930927-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/931003-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/931004-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/931013-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/931013-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/931013-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/931018-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/931031-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/931102-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/931102-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/931203-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/940611-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/940712-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/940718-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/941014-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/941014-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/941014-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/941014-4.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/941019-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/941111-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/941113-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/950122-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/950124-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/950221-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/950329-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/950512-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/950530-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/950607-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/950610-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/950612-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/950613-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/950618-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/950719-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/950729-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/950816-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/950816-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/950816-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/950910-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/950919-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/950921-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/950922-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/951004-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/951106-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/951116-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/951128-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/951220-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/951222-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/960106-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/960130-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/960201-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/960218-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/960220-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/960221-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/960319-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/960514-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/960704-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/960829-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/961004-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/961010-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/961019-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/961031-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/961126-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/961203-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/970206-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/970214-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/980329-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/980408-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/980504-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/980506-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/980506-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/980511-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/980701-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/980706-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/980726-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/980729-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/980816-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/980821-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/980825-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/981001-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/981001-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/981001-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/981001-4.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/981006-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/981007-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/981107-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/981223-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/990107-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/990117-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/990203-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/990517-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/990519-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/990523-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/990527-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/990617-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/990625-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/990625-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/990801-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/990801-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/990829-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/990913-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/990928-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/991008-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/991026-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/991026-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/991127-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/991202-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/991208-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/991213-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/991213-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/991213-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/991214-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/991214-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/991229-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/991229-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/991229-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/acc1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/asmgoto-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/bcopy-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/builtin_constant_p.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/builtin_unreachable-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/calls.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/cmpdi-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/combine-hang.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/compile.exp create mode 100644 gcc/testsuite/gcc.c-torture/compile/complex-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/complex-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/complex-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/complex-4.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/complex-5.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/complex-6.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/compound-literal-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/compound-literal-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/compound-literal-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/const-high-part.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/cpp-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/cpp-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/debugvlafunction-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/dll.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/fix-trunc-mem-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/funcptr-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/goto-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/iftrap-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/iftrap-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/iftrap-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/init-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/init-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/init-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/inline-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/labels-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/labels-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/labels-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/libcall-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/limits-blockid.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/limits-caselabels.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/limits-declparen.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/limits-enumconst.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/limits-exprparen.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/limits-externalid.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/limits-externdecl.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/limits-fnargs.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/limits-fndefn.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/limits-idexternal.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/limits-idinternal.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/limits-pointer.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/limits-stringlit.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/limits-structmem.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/limits-structnest.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/m68k-byte-addr.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/mangle-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/memcpy-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/memcpy-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/mipscop-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/mipscop-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/mipscop-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/mipscop-4.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/nested-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/nested-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/packed-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pc44485.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr12517.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr12578.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr12899.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr13066-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr13889.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr14692.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr14730.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr15245.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr16461.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr16566-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr16566-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr16566-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr16808.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr17119.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr17273.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr17397.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr17407.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr17408.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr17529.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr17558.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr17656.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr17906.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr17913.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr18291.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr18299-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr18712.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr18903.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr19080.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr19121.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr19357.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr19736.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr19853.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr20203.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr20412.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr20539-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr20583.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr20928.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr21021.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr21030.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr21293.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr21356.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr21380.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr21532.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr21562.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr21638.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr21728.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr21761.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr21839.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr21840.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr22013-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr22269.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr22379.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr22398.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr22422.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr22531.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr22589-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr23233-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr23237.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr23435.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr23445.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr23476.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr23929.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr23944.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr23946.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr23960.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr24227.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr24883.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr24930.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr25224.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr25310.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr25311.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr25483.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr25513.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr25514.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr25860.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr25861.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr26213.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr26255.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr26425.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr26622.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr26626.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr26725.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr26781-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr26781-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr26833.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr26840.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr27087.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr27282.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr27341-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr27341-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr27373.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr27528.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr27571.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr27863.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr27889.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr27907.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr28489.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr28675.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr28776-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr28776-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr28905.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr29128.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr29201.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr29241.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr29250.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr29945.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr30132.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr30311.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr30338.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr30433.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr30564-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr30564-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr30984.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr31034.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr31345-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr31541.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr31703.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr31710.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr31797.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr31953.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr32139.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr32169.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr32349.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr32355.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr32372.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr32399.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr32453.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr32482.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr32571.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr32584.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr32606.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr32780.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr32796.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr32919.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr32920.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr32988.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr33122.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr33133.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr33146.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr33166.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr33173.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr33382.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr33614.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr33617.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr33641.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr33855.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr34029-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr34029-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr34030.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr34091.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr34093.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr34113.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr34127.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr34138.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr34334.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr34448.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr34458.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr34648.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr34688.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr34808.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr34856.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr34885.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr34966.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr34993.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr35006.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr35043.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr35171.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr35318.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr35431.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr35432.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr35468.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr35492.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr35595.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr35607.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr35760.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr35869.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr36125.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr36141.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr36154.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr36172.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr36238.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr36245.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr36666.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr36817.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr36988.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37026.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37056.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37078.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37207.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37258.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37285.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37305.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37327.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37341.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37380.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37381.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37382.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37387.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37395.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37418-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37418-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37418-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37418-4.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37432.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37433.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37483.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37617.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37662.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37664.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37669-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37669.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37713.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37742-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37742.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37878.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37913.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37955.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37976.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37991.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr38123.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr38343-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr38343.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr38359.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr38360.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr38428.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr38505.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr38554.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr38564.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr38590-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr38590-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr38661-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr38661.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr38752.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr38771.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr38789.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr38807.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr38857.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr38926.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39041.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39202.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39360.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39394.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39614-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39614-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39614-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39614-4.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39614-5.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39636.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39648.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39673-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39673-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39779.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39824.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39834.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39845.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39886.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39928-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39928-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39937.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39941.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39943.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39983.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr39999.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr40023.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr40026.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr40035.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr40080.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr40204.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr40233.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr40252.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr40291.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr40321.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr40351.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr40432.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr40556.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr40570.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr40582.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr40640.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr40676.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr40692.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr40753.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr40964.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr41006-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr41006-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr41016.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr41101.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr41163.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr41181.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr41182-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr41282.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr41469.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr41634.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr41646.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr41661.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr41679.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr41728.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr41987.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr42025-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr42025-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr42049.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr42164.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr42196-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr42196-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr42196-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr42234.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr42237.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr42299.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr42347.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr42398.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr42559.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr42632.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr42703.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr42705.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr42708-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr42716.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr42717.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr42730.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr42749.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr42927.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr42956.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr42998.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr43066.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr43164.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr43186.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr43188.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr43191.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr43255.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr43288.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr43367.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr43415.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr43614.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr43635.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr43636.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr43661.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr43679.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr43791.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr43845.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr44030.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr44038.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr44043.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr44063.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr44119.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr44197.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr44246.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr44686.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr44687.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr44707.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr44784.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr44788.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr44831.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr44891.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr44937.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr44941.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr44946.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr44988.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr45047.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr45059.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr45085.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr45109.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr45182.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr45412.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr45535.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr45728.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr45771.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr45876.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr45919.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr45969-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr46002.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr46034.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr46107.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr46248.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr46360.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr46388.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr46461.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr46534.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr46547-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr46637.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr46832.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr46856.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr46866.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr46883.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr47140.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr47141.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr47150.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr47157.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr47265.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr47427.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr47428.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr47967.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr48161.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr48335-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr48517.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr48734.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr48742.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr49029.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr49049.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr49238.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr50565-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr50565-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr51077.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr51767.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr52074.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr53418-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr53418-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr54103-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr54103-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr54103-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr54103-4.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr54103-5.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr54103-6.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr54552-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr56539.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pta-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/ptr-conv-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/simd-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/simd-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/simd-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/simd-4.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/simd-5.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/simd-6.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/sizeof-macros-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/sra-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/ssa-pre-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/statement-expression-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/strcpy-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/strcpy-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/struct-non-lval-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/struct-non-lval-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/struct-non-lval-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/structs.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/switch-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/sync-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/sync-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/sync-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/trunctfdf.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/vector-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/vector-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/vector-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/vector-4.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/vector-align-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/vla-const-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/vla-const-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/volatile-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/widechar-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/zero-strct-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/zero-strct-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/zero-strct-3.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/zero-strct-4.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/zero-strct-5.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000112-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000113-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000121-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000205-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000217-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000223-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000224-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000225-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000227-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000313-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000314-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000314-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000314-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000402-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000403-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000412-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000412-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000412-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000412-4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000412-5.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000412-6.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000419-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000422-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000503-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000511-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000519-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000519-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000523-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000528-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000603-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000605-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000605-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000605-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000622-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000703-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000706-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000706-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000706-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000706-4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000706-5.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000707-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000715-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000715-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000717-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000717-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000717-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000717-4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000717-5.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000722-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000726-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000731-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000731-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000801-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000801-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000801-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000801-4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000808-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000815-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000818-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000819-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000822-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000910-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000910-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000914-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20000917-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20001009-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20001009-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20001011-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20001013-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20001017-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20001017-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20001024-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20001026-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20001027-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20001031-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20001101.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20001108-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20001111-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20001112-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20001121-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20001124-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20001130-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20001130-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20001203-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20001203-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20001221-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20001228-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20001229-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010106-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010114-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010116-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010118-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010119-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010122-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010122-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010123-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010129-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010129-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010206-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010209-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010221-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010222-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010224-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010325-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010329-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010403-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010409-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010422-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010518-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010518-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010520-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010604-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010605-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010605-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010711-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010717-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010723-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010724-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010724-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010904-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010904-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010910-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010915-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010924-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20010925-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20011008-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20011019-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20011024-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20011109-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20011109-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20011113-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20011114-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20011115-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20011121-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20011126-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20011126-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20011128-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20011217-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20011219-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20011223-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020103-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020107-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020108-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020118-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020127-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020129-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020201-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020206-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020206-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020213-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020215-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020216-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020219-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020225-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020225-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020226-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020227-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020307-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020314-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020320-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020321-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020328-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020402-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020402-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020402-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020404-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020404-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020406-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020411-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020412-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020413-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020418-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020423-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020503-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020506-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020508-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020508-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020508-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020510-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020529-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020611-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020614-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020615-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020619-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020716-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020720-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020805-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020810-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020819-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020904-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020911-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020916-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020920-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20021010-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20021010-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20021011-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20021015-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20021024-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20021024-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/20021111-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20021113-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20021118-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20021118-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20021118-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20021119-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20021120-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20021120-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20021120-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20021127-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20021127-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/20021204-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20021219-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030105-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030109-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030117-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030120-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030120-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030125-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030125-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030128-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030203-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030209-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030216-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030216-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030218-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030221-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030222-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030222-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030224-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030307-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030313-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030316-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030323-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030330-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030401-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030403-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030404-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030408-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030501-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030606-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030613-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030626-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030626-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030714-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030715-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030717-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030718-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030811-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030821-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030828-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030828-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030903-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030909-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030910-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030913-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030914-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030914-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030916-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030920-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20030928-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20031003-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20031010-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20031011-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20031012-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20031020-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20031201-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20031204-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20031211-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20031211-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20031214-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20031215-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20031216-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040208-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040208-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040208-2.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040218-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040223-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040302-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040307-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040308-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040309-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040311-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040313-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040319-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040331-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040409-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040409-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040409-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040411-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040423-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040520-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040625-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040629-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040629-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040703-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040703-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040704-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040705-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040705-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040705-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040705-2.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040706-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040707-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040709-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040709-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040709-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040709-2.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040805-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040811-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040811-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040820-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040823-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040831-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040917-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20041011-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20041019-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20041112-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20041113-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20041114-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20041124-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20041126-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20041201-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20041210-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20041212-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20041213-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20041214-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20041218-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20041218-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050104-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050106-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050107-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050111-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050119-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050119-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050121-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050124-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050125-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050131-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050203-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050215-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050218-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050224-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050316-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050316-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050316-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050316-2.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050316-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050410-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050502-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050502-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050604-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050604-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050607-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050613-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050713-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050826-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050826-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20050929-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20051012-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20051021-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20051104-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20051110-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20051110-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20051113-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20051215-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20060102-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20060110-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20060110-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20060127-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20060412-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20060420-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20060905-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20060910-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20060929-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20060930-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20060930-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20061031-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20061101-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20061101-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/20061101-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20061220-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20070201-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20070212-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20070212-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20070212-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20070424-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20070517-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20070614-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20070623-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20070724-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20070824-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20070919-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20071011-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20071018-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20071029-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20071030-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20071108-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20071120-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20071202-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20071205-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20071210-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20071211-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20071213-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20071216-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20071219-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20071220-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20071220-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20080117-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20080122-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20080222-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20080408-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20080424-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20080502-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20080506-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20080506-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20080519-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20080522-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20080529-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20080604-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20080719-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20080813-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20081103-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20081112-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20081117-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20081117-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/20081218-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20090113-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20090113-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20090113-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20090207-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20090219-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20090527-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20090623-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20090711-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20090814-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20091229-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20100209-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20100316-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20100416-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20100430-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20100708-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20100805-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20100827-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20101011-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20101011-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/20101013-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20101025-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20111208-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20111212-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20120105-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20120111-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20120207-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/20120427-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/900409-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920202-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920302-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920409-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920410-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920411-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920415-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920428-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920428-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920429-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920501-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920501-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920501-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920501-4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920501-5.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920501-6.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920501-7.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920501-8.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920501-8.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/920501-9.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920506-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920520-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920603-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920604-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920612-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920612-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920618-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920625-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920710-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920710-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/920711-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920721-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920721-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920721-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920721-4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920726-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920728-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920730-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920731-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920810-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920812-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920829-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920908-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920908-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920909-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920922-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/920929-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921006-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921007-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921013-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921016-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921017-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921019-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921019-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921029-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921104-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921110-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921112-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921113-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921117-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921123-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921123-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921124-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921202-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921202-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921204-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921207-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921208-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921208-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921215-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921218-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/921218-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930106-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930111-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930123-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930126-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930208-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930406-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930408-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930429-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930429-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930513-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930513-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/930513-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930518-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930526-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930527-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930529-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930529-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/930603-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930603-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930603-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930608-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930614-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930614-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930621-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930622-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930622-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930628-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930630-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930702-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930713-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930718-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930719-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930725-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930818-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930916-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930921-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930929-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930930-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/930930-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931002-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931004-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931004-10.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931004-11.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931004-12.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931004-12.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/931004-13.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931004-14.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931004-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931004-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931004-4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931004-5.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931004-6.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931004-7.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931004-8.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931004-9.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931005-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931009-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931012-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931017-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931018-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931031-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931102-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931102-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931110-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931110-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931208-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/931228-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/940115-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/940122-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/941014-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/941014-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/941014-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/941015-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/941021-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/941025-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/941031-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/941101-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/941110-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/941202-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/950221-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/950322-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/950426-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/950426-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/950503-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/950511-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/950512-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/950605-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/950607-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/950607-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/950612-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/950621-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/950628-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/950704-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/950706-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/950710-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/950714-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/950809-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/950906-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/950915-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/950929-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/951003-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/951115-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/951204-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960116-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960117-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960209-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960215-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960218-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960219-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960301-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960302-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960311-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960311-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960311-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960312-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960312-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/960317-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960321-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960326-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960327-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960402-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960405-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960416-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960419-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960419-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960512-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960513-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960521-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960608-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960801-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960802-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960830-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/960909-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/961004-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/961017-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/961017-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/961026-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/961112-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/961122-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/961122-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/961125-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/961206-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/961213-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/961223-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/970214-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/970214-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/970217-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/970923-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/980205.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/980223.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/980424-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/980505-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/980505-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/980506-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/980506-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/980506-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/980526-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/980526-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/980526-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/980602-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/980602-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/980604-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/980605-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/980608-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/980612-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/980617-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/980618-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/980701-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/980707-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/980709-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/980709-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/980716-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/980929-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/981001-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/981019-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/981130-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/981130-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/981206-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990106-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990106-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990117-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990127-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990127-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990127-2.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/990128-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990130-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990208-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990211-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990222-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990324-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990326-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990404-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990413-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990413-2.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/990513-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990524-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990525-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990525-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990527-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990531-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990604-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990628-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990804-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990811-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990826-0.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990826-0.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/990827-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990829-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/990923-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/991014-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/991016-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/991019-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/991023-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/991030-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/991112-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/991118-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/991201-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/991202-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/991202-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/991202-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/991216-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/991216-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/991216-4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/991221-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/991227-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/991228-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/align-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/align-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/align-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/align-nest.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/alloca-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/anon-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/arith-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/arith-rand-ll.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/arith-rand.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ashldi-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ashrdi-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/bcp-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/bf-layout-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/bf-pack-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/bf-sign-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/bf-sign-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/bf64-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/bf64-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/bitfld-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/bitfld-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/bitfld-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/bitfld-4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/bitfld-4.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/bitfld-5.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/built-in-setjmp.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtin-bitops-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtin-constant.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-5.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-6.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtin-types-compatible-p.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/20010124-1-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/20010124-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/abs-1-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/abs-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/abs-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/abs-2-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/abs-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/abs-3-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/abs-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/chk.h create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/complex-1-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/complex-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/fprintf-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/fprintf.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/fprintf.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/fputs-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/fputs.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/abs.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/bfill.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/bzero.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/chk.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/fprintf.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/memchr.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/memcmp.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/memmove.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/mempcpy.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/memset.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/printf.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/sprintf.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/stpcpy.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcat.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/strchr.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcmp.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcpy.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcspn.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/strlen.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncat.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncmp.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncpy.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/strpbrk.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/strrchr.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/strspn.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/lib/strstr.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/memchr-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/memchr.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/memcmp-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/memcmp.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/memcpy-chk-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/memcpy-chk.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/memmove-2-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/memmove-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/memmove-chk-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/memmove-chk.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/memmove-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/memmove.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-2-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-chk-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-chk.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/memset-chk-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/memset-chk.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/memset-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/memset.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/pr22237-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/pr22237.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/pr23484-chk-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/pr23484-chk.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/printf-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/printf.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/snprintf-chk-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/snprintf-chk.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/sprintf-chk-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/sprintf-chk.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/sprintf-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/sprintf.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/stpcpy-chk-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/stpcpy-chk.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strcat-chk-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strcat-chk.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strcat-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strcat.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strchr-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strchr.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strcmp-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strcmp.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-2-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-chk-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-chk.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strcpy.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strcspn-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strcspn.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strlen-2-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strlen-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strlen-3-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strlen-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strlen-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strlen.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strncat-chk-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strncat-chk.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strncat-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strncat.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strncmp-2-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strncmp-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strncmp-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strncmp.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strncpy-chk-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strncpy-chk.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strncpy-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strncpy.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strpbrk-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strpbrk.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strpcpy-2-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strpcpy-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strpcpy-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strpcpy.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strrchr-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strrchr.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strspn-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strspn.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strstr-asm-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strstr-asm.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strstr-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/strstr.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/vsnprintf-chk.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/vsprintf-chk-lib.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/builtins/vsprintf-chk.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/call-trap-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/cbrt.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/cmpdi-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/cmpsf-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/cmpsi-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/cmpsi-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/comp-goto-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/comp-goto-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/compare-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/compare-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/compare-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/complex-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/complex-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/complex-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/complex-4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/complex-5.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/complex-6.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/complex-7.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/compndlit-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/const-addr-expr-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/conversion.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/cvt-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/cvt-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/dbra-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/divcmp-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/divcmp-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/divcmp-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/divcmp-4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/divcmp-5.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/divconst-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/divconst-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/divconst-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/divmod-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/doloop-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/doloop-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/eeprof-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/eeprof-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/enum-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/enum-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/enum-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/execute.exp create mode 100644 gcc/testsuite/gcc.c-torture/execute/extzvsi.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ffs-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ffs-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/float-floor.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/floatunsisf-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/fprintf-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/fprintf-chk-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/frame-address.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/func-ptr-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/gofast.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/20000320-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/20000320-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/20001122-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/20010114-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/20010114-2.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/20010226-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/20011123-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/20030331-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/20030331-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/20041213-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/920518-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/920518-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/920810-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/930529-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/980619-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/980619-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/acc1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/acc2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/builtin-nan-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-3.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-4.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/copysign1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/copysign2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-2.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-3.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4e.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4f.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4f.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4l.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-5.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-6.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-6.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-7.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8e.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8f.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8f.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8l.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/hugeval.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/hugeval.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/inf-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/inf-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/inf-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/minuszero.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/mzero2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/mzero2.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/mzero3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/mzero4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/mzero5.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/mzero6.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/pr28634.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/pr29302-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/pr30704.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/pr30704.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/pr36332.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/pr38016.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/pr38016.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/pr50310.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/rbug.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/rbug.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/unsafe-fp-assoc-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/unsafe-fp-assoc-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/unsafe-fp-assoc.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ifcvt-onecmpl-abs-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/index-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/inst-check.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/int-compare.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ipa-sra-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ipa-sra-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ipa-sra-2.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/longlong.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-10.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-11.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-12.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-13.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-14.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-15.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-2b.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-2c.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-2d.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-2e.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-2f.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-2f.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-2g.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-2g.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-3b.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-3c.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-4b.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-5.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-6.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-7.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-8.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-9.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-ivopts-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/loop-ivopts-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/lshrdi-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/mayalias-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/mayalias-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/mayalias-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/medce-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/memcpy-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/memcpy-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/memcpy-bi.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/memset-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/memset-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/memset-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/mod-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/mode-dependent-address.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/mode-dependent-address.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/multdi-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/multi-ix.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/nest-align-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/nest-stdar-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/nestfunc-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/nestfunc-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/nestfunc-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/nestfunc-4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/nestfunc-5.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/nestfunc-6.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/nestfunc-7.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/p18298.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/packed-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/packed-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pending-4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/postmod-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr15262-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr15262-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr15262.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr15296.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr16790-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr17078-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr17133.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr17252.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr17377.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr19005.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr19515.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr19606.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr19687.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr19689.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr19689.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr20100-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr20187-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr20466-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr20527-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr20601-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr20621-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr21173.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr21331.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr21964-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr22061-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr22061-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr22061-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr22061-4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr22098-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr22098-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr22098-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr22348.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr22429.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr22493-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr22493-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr22630.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr23047.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr23047.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr23135.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr23324.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr23467.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr23604.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr23941.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr24135.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr24141.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr24142.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr24716.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr24851.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr25125.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr25737.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr27073.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr27260.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr27285.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr27364.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr27671-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr28289.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr28403.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr28651.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr28778.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr28982a.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr28982b.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr29006.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr29156.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr29695-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr29695-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr29797-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr29797-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr29797-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr29798.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr30185.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr30778.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr31072.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr31136.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr31169.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr31448-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr31448.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr31448.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr31605.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr32244-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr32500.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr33142.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr33382.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr33631.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr33669.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr33779-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr33779-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr33870-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr33870.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr33992.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr34070-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr34070-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr34099-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr34099.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr34130.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr34154.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr34176.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr34415.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr34456.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr34768-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr34768-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr34971.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr34982.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr35163.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr35231.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr35390.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr35456.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr35456.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr35472.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr35800.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr36034-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr36034-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr36038.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr36077.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr36093.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr36321.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr36339.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr36343.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr36691.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr36765.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr37102.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr37125.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr37573.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr37573.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr37882.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr37924.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr37931.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr38048-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr38048-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr38051.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr38151.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr38151.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr38212.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr38236.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr38422.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr38533.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr38819.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr38969.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr39100.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr39120.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr39228.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr39228.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr39233.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr39240.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr39339.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr39501.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr39501.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr40022.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr40057.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr40386.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr40386.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr40404.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr40493.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr40579.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr40657.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr40668.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr40747.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr41239.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr41317.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr41395-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr41395-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr41463.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr41750.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr41917.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr41919.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr41935.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr42006.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr42142.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr42154.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr42231.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr42248.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr42269-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr42512.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr42544.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr42570.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr42614.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr42691.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr42721.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr42833.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr43008.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr43220.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr43236.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr43269.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr43385.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr43438.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr43560.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr43629.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr43783.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr43784.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr43835.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr43987.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr44164.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr44202-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr44468.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr44555.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr44575.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr44683.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr44683.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr44828.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr44852.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr44858.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr44942.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr45034.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr45070.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr45262.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr45695.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr45830.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr46019.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr46316.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr46909-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr46909-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr47148.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr47155.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr47237.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr47299.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr47337.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr47538.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr47925.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr48197.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr48717.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr48809.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr48973-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr48973-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr49039.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr49073.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr49123.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr49161.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr49186.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr49218.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr49279.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr49390.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr49419.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr49644.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr49768.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr51323.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr51466.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr52129.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr52286.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr53084.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr7284-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr7284-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/printf-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/printf-chk-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pta-field-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pta-field-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ptr-arith-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pure-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pushpop_macro.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/regstack-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/restrict-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/scope-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/shiftdi.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/shiftdi.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/shiftopt-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/simd-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/simd-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/simd-4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/simd-4.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/simd-5.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/simd-6.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/stdarg-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/stdarg-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/stdarg-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/stdarg-4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/strcmp-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/strcpy-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/strct-pack-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/strct-pack-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/strct-pack-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/strct-pack-4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/strct-stdarg-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/strct-varg-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/string-opt-17.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/string-opt-18.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/string-opt-5.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/strlen-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/strncmp-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/strncmp-1.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/struct-aliasing-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/struct-cpy-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/struct-ini-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/struct-ini-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/struct-ini-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/struct-ini-4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/struct-ret-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/struct-ret-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/switch-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/tstdi-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/unroll-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/usmul.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/usmul.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-10.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-11.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-12.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-13.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-14.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-15.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-16.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-17.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-18.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-19.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-20.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-21.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-22.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-23.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-24.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-26.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-5.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-6.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-7.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-8.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-9.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-pack-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/va-arg-trap-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/vector-shift.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/vector-shift1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/vector-shift2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/vector-subscript-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/vector-subscript-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/vector-subscript-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/vfprintf-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/vfprintf-chk-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/vla-dealloc-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/vprintf-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/vprintf-chk-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/vrp-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/vrp-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/vrp-3.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/vrp-4.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/vrp-5.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/vrp-5.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/vrp-6.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/vrp-6.x create mode 100644 gcc/testsuite/gcc.c-torture/execute/vrp-7.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/wchar_t-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/widechar-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/widechar-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/zero-struct-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/zero-struct-2.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/zerolen-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/zerolen-2.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/386.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/86.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/BUG1.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/BUG11.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/BUG12.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/BUG13.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/BUG16.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/BUG17.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/BUG18.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/BUG2.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/BUG21.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/BUG22.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/BUG23.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/BUG24.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/BUG25.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/BUG3.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/BUG4.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/BUG5.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/BUG6.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/DFcmp.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/HIcmp.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/HIset.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/PYRBUG.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/QIcmp.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/QIset.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/SFset.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/SIcmp.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/SIset.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/UHIcmp.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/UQIcmp.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/USIcmp.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/a.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/a1.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/a3.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/aa.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/aaa.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/abs.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/ac.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/acc.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/add.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/add386.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/addcc.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/andm.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/andmem.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/andn.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/andok.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/andsi.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/andsparc.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/aos.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/arr.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/as.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/ase.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/b.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/b1.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/b2.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/b3.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/b88.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/bad.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/band.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/bb0.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/bb1.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/bbb.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/bc.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/bcopy.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/bf.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/bfins.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/bfx.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/bge.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/bit.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/bitf.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/bitw.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/blk.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/bt.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/bt386.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/bug.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/bugc.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/buns.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/bx.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/c.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/c1.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/c2.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/call.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/call386.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/callind.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/cc.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/charmtst.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/cmb.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/cmp.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/cmphi.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/cmpsi386.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/cmul.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/cn1.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/comb.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/consec.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/const.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/conv.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/conv_tst.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/cp.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/csebug.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/cvt.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/d.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/dbl_parm.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/dblbug.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/ddd.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/dead.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/delay.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/di.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/dic.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/dilayout.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/dimove.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/dimul.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/div.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/divdf.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/dm.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/dshift.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.x create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/e.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/ex.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/ext.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/f1.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/f2.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/fdmul.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/flo.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/float.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/flt_const.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/fnul.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/foo.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/forgetcc.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/fq.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/g.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/gen_tst.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/glob.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/gronk.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/hi.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/hibug.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/i++.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/i.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/ic.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/icmp.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/ifreg.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/imm.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/isinf.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/jmp.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/jumptab.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/l.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/layout.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/lbug.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/ll1.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/llbug.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/lll.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/load8.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/loadhicc.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/log2.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/logic.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/loop-1.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/loop386.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/lop.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/m1.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/m2.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/m5.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/m68.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/mbyte.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/mchar.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/mcmp.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/mdouble.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/memtst.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/miscomp.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/mm.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/mod.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/modcc.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/move.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/move_qhi.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/mregtst.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/msp.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/mtst.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/mu.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/mul.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/mword.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/mword1.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/n.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/n1.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/nand.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/neg.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/o.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/omit.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/opout.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/opt.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/or.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/or386.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/p.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/parms.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/pass.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/pmt.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/poor.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/pp.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/pret-arg.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/pyr.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/pyr2.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/q.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/r.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/r1.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/rel.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/rmsc.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/round.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/run.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/s.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/sar.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/sc.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/scal.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/scc.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/scond.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/selfrec.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/seq.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/set386.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/set88.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/sh.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/shand.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/shft.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/shift.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/shloop.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/shm.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/signext.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/signext2.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/sim.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/simple.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/sne.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/sound.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/sparcbug.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/speed.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/stor.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/store0.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/storecc.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/str.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/stru.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/structret.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/stuct.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/sub32.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/subcc.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/subcse.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/sym.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/symconst.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/t.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/test-flow.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/test-loop.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/test.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/time.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/tmp.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/trivial.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/trunc.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/u.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/udconvert.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/udivmod4.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/uns.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/uns_tst.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/uuarg.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/v.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/w.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/ww.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/x.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/xb.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/xbg.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/xc.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/xcsebug.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/xdi.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/xfoo.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/xi.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/xlop.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/xmtst.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/xneg.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/xopt.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/xor.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/xorn.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/xp.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/xpp.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/xs.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/xsh.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/xz.c create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/xzz.c (limited to 'gcc/testsuite/gcc.c-torture') diff --git a/gcc/testsuite/gcc.c-torture/ChangeLog.0 b/gcc/testsuite/gcc.c-torture/ChangeLog.0 new file mode 100644 index 000000000..113abe2c4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/ChangeLog.0 @@ -0,0 +1,635 @@ +Thus ends c-torture-1.45: New entries belong one directory up. + +Wed Mar 12 01:23:08 1997 Torbjorn Granlund + + * execute/961213-1.c: New test (from hjl@lucon.org). + + * execute/complex-5.c: New test (from moshier@world.std.com). + + * execute/970217-1.c: New test (from eggert@twinsun.com). + + * execute/970214-[12].c: New tests (from eggert@twinsun.com). + + * compile/970214-1.c: New test (from wilson@cygnus.com). + + * execute/ieee/930529-1.c: Also handle arm's unusual byte/word + ordering (from amylaar@cygnus.com). + + * execute/index-1.c: Make large vars and values `long' + (from law@cygnus.com). + + * execute/941014-2.c: Declare malloc. + + * compile/970206-1.c: New test (from dje@cygnus.com). + + * execute/960521-1.c: Rewrite to take STACK_SIZE into account + (from amylaar@cygnus.co.uk). + + * execute/961223-1.c: New test (from wilson@cygnus.com). + + * compile/961203-1.c: New test (from amylaar@cygnus.co.uk). + + * compile/961126-1.c: New test (from wilson@cygnus.com). + + * execute/961125-1.c: New test (from meyering@asic.sc.ti.com). + + * execute/961122-2.c: New test (from + schwab@issan.informatik.uni-dortmund.de). + + * execute/961122-1.c: New test (from Philippe De Muyter). + + * execute/loop-2[ef].c: Default MAP_FIXED to 0 (from + amylaar@cygnus.co.uk). + + Changes from meissner@cygnus.com: + * execute/920501-9.c (print_longlong): Print pieces as a long, not int. + * execute/950915-1.c: (a,b): Make types long to prevent implicit + overflow on 16-bit systems. + * execute/dbra-1.c: Pass long values to functions expecting + long values. + * execute/950607-2.c: (Point): Make field type long, since 23250 - + (-23250) is larger than 16 bits. + * execute/960416-1.c: Make st type unsigned long, not unsigned int. + * execute/bf-sign-2.c: Make bitfields whose size is > 16 bits + long, not int for 16-bit hosts. + * execute/961017-2.c: Make z unsigned long, not unsigned int. + + * execute/cmpsi-1.c: Rewrite not to depend on type sizes. + + * execute/960909-1.c (ffs): New function (from law@cygnus.com). + + * execute/fp-cmp-1.c: Add test for SIGNAL_SUPPRESS around signal call. + Move to execute/ieee. + + * execute/970312-1.c: New test. + * execute/cvt-1.c: New test. + +Thu Feb 13 13:52:23 1997 Michael Meissner + + * compile/920301-1.c: If NO_LABEL_VALUES is defined, nop test + using labels as values extension. + * compile/920415-1.c: Ditto. + * compile/920428-3.c: Ditto. + * compile/920501-1.c: Ditto. + * compile/920501-7.c: Ditto. + * compile/941014-4.c: Ditto. + * compile/950613-1.c: Ditto. + * compile/labels-1.c: Ditto. + * execute/920302-1.c: Ditto. + * execute/920415-1.c: Ditto. + * execute/920428-2.c: Ditto. + * execute/920501-3.c: Ditto. + * execute/920501-4.c: Ditto. + * execute/920501-5.c: Ditto. + * execute/920721-4.c: Ditto. + * execute/comp-goto-1.c: Ditto. + + * compile/930506-2.c: If NO_TRAMPOLINES is defined, nop the test. + * execute/921215-1.c: Ditto. + * execute/931002-1.c: Ditto. + * execute/nestfunc-1.c: Ditto. + +Wed Jan 22 00:04:53 1997 Torbjorn Granlund + + * execute/961017-1.c: Add missing exit (0). + +Fri Dec 6 19:38:57 1996 Torbjorn Granlund + + * execute/961206-1.c: New test. + +Wed Nov 13 17:13:05 1996 Torbjorn Granlund + + * execute/loop-2[ef].c: Misc portability changes + (from amylaar@cygnus.co.uk). + +Tue Nov 12 15:00:42 1996 Torbjorn Granlund + + * execute/961112-1.c: New test (based on a test by wilson@cygnus.com). + + * execute/ieee/DESC: New file. + + * execute/{loop-2[bcdef].c,loop-3[bc].c}: + New tests (from amylaar@cygnus.co.uk). + + * execute/ieee/nan.c: Delete test. + + * execute/fp-cmp-1.c: Disable for Cray and VAX. + + * execute/960416-1.c: Make it work for big-endian machines (from + amylaar@cygnus.co.uk). + +Mon Nov 11 18:00:35 1996 Torbjorn Granlund + + * execute/960830-1.c: Make it work for non-x86 machines. + + * execute/961017-2.c: Call exit(0). + +Fri Nov 8 19:19:17 1996 Torbjorn Granlund + + * execute/960311-3.c: #include . + * execute/920501-8.c: Likewise. + * execute/920501-9.c: Likewise. + * execute/941014-2.c: Likewise. + * execute/960311-1.c: Likewise. + * execute/960311-2.c: Likewise. + + * execute/961017-[12].c: New test (from wilson@cygnus.com). + * compile/961031-1.c: New test (from wilson@cygnus.com). + * compile/961019-1.c: New test (from wilson@cygnus.com). + * utils/ctest.c: Print and pass (to run_a_test) all arguments. + * execute/{920711-1.c,920810-1.c,920922-1.c,930603-3.c,931018-1.c} + * execute/{941025-1.c,950221-1.c,950426-2.c,960209-1.c,960321-1.c} + * execute/{960327-1.c,arith-rand.c,bf-pack-1.c,cbrt.c,divconst-2.c} + * execute/memcpy-1.c: 16-bit changes (from law@cygnus.com). + + * compile/960514-1.c: New test (from rwilhelm@physik.tu-muenchen.de). + + * execute/960512-1.c: New test (from amylaar@meolyon.hanse.de). + + * execute/960513-1.c: New test (from amylaar@meolyon.hanse.de). + + * execute/960405-1.c: New test (from moshier@world.std.com). + +Fri Nov 1 13:06:28 1996 Torbjorn Granlund + + * execute/dbra-1.c: New test. + +Mon Oct 28 02:31:10 1996 Torbjorn Granlund + + * execute/961026-1.c: New test (from rankin@eql.caltech.edu). + + * execute/enum-1.c: New test (from law@cygnus.com). + +Tue Oct 22 22:13:12 1996 Torbjorn Granlund + + * execute/960801-1.c: Generalize. + +Fri Oct 18 04:14:01 1996 Torbjorn Granlund + + * utils/ctest.c (run_a_test): Don't call `fatal' when the compiler + returns non-zero, but there is no error message from the compiler. + +Wed Oct 16 01:39:57 1996 Torbjorn Granlund + + * execute/arith-rand.c (main): Decrease the number of iteration to + 1000. + +Fri Oct 11 16:40:44 1996 Torbjorn Granlund + + * compile/961010-1.c: New test (from ian@cygnus.com). + +Fri Oct 4 18:29:00 1996 Torbjorn Granlund + + * execute/961004-1.c: New test (from wilson@cygnus.com). + + * compile/961004-1.c: New test (from amylaar@cygnus.co.uk). + +Thu Oct 3 02:51:24 1996 Torbjorn Granlund + + * execute/fp-cmp-1.c: Move signal handler setup to after == and != + compares. + +Wed Oct 2 04:53:54 1996 Torbjorn Granlund + + * execute/fp-cmp-1.c: New test. + +Mon Sep 30 01:11:06 1996 Torbjorn Granlund + + * compile/960620-1.c: Delete test. + +Fri Sep 13 12:12:30 1996 Ian Lance Taylor + + * execute/ieee/920810-1.c: Include . + +Mon Sep 9 18:56:33 1996 Torbjorn Granlund + + * execute/960909-1.c: New test. + +Fri Aug 30 06:31:25 1996 Torbjorn Granlund + + * execute/960830-1.c: New test. + +Thu Aug 29 22:06:49 1996 Torbjorn Granlund + + * compile/960829-1.c: New test. + +Tue Aug 13 19:23:06 1996 Torbjorn Granlund + + * utils/ctest.c (run_a_test): Call wait repeatedly until + we get back the right pid. + +Sat Aug 3 16:36:43 1996 Torbjorn Granlund + + * execute/960416-1.c: New test (from amylaar@meolyon.hanse.de). + + * execute/960419-[12].c: New tests (from jtc@cygnus.com). + + * execute/960416-1.c: New test (from amylaar@meolyon.hanse.de). + + * execute/920721-1.c: Make it work for 16-bit systems + (from law@cygnus.com). + * execute/920728-1.c: Likewise. + + * compile/960201-1.c: New test (from eggert@twinsun.com). + * compile/960130-1.c: New test (from eggert@twinsun.com). + +Sat Aug 3 16:10:20 1996 Andrew Cagney + + * utils/ctest.c (run_a_test): Flush output before first fork to + avoid later duplication. + + * utils/ctest.c (run_a_test): If really verbose, and a run command + was specified (-run), print the command to be executed out. + * (run_a_test): For the -run option, accept an argument list. + + * utils/ctest.c (main): Change verbose flag so it increments the + verbosity instead of just setting it. Backward compatible hack + that allows multiple levels of tracing. Perhaphs a separate flag + would be better. + (main): If really verbose, print the GCC command that is to be executed. + (run_a_test): If really verbose, print the output from compiler + and allow the output from the run to be displayed. + + * utils/ctest.c (main): New option -postopts added. This allows + the user to specify arguments that should be appended to the GCC + command (in addition to the -options flag that specfies arguments + that are to be prepended). + (usage): Adjust. + +Sat Aug 3 16:10:20 1996 Torbjorn Granlund + + From Mike Meissner: + * utils/ctest.c: Sort test files by calling `ls -r'. + * utils/ctest.c: Flush stdout after each printf. + * utils/ctest.c: When `-run', up timeout to 1000. Allow + explicit setting of timeout through new -cc-timeout option. + +Fri Aug 2 19:53:27 1996 Torbjorn Granlund + + * execute/960521-1.c: New test + (from eggert@twinsun.com and Andreas Schwab). + + * compile/960620-1.c: New test (from rwilhelm@physik.tu-muenchen.de). + + * compile/960704-1.c: New test (from wilson@cygnus.com). + + * execute/bf-sign-2.c: New test (from gavin@nando.net). + + * execute/960802-1.c: New test (from law@cygnus.com). + + * execute/960801-1.c: New test (from dje@cygnus.com). + +Sun Jun 9 17:35:56 1996 Torbjorn Granlund + + * execute/960608-1.c: New test (from law@cygnus.com). + +Tue Apr 2 23:18:51 1996 Torbjorn Granlund + + * execute/900409-1.c: Change types from int to long + (from law@cygnus.com). + + * execute/960402-1.c: New test. + +Fri Mar 29 23:40:01 1996 Torbjorn Granlund + + * execute/960327-1.c: New test (from law@cygnus.com). + +Tue Mar 26 22:57:34 1996 Torbjorn Granlund + + * execute/960326-1.c: New test (from wilson@cygnus.com). + * execute/960321-1.c: New test (from law@cygnus.com). + * compile/960319-1.c: New test (from amylaar@meolyon.hanse.de). + * execute/960317-1.c: New test (from amylaar@meolyon.hanse.de). + * execute/960312-1.c: New test (from amylaar@meolyon.hanse.de). + * execute/960311-[123].c: New tests (from dje@cygnus.com). + * execute/960302-1.c: New test (from law@cygnus.com). + * execute/960215-1.c: New test (from moshier@world.std.com). + +Fri Mar 1 06:01:58 1996 Torbjorn Granlund + + * execute/regstack-1.c: New test (from moshier@world.std.com). + * execute/960301-1.c: New test (from rankin@eql.caltech.edu). + * execute/struct-ini-4.c: New test (from wilson@cygnus.com). + +Sun Feb 25 01:10:12 1996 Paul Eggert + + * special/doit (960224-1, 960224-2): New tests. + +Wed Feb 21 07:18:19 1996 Torbjorn Granlund + + * compile/960221-1.c: New test (from law@cygnus.com). + * compile/960220-1.c: New test. + +Mon Feb 19 03:14:18 1996 Torbjorn Granlund + + * execute/960219-1.c: New test. + * compile/960218-1.c: New test (from eggert@twinsun.com). + +Sun Feb 18 04:01:54 1996 Torbjorn Granlund + + * execute/960218-1.c: New test. + +Sat Feb 10 03:07:04 1996 Torbjorn Granlund + + * execute/960209-1.c: New test (from law@cygnus.com). + +Wed Jan 24 23:23:05 1996 Torbjorn Granlund + + * execute/960117-1.c: New test (from dje@cygnus.com). + * execute/960116-1.c: New test (from Philippe De Muyter). + +Mon Jan 22 23:46:17 1996 Torbjorn Granlund + + * noncompile/930714-1.c: Moved from compile. + +Mon Jan 22 19:08:04 1996 Paul Eggert + + * special/doit (920717-1): Make sure `not found' message is ignored + when invoking cc. + +Tue Jan 16 14:24:36 1996 Torbjorn Granlund + + * noncompile/951227-1.c: New test (from eggert). + * special/doit (951130-1): New test (from eggert). + * noncompile/951025-1.c: New test. + +Thu Jan 11 09:36:49 1996 Torbjorn Granlund + + * execute/widechar-1.c: New test (from eggert). + +Tue Jan 9 12:44:21 1996 Torbjorn Granlund + + * compile/960106-1.c: New test. + +Mon Dec 25 19:21:08 1995 Torbjorn Granlund + + * compile/951222-1.c: New test (from kenner). + +Wed Dec 20 14:45:42 1995 Torbjorn Granlund + + * compile/951220-1.c: New test. + +Wed Dec 6 13:46:17 1995 Torbjorn Granlund + + From Alan Modra: + * utils/ctest.c (main): mktemp needs 6 X's on some systems. + +Mon Dec 4 21:39:39 1995 Torbjorn Granlund + + * compile/widechar-1.c: New test. + + * unsorted/{bugx.c,bugy.c,inline.c}: Delete huge/duplicate tests. + + * execute/951204-1.c: New test. + * compile/951128-1.c: New test. + +Mon Nov 27 00:16:37 1995 Torbjorn Granlund + + * execute/bf-layout-1.c: New test. + +Wed Nov 22 21:38:25 1995 Torbjorn Granlund + + * noncompile/951123-1.c: New test. + +Wed Nov 16 23:31:23 1995 Torbjorn Granlund + + * compile/951116-1.c: New test. + +Wed Nov 15 20:34:03 1995 Torbjorn Granlund + + * utils/ctest.c: New name for runtests.c (not to confuse it with + DejaGNU runtest). + + * utils/runtests.c (RLIMIT_CORE): Default to 4. + + * execute/951115-1.c: New test (PA delay slot filling bug). + +Tue Nov 14 00:27:10 1995 Torbjorn Granlund + + * utils/runtests.c (run_a_test): Read from errmess pipe before + blocking on child process. Also, loop calling read(2) until pipe + is empty or 8000 chars are read. + (usage): New function. + (main): Call usage for -help. + +Sun Nov 7 17:15:12 1995 Torbjorn Granlund + + * compile/951106-1.c: New test (MIPS3). + +Sun Nov 5 12:22:20 1995 Torbjorn Granlund + + * utils/runtests.c (run_a_test): Don't print exit status for failing + noncompile test. + +Thu Oct 26 00:45:43 1995 Torbjorn Granlund + + * utils/runtests.c (run_a_test): Save and restore filedesc for + stdout, so that failure in execve is reported properly. + From Arne Juul: + (run_a_test): To work around NetBSD bug, don't pass NULL as 2nd + execve argument. + +Wed Oct 25 16:13:46 1995 Torbjorn Granlund + + * utils/runtests.c (main): Fix typo testing `execute_these_files'. + +Tue Oct 10 17:41:47 1995 Torbjorn Granlund + + * execute/950714-1.c (main): Call exit(0). + + * compile/951004-1.c: New test. + +Tue Oct 3 22:59:13 1995 Torbjorn Granlund + + * execute/950929-1.c: New test (from ian@cygnus.com). + + * execute/951003-1.c: New test (from dje@cygnus.com). + +Tue Sep 26 15:31:49 1995 Torbjorn Granlund + + * execute/950714-1.c: New test (from wilson@cygnus.com). + + * execute/950706-1.c: New test (from rearnsha) + + * execute/ieee/{minuszero.c,rbug.c,nan.c}: New tests (from moshier). + + * execute/scope-2.c: New test (from rfg). + + * execute/bf-sign-1.c: New test (from jtc@cygnus.com). + + * noncompile/930927-1.c: Delete this duplicated test. + + * unsorted/gdb.c: Delete this test. + * */*.c: Delete whitespace at the end of lines. + + * execute/loop-3.c: New test (from amylaar@meolyon.hanse.de). + +Mon Sep 25 14:08:32 1995 Torbjorn Granlund + + * Make file permissions be regular. + + * utils/runtests.c (main): Combine `flag_execute' and + `execute_these_files' into the latter. + (run_a_test): Test only `execute_these_files'. + + * execute/920411-1.c: Generalize to work even for big-endian + 64-bit machines (from amylaar@meolyon.hanse.de). + +Sun Sep 24 16:26:03 1995 Torbjorn Granlund + + * utils/runtests.c (set_watchdog): Actually use `seconds' parameter. + +Sat Sep 23 00:08:33 1995 Torbjorn Granlund + + * compile/950922-1.c: New test. + +Thu Sep 21 12:25:40 1995 Torbjorn Granlund + + * utils/runtests.c (environ): Declare. + (run_a_test): Pass environ to execve calls. + (main): Don't NULL-terminate `passes' array. + (main): Make ii loop's termination condition depend on n_passes. + (run_a_test): Check result from read; '\0'-terminate buf. + (main): Avoid d_namlen, use strlen of d_name instead (from meyering). + + * compile/950919-1.c: New test. + + * execute/conversion.c (test_longlong_integer_to_float): Modify + some tests conditionally for __HAVE_68881__. + + * execute/950915-1.c: New test. + + * utils/runtests.c: New file to run tests faster. + * {execute/compile/unsorted/noncompile}/DESC: New files. + + * compile/950921-1.c: New test (from Ian Taylor). + +Wed Sep 20 14:53:33 1995 Doug Evans + + * execute/920501-7.c (STACK_SIZE): Check for and use to limit + depth of recursion. + +Mon Sep 18 23:43:28 1995 Torbjorn Granlund + + * compile/gcc-failure/940409-1.c: Moved from compile. + + * execute/920411-1.c: Moved from execute/gcc_failure. + * execute/gcc_failure/920627-2.c: Delete spurious test. + + * utils/runtests.c: New program. + +Tue Sep 12 22:05:15 1995 Torbjorn Granlund + + * execute/divconst-3.c: New test. + +Mon Sep 11 12:48:04 1995 Torbjorn Granlund + + * compat/struct-ret-1.c: Add prototype for f. + * compat/strct-layout.c: Conditionalize main. + +Sun Sep 10 20:47:34 1995 Torbjorn Granlund + + * execute/strct-pack-5.c: Delete, test is useless because of + lack of 68k structure packing. + +Thu Sep 7 13:07:40 1995 Torbjorn Granlund + + * execute/{930628-1.c,941202-1.c,arith-1.c,gofast.c,struct-ret-1.c, + va-arg-4.c}: Call exit(0), don't do return 0. + +Tue Sep 5 15:23:14 1995 Torbjorn Granlund + + * compat/strct-layout.c (main): Add missing call to exit. + +Tue Sep 5 15:23:14 1995 Torbjorn Granlund + + 1.35 Released. + + * noncompile/doit (case $arg): Fix typo. + + * execute/compndlit-1.c: New test. + * execute/loop-2.c: New test. + * execute/950809-1.c: New test. + * execute/va-arg-5.c: New test. + * execute/va-arg-6.c: New test. + * execute/ptr-arith-1.c: New test. + * execute/cmpsi-1.c: New test. + + * compile/cmpdi-1.c: New test. + * compile/950719-1.c: New test. + * compile/950729-1.c: New test. + * compile/950816-[123].c: New test. + * compile/: New test. + * compile/: New test. + * compile/: New test. + * compile/: New test. + +Fri Sep 5 09:30:32 1995 Michael Meissner + + * */doit: Add -run option to allow the use of a simulator to + run commands in the execute subdirectory. Accept the switch in + the other doit commands. + +Tue Jul 11 01:02:21 1995 Torbjorn Granlund + + * execute/950710-1.c: New test (from meyering). + +Wed Jul 5 16:03:45 1995 Torbjorn Granlund + + * compile/950618-1.c: New test. + * execute/scope-1.c: New test. + * execute/950621-1.c: New test. + * execute/950704-1.c: New test. + * execute/950628-1.c: New test. + +Wed Jun 14 15:20:44 1995 Torbjorn Granlund + + * execute/950612-1.c: New test. + * execute/cmpdi-1.c: New test. + * execute/tstdi-1.c: New test. + * compile/950613-1.c: New test. + * compile/950530-1.c: New test. + * compile/950610-1.c: New test. + * compile/950612-1.c: New test. + + * execute/strct-pack-5.c: Clean up, use defined type s2_t. + * execute/strct-pack-4.c: Clean up. + +Sat Jun 10 12:37:22 1995 Torbjorn Granlund + + * execute/cbrt.c: Disable for vax. + +Fri Jun 9 21:49:58 1995 Torbjorn Granlund + + * execute/940115-1.c: Cast parameters to char *. + +Thu Jun 8 00:33:51 1995 Torbjorn Granlund + + * compile/950607-1.c: New test. + * execute/cbrt.c: New test. + * execute/950607-[12].c: New tests. + * execute/memcpy-1.c: Try more cases. + * execute/struct-ret-2.c: New test. + * execute/complex-4.c: New test. + +Wed Jun 7 12:40:05 1995 Torbjorn Granlund + + * execute/950601.c: Delete this messy and redundant test. + + * compile/funcptr-1.c: Clean up. + + * execute/950512-1.c (main): Call f1 and f2 with 0 too. + (f2): Use type `long long', not `long'. + + * execute/950605-1.c: New test. + +Wed Jun 1 01:57:45 1995 Torbjorn Granlund + + * execute/divconst-[12].c: New tests. + + +Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + +Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. diff --git a/gcc/testsuite/gcc.c-torture/compat/strct-layout.c b/gcc/testsuite/gcc.c-torture/compat/strct-layout.c new file mode 100644 index 000000000..b77e1636d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compat/strct-layout.c @@ -0,0 +1,69 @@ +typedef struct +{ + char a; + int b; + char c; + short d; + double e; + char f; +} T; + +#if COMPILER != 1 +f (T *x) +{ + x[0].a = 'a'; + x[0].b = 47114711; + x[0].c = 'c'; + x[0].d = 1234; + x[0].e = 3.141592897932; + x[0].f = '*'; + + x[1].a = 'A'; + x[1].b = 71417141; + x[1].c = 'C'; + x[1].d = 4321; + x[1].e = 2.718281828459; + x[1].f = '?'; +} +#endif + +#if COMPILER != 2 +g (T *x) +{ + if (x[0].a != 'a') + abort (); + if (x[0].b != 47114711) + abort (); + if (x[0].c != 'c') + abort (); + if (x[0].d != 1234) + abort (); + if (x[0].e != 3.141592897932) + abort (); + if (x[0].f != '*') + abort (); + + if (x[1].a != 'A') + abort (); + if (x[1].b != 71417141) + abort (); + if (x[1].c != 'C') + abort (); + if (x[1].d != 4321) + abort (); + if (x[1].e != 2.718281828459) + abort (); + if (x[1].f != '?') + abort (); +} +#endif + +#if COMPILER != 2 +main () +{ + T x[2]; + f (x); + g (x); + exit (0); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/compat/struct-align.c b/gcc/testsuite/gcc.c-torture/compat/struct-align.c new file mode 100644 index 000000000..69fe6b335 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compat/struct-align.c @@ -0,0 +1,52 @@ +typedef union +{ + struct {int a; int b;} s; + double d; +} T; + +int h (T *); +T g (T); + +#if COMPILER != 1 +h (T *x) +{ + if (x->s.a != 0 || x->s.b != 1) + abort (); +} +#endif + +#if COMPILER != 2 +T +g (T x) +{ + if (x.s.a != 13 || x.s.b != 47) + abort (); + x.s.a = 0; + x.s.b = 1; + h (&x); + return x; +} +#endif + +#if COMPILER != 1 +f () +{ + T x; + x.s.a = 13; + x.s.b = 47; + g (x); + if (x.s.a != 13 || x.s.b != 47) + abort (); + x = g (x); + if (x.s.a != 0 || x.s.b != 1) + abort (); +} +#endif + +#if COMPILER != 2 +main () +{ + f (); + exit (0); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/compat/struct-big.c b/gcc/testsuite/gcc.c-torture/compat/struct-big.c new file mode 100644 index 000000000..e1d5c6a6b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compat/struct-big.c @@ -0,0 +1,54 @@ +typedef struct {int a, b, c, d, e;} T; + +int h (T *); +T g (T); + +#if COMPILER != 1 +h (T *x) +{ + if (x->a != 0 || x->b != 1 || x->c != 2 || x->d != 3 || x->e != 4) + abort (); +} +#endif + +#if COMPILER != 2 +T +g (T x) +{ + if (x.a != 13 || x.b != 47 || x.c != 123456 || x.d != -4711 || x.e != -2) + abort (); + x.a = 0; + x.b = 1; + x.c = 2; + x.d = 3; + x.e = 4; + h (&x); + return x; +} +#endif + +#if COMPILER != 1 +f () +{ + T x; + x.a = 13; + x.b = 47; + x.c = 123456; + x.d = -4711; + x.e = -2; + g (x); + if (x.a != 13 || x.b != 47 || x.c != 123456 || x.d != -4711 || x.e != -2) + abort (); + x = g (x); + if (x.a != 0 || x.b != 1 || x.c != 2 || x.d != 3 || x.e != 4) + abort (); +} +#endif + +#if COMPILER != 2 +main () +{ + f (); + exit (0); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/compat/struct-i.c b/gcc/testsuite/gcc.c-torture/compat/struct-i.c new file mode 100644 index 000000000..25cbee607 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compat/struct-i.c @@ -0,0 +1,46 @@ +typedef struct {int a;} T; + +int h (T *); +T g (T); + +#if COMPILER != 1 +h (T *x) +{ + if (x->a != 47114711) + abort (); +} +#endif + +#if COMPILER != 2 +T +g (T x) +{ + if (x.a != 13) + abort (); + x.a = 47114711; + h (&x); + return x; +} +#endif + +#if COMPILER != 1 +f () +{ + T x; + x.a = 13; + g (x); + if (x.a != 13) + abort (); + x = g (x); + if (x.a != 47114711) + abort (); +} +#endif + +#if COMPILER != 2 +main () +{ + f (); + exit (0); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/compat/struct-ic.c b/gcc/testsuite/gcc.c-torture/compat/struct-ic.c new file mode 100644 index 000000000..7c5fa79e1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compat/struct-ic.c @@ -0,0 +1,48 @@ +typedef struct {int a; char b;} T; + +int h (T *); +T g (T); + +#if COMPILER != 1 +h (T *x) +{ + if (x->a != 0 || x->b != 1) + abort (); +} +#endif + +#if COMPILER != 2 +T +g (T x) +{ + if (x.a != 13 || x.b != 47) + abort (); + x.a = 0; + x.b = 1; + h (&x); + return x; +} +#endif + +#if COMPILER != 1 +f () +{ + T x; + x.a = 13; + x.b = 47; + g (x); + if (x.a != 13 || x.b != 47) + abort (); + x = g (x); + if (x.a != 0 || x.b != 1) + abort (); +} +#endif + +#if COMPILER != 2 +main () +{ + f (); + exit (0); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/compat/struct-ii.c b/gcc/testsuite/gcc.c-torture/compat/struct-ii.c new file mode 100644 index 000000000..11ebc37ed --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compat/struct-ii.c @@ -0,0 +1,48 @@ +typedef struct {int a, b;} T; + +int h (T *); +T g (T); + +#if COMPILER != 1 +h (T *x) +{ + if (x->a != 0 || x->b != 1) + abort (); +} +#endif + +#if COMPILER != 2 +T +g (T x) +{ + if (x.a != 13 || x.b != 47) + abort (); + x.a = 0; + x.b = 1; + h (&x); + return x; +} +#endif + +#if COMPILER != 1 +f () +{ + T x; + x.a = 13; + x.b = 47; + g (x); + if (x.a != 13 || x.b != 47) + abort (); + x = g (x); + if (x.a != 0 || x.b != 1) + abort (); +} +#endif + +#if COMPILER != 2 +main () +{ + f (); + exit (0); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/compat/struct-ret-1.c b/gcc/testsuite/gcc.c-torture/compat/struct-ret-1.c new file mode 100644 index 000000000..a585c8fdb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compat/struct-ret-1.c @@ -0,0 +1,25 @@ +typedef struct { int re; int im; } T; + +T f (int, int); + +#if COMPILER != 1 +T +f (int arg1, int arg2) +{ + T x; + x.re = arg1; + x.im = arg2; + return x; +} +#endif + +#if COMPILER != 2 +main () +{ + T result; + result = f (3, 4); + if (result.re != 3 || result.im != 4) + abort (); + exit (0); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/20000105-1.c b/gcc/testsuite/gcc.c-torture/compile/20000105-1.c new file mode 100644 index 000000000..6f389d88b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000105-1.c @@ -0,0 +1,27 @@ +main(int na, char* argv[]) +{ + int wflg = 0, tflg = 0; + int dflg = 0; + exit(0); + while(1) + { + switch(argv[1][0]) + { + help: + exit(0); + case 'w': + case 'W': + wflg = 1; + break; + case 't': + case 'T': + tflg = 1; + break; + case 'd': + dflg = 1; + break; + } + } +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/20000105-2.c b/gcc/testsuite/gcc.c-torture/compile/20000105-2.c new file mode 100644 index 000000000..7689395f4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000105-2.c @@ -0,0 +1,5 @@ +foo () +{ + long long int i = (int) ""; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20000120-1.c b/gcc/testsuite/gcc.c-torture/compile/20000120-1.c new file mode 100644 index 000000000..99843933b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000120-1.c @@ -0,0 +1,13 @@ +extern char letters[26+1]; +char letter; +int letter_number; +char letters[] = "AbCdefghiJklmNopQrStuVwXyZ"; + +static void +pad_home1 () +{ + letter = letters[letter_number = + letters[letter_number + 1] ? letter_number + + 1 : 0]; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20000120-2.c b/gcc/testsuite/gcc.c-torture/compile/20000120-2.c new file mode 100644 index 000000000..737eb92ac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000120-2.c @@ -0,0 +1,18 @@ +extern __inline__ int +odd(int i) +{ + return i & 0x1; +} + +int +foo(int i, int j) +{ + return odd(i + j); +} + +int +odd(int i) +{ + return i & 0x1; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20000127-1.c b/gcc/testsuite/gcc.c-torture/compile/20000127-1.c new file mode 100644 index 000000000..34b173c68 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000127-1.c @@ -0,0 +1,7 @@ +double bar(void), c; +int foo(void) { + double a, b; + int i = bar() + bar(); + a = i; i += 1; a += 0.1; i = c + i; + return i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000211-1.c b/gcc/testsuite/gcc.c-torture/compile/20000211-1.c new file mode 100644 index 000000000..7a7c8c0cb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000211-1.c @@ -0,0 +1,98 @@ +typedef __SIZE_TYPE__ size_t; +typedef unsigned char Bufbyte; +typedef int Bytecount; +typedef int Charcount; +typedef struct lstream Lstream; +typedef int Lisp_Object; +extern Lisp_Object Qnil; +extern inline int +TRUE_LIST_P (Lisp_Object object) +{ + return (( object ) == ( Qnil )) ; +} +struct Lisp_String +{ + Bytecount _size; + Bufbyte *_data; +}; +typedef enum lstream_buffering +{ + LSTREAM_LINE_BUFFERED, +} Lstream_buffering; +struct lstream +{ + Lstream_buffering buffering; + unsigned char *out_buffer; + size_t out_buffer_size; + size_t out_buffer_ind; + size_t byte_count; + long flags; + char data[1]; +}; +typedef struct printf_spec printf_spec; +struct printf_spec +{ +}; +typedef union printf_arg printf_arg; +union printf_arg +{ +}; +typedef struct +{ + int cur; +} printf_spec_dynarr; +typedef struct +{ +} printf_arg_dynarr; +static void +doprnt_1 (Lisp_Object stream, const Bufbyte *string, Bytecount len, + Charcount minlen, Charcount maxlen, int minus_flag, int zero_flag) +{ + Charcount cclen; + Bufbyte pad; + Lstream *lstr = (( struct lstream *) ((void *)(((( stream ) & ((1UL << ((4 * 8 ) - 4 ) ) - 1UL) ) ) | 0x40000000 )) ) ; + cclen = ( len ) ; + if (zero_flag) + pad = '0'; + pad = ' '; +#if 0 + if (minlen > cclen && !minus_flag) +#endif + { + int to_add = minlen - cclen; + while (to_add > 0) + { + (( lstr )->out_buffer_ind >= ( lstr )->out_buffer_size ? Lstream_fputc ( lstr , pad ) : (( lstr )->out_buffer[( lstr )->out_buffer_ind++] = (unsigned char) ( pad ), ( lstr )->byte_count++, ( lstr )->buffering == LSTREAM_LINE_BUFFERED && ( lstr )->out_buffer[( lstr )->out_buffer_ind - 1] == '\n' ? Lstream_flush_out ( lstr ) : 0)) ; + to_add--; + } + } + if (maxlen >= 0) + len = ( ((( maxlen ) <= ( cclen )) ? ( maxlen ) : ( cclen )) ) ; + Lstream_write (lstr, string, len); + if (minlen > cclen && minus_flag) + { + int to_add = minlen - cclen; + while (to_add > 0) + { + (( lstr )->out_buffer_ind >= ( lstr )->out_buffer_size ? Lstream_fputc ( lstr , pad ) : (( lstr )->out_buffer[( lstr )->out_buffer_ind++] = (unsigned char) ( pad ), ( lstr )->byte_count++, ( lstr )->buffering == LSTREAM_LINE_BUFFERED && ( lstr )->out_buffer[( lstr )->out_buffer_ind - 1] == '\n' ? Lstream_flush_out ( lstr ) : 0)) ; + to_add--; + } + } +} +static Bytecount +emacs_doprnt_1 (Lisp_Object stream, const Bufbyte *format_nonreloc, + Lisp_Object format_reloc, Bytecount format_length, + int nargs, + const Lisp_Object *largs) +{ + int i; + printf_spec_dynarr *specs = 0; + format_nonreloc = (( (( struct Lisp_String *) ((void *)(((( format_reloc ) & ((1UL << ((4 * 8 ) - 4 ) ) - 1UL) ) ) | 0x40000000 )) ) )->_data + 0) ; + format_length = (( (( struct Lisp_String *) ((void *)(((( format_reloc ) & ((1UL << ((4 * 8 ) - 4 ) ) - 1UL) ) ) | 0x40000000 )) ) )->_size) ; + specs = parse_doprnt_spec (format_nonreloc, format_length); + for (i = 0; i < (( specs )->cur) ; i++) + { + char ch; + doprnt_1 (stream, (Bufbyte *) &ch, 1, 0, -1, 0, 0); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000211-3.c b/gcc/testsuite/gcc.c-torture/compile/20000211-3.c new file mode 100644 index 000000000..7a02b685c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000211-3.c @@ -0,0 +1,10 @@ +void f_clos(int x) + +{ + switch(x) { + default: + mumble:; + } +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/20000224-1.c b/gcc/testsuite/gcc.c-torture/compile/20000224-1.c new file mode 100644 index 000000000..1c72b6acc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000224-1.c @@ -0,0 +1,41 @@ +enum Lisp_Type +{ + Lisp_Int + ,Lisp_Record + ,Lisp_Cons + ,Lisp_String + ,Lisp_Vector + ,Lisp_Symbol + ,Lisp_Char +}; +typedef +union Lisp_Object + { + struct + { + enum Lisp_Type type: 3L ; + unsigned long markbit: 1; + unsigned long val: 32; + } gu; + long i; + } +Lisp_Object; +extern int initialized; +void +init_device_faces (int *d) +{ + if (initialized) + { + Lisp_Object tdevice; + do { + tdevice = (union Lisp_Object) + { gu: + { markbit: 0, + type: Lisp_Record, + val: ((unsigned long )d) + } + }; + } while (0); + call_critical_lisp_code (tdevice); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000314-1.c b/gcc/testsuite/gcc.c-torture/compile/20000314-1.c new file mode 100644 index 000000000..26c13a7d6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000314-1.c @@ -0,0 +1,11 @@ +struct { + char a[5]; +} *p; + +int main () +{ + int i = -1; + + if(p->a[-i]) + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000314-2.c b/gcc/testsuite/gcc.c-torture/compile/20000314-2.c new file mode 100644 index 000000000..3fdb3c3a8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000314-2.c @@ -0,0 +1,6 @@ +extern void malloc(__SIZE_TYPE__ size); + +toto() +{ + malloc(100); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000319-1.c b/gcc/testsuite/gcc.c-torture/compile/20000319-1.c new file mode 100644 index 000000000..db00e4f01 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000319-1.c @@ -0,0 +1,6 @@ +struct foo +{ + long x; + char y; + long boom[0]; +}; diff --git a/gcc/testsuite/gcc.c-torture/compile/20000326-1.c b/gcc/testsuite/gcc.c-torture/compile/20000326-1.c new file mode 100644 index 000000000..71ed149c8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000326-1.c @@ -0,0 +1,23 @@ +long sys_reboot(int magic1, int magic2, int cmd, void * arg) +{ + switch (cmd) { + case 0x89ABCDEF: + break; + + case 0x00000000: + break; + + case 0xCDEF0123: + break; + + case 0x4321FEDC: + break; + + case 0xA1B2C3D4: + break; + + default: + break; + }; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000326-2.c b/gcc/testsuite/gcc.c-torture/compile/20000326-2.c new file mode 100644 index 000000000..055260f6e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000326-2.c @@ -0,0 +1,13 @@ +#ifndef NO_LABEL_VALUES +extern int printk(const char *fmt, ...); + +void foo (int x, int y) +{ + __label__ here; + here: + printk ("", &&here); +} + +#else +int x; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/20000329-1.c b/gcc/testsuite/gcc.c-torture/compile/20000329-1.c new file mode 100644 index 000000000..547bf96f9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000329-1.c @@ -0,0 +1,40 @@ +int giop_tx_big_endian; + +inline +void +giop_encode_ulong (unsigned long i, char *buf) +{ + if (giop_tx_big_endian) + { + *(unsigned long *) buf = i; + } + else + { + *buf++ = i & 0xff; + *buf++ = (i >> 8) & 0xff; + *buf++ = (i >> 16) & 0xff; + *buf = (i >> 24) & 0xff; + } +} + + + +static +double +time_giop_encode (unsigned long l) +{ + int c; + char buf[4]; + + for (c = 0; c < (512 * 1024 * 1024); ++c) + { + giop_encode_ulong (l, buf); + } +} + +int +main (int ac, char *av[]) +{ + giop_tx_big_endian = 1; + time_giop_encode (0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000403-1.c b/gcc/testsuite/gcc.c-torture/compile/20000403-1.c new file mode 100644 index 000000000..27345b56f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000403-1.c @@ -0,0 +1,18 @@ +struct utsname { + char sysname[32 ]; + char version[32 ]; +}; +int +uname(name) + struct utsname *name; +{ + int mib[2], rval; + long len; + char *p; + int oerrno; + if (sysctl(mib, 2, &name->sysname, &len, 0 , 0) == -1) + ; + for (p = name->version; len--; ++p) { + *p = ' '; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000403-2.c b/gcc/testsuite/gcc.c-torture/compile/20000403-2.c new file mode 100644 index 000000000..c793a49fb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000403-2.c @@ -0,0 +1,6 @@ +void +foo () +{ + long long tmp; + (( tmp ) = (long long)( tmp ) >> ( 32 )) ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000405-1.c b/gcc/testsuite/gcc.c-torture/compile/20000405-1.c new file mode 100644 index 000000000..64dd2e168 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000405-1.c @@ -0,0 +1,13 @@ +// Copyright (C) 2000 Free Software Foundation + +// by Alexandre Oliva +// simplified from libio/floatconv.c + +static const double bar[] = { 0 }; +int j; + +double +foo () +{ + return bar[j]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000405-2.c b/gcc/testsuite/gcc.c-torture/compile/20000405-2.c new file mode 100644 index 000000000..0b8559f14 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000405-2.c @@ -0,0 +1,6 @@ +extern void foo (int); + +void bar (unsigned long l) +{ + foo(l == 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000405-3.c b/gcc/testsuite/gcc.c-torture/compile/20000405-3.c new file mode 100644 index 000000000..c2e88339e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000405-3.c @@ -0,0 +1,9 @@ +struct foo { + void *entry[40]; +} __attribute__ ((aligned(32))); + +int foo (struct foo *ptr, int idx, void *pointer) +{ + ptr->entry[idx] = pointer; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000412-1.c b/gcc/testsuite/gcc.c-torture/compile/20000412-1.c new file mode 100644 index 000000000..243b469e7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000412-1.c @@ -0,0 +1,16 @@ +typedef struct { + short a; + short b; +} s1; + +extern void g(unsigned char *b); + +void f(void) +{ + s1 a; + unsigned char *b; + + a.a = 0; + b = (unsigned char *)&a; + g(b); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000412-2.c b/gcc/testsuite/gcc.c-torture/compile/20000412-2.c new file mode 100644 index 000000000..e76a1eb73 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000412-2.c @@ -0,0 +1,4 @@ +char list[250][64]; + +int f(int idx) { return (strlen(list[idx])); } + diff --git a/gcc/testsuite/gcc.c-torture/compile/20000420-1.c b/gcc/testsuite/gcc.c-torture/compile/20000420-1.c new file mode 100644 index 000000000..552f02e42 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000420-1.c @@ -0,0 +1,19 @@ +struct z_candidate { struct z_candidate *next;int viable;}; +int pedantic; + +static struct z_candidate * +splice_viable (cands) + struct z_candidate *cands; +{ + struct z_candidate **p = &cands; + + for (; *p; ) + { + if (pedantic ? (*p)->viable == 1 : (*p)->viable) + p = &((*p)->next); + else + *p = (*p)->next; + } + + return cands; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000420-2.c b/gcc/testsuite/gcc.c-torture/compile/20000420-2.c new file mode 100644 index 000000000..2d825f019 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000420-2.c @@ -0,0 +1,11 @@ +struct x { int a, b, c; }; + +extern struct x a (); +extern void b (struct x); + +void +foo () +{ + a (); + b (a ()); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000427-1.c b/gcc/testsuite/gcc.c-torture/compile/20000427-1.c new file mode 100644 index 000000000..dc51419cf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000427-1.c @@ -0,0 +1,9 @@ +int lwidth; +int lheight; +void ConvertFor3dDriver (int requirePO2, int maxAspect) +{ + int oldw = lwidth, oldh = lheight; + + lheight = FindNearestPowerOf2 (lheight); + while (lwidth/lheight > maxAspect) lheight += lheight; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000502-1.c b/gcc/testsuite/gcc.c-torture/compile/20000502-1.c new file mode 100644 index 000000000..fcf7899a1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000502-1.c @@ -0,0 +1,17 @@ +static int minimum(int a, int b) +{ + if(a < b) + return a; + else + return b; +} +static int a, b; +static inline int foo(void) +{ + a = minimum (a, b); + return 0; +} +static int bar(void) +{ + return foo(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000504-1.c b/gcc/testsuite/gcc.c-torture/compile/20000504-1.c new file mode 100644 index 000000000..1941bb34d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000504-1.c @@ -0,0 +1,15 @@ +struct foo { + int a; + int b; +}; + +int func(struct foo *foo, int a) +{ + if (foo->b == 0) { + int ret = foo->a = a; + if (a >= 0) + foo->a = a; + return (ret); + } + return (0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000511-1.c b/gcc/testsuite/gcc.c-torture/compile/20000511-1.c new file mode 100644 index 000000000..11c131522 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000511-1.c @@ -0,0 +1,31 @@ +typedef struct { + char y; + char x[32]; +} X; + +int z (void) +{ + X xxx; + xxx.x[0] = + xxx.x[31] = '0'; + xxx.y = 0xf; + return f (xxx, xxx); +} + +int main (void) +{ + int val; + + val = z (); + if (val != 0x60) + abort (); + exit (0); +} + +int f(X x, X y) +{ + if (x.y != y.y) + return 'F'; + + return x.x[0] + y.x[0]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000517-1.c b/gcc/testsuite/gcc.c-torture/compile/20000517-1.c new file mode 100644 index 000000000..903e61eef --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000517-1.c @@ -0,0 +1,9 @@ +void test2 (int*, int, int, int); + +void test () +{ + int l; + + test2 (0, 0, 0, 0); + test2 (&l, 0, 0, 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000518-1.c b/gcc/testsuite/gcc.c-torture/compile/20000518-1.c new file mode 100644 index 000000000..d2087796a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000518-1.c @@ -0,0 +1,17 @@ +void callit1(void*); + +extern __inline__ void test() +{ + __label__ l1; + + callit1(&&l1); + +l1:; + +} + + +void dotest() +{ + test(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000523-1.c b/gcc/testsuite/gcc.c-torture/compile/20000523-1.c new file mode 100644 index 000000000..eab4a9c42 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000523-1.c @@ -0,0 +1,5 @@ +/* Copyright (C) 2000 Free Software Foundation */ +/* Contributed by Alexandre Oliva */ + +enum { foo = sizeof(void *) }; +int i = sizeof(void *); diff --git a/gcc/testsuite/gcc.c-torture/compile/20000605-1.c b/gcc/testsuite/gcc.c-torture/compile/20000605-1.c new file mode 100644 index 000000000..1fe588234 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000605-1.c @@ -0,0 +1,22 @@ +/* Copyright (C) 2000 Free Software Foundation */ + +/* make sure we don't get confused by various flavors of void */ + +/* Origin: Jakub Jelinek + * Joel Sherrill + */ + +typedef void foo; +foo bar(void); +void baz(void) +{ + bar(); +} + +void volatile f(); + +int x() +{ + f(); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20000606-1.c b/gcc/testsuite/gcc.c-torture/compile/20000606-1.c new file mode 100644 index 000000000..93977c093 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000606-1.c @@ -0,0 +1,10 @@ +typedef struct _foo foo; +extern foo bar; +struct _foo { + int a; +}; + +void baz(void) +{ + bar.a = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000609-1.c b/gcc/testsuite/gcc.c-torture/compile/20000609-1.c new file mode 100644 index 000000000..f03aa35a7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000609-1.c @@ -0,0 +1,6 @@ +int main () +{ + char temp[1024] = "tempfile"; + return temp[0] != 't'; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20000629-1.c b/gcc/testsuite/gcc.c-torture/compile/20000629-1.c new file mode 100644 index 000000000..58b522ed8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000629-1.c @@ -0,0 +1,28 @@ +struct a +{ + struct a * x; +}; + +void +foo (struct a * b) +{ + int i; + + for (i = 0; i < 1000; i++) + { + b->x = b; + b++; + } +} + +void +bar (struct a * b) +{ + int i; + + for (i = 0; i < 1000; i++) + { + b->x = b; + b--; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000701-1.c b/gcc/testsuite/gcc.c-torture/compile/20000701-1.c new file mode 100644 index 000000000..2f1e73157 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000701-1.c @@ -0,0 +1,19 @@ +void +dr106_1(void *pv, int i) +{ + *pv; + i ? *pv : *pv; + *pv, *pv; +} + +void +dr106_2(const void *pcv, volatile void *pvv, int i) +{ + *pcv; + i ? *pcv : *pcv; + *pcv, *pcv; + + *pvv; + i ? *pvv : *pvv; + *pvv, *pvv; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000717-1.c b/gcc/testsuite/gcc.c-torture/compile/20000717-1.c new file mode 100644 index 000000000..9a0c747ad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000717-1.c @@ -0,0 +1,11 @@ +short +inner_product (short *a, short *b) +{ + int i; + short sum = 0; + + for (i = 9; i >= 0; i--) + sum += (*a++) * (*b++); + + return sum; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000718.c b/gcc/testsuite/gcc.c-torture/compile/20000718.c new file mode 100644 index 000000000..acabaf160 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000718.c @@ -0,0 +1,14 @@ +extern double foo(double, double); +extern void bar(float*, int*); + +void +baz(int* arg) +{ + float tmp = (float)foo(2.0,1.0); + unsigned i; + short junk[64]; + + for (i=0; i<10; i++, arg++) { + bar(&tmp, arg); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000728-1.c b/gcc/testsuite/gcc.c-torture/compile/20000728-1.c new file mode 100644 index 000000000..f56d94083 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000728-1.c @@ -0,0 +1,16 @@ +struct clock { + long sec; long usec; +}; + +int foo(void) +{ + struct clock clock_old = {0, 0}; + + for (;;) { + long foo; + + if (foo == clock_old.sec && 0 == clock_old.usec); + } + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20000802-1.c b/gcc/testsuite/gcc.c-torture/compile/20000802-1.c new file mode 100644 index 000000000..0b2f1d6af --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000802-1.c @@ -0,0 +1,15 @@ +struct foo { + char a[3]; + char b; + char c; +}; + +struct foo bs; +int x; +char y[3]; + +void bar(void) +{ + memcpy(bs.a, y, 3); + bs.a[1] = ((x ? &bs.b : &bs.c) - (char *)&bs) - 2; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000803-1.c b/gcc/testsuite/gcc.c-torture/compile/20000803-1.c new file mode 100644 index 000000000..08b50a9f2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000803-1.c @@ -0,0 +1,11 @@ +static int gl_cnt = 0; +static char gl_buf[1024]; + +void +gl_yank() +{ + int i; + + for (i=gl_cnt; i >= 0; i--) + gl_buf[i+10] = gl_buf[i]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000804-1.c b/gcc/testsuite/gcc.c-torture/compile/20000804-1.c new file mode 100644 index 000000000..0a63a32df --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000804-1.c @@ -0,0 +1,20 @@ +/* This does not work on m68hc11 or h8300 due to the use of an asm + statement to force a 'long long' (64-bits) to go in a register. */ +/* { dg-do assemble } */ +/* { dg-skip-if "" { { i?86-*-* x86_64-*-* } && { ilp32 && { ! nonpic } } } { "*" } { "" } } */ +/* { dg-skip-if "No 64-bit registers" { m32c-*-* } { "*" } { "" } } */ +/* { dg-skip-if "Not enough 64-bit registers" { pdp11-*-* } { "-O0" } { "" } } */ +/* { dg-xfail-if "" { m6811-*-* m6812-*-* h8300-*-* } { "*" } { "" } } */ + +/* Copyright (C) 2000, 2003 Free Software Foundation */ +__complex__ long long f () +{ + int i[99]; + __complex__ long long v; + + v += f (); + asm("": "+r" (v) : "r" (0), "r" (1)); + v = 2; + return v; + g (&v); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000818-1.c b/gcc/testsuite/gcc.c-torture/compile/20000818-1.c new file mode 100644 index 000000000..01f10f60c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000818-1.c @@ -0,0 +1,6 @@ +void +foo (long double x) +{ + struct {long double t;} y = {x}; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20000825-1.c b/gcc/testsuite/gcc.c-torture/compile/20000825-1.c new file mode 100644 index 000000000..3c2e5bda7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000825-1.c @@ -0,0 +1,31 @@ +typedef signed int s32; +typedef signed long s64; +typedef unsigned int u32; +typedef unsigned long u64; + +extern __inline__ u32 foobar(int logmask) +{ + u32 ret = ~(1 << logmask); // fails + // s32 ret = ~(1 << logmask); // ok + // u64 ret = ~(1 << logmask); // ok + // s64 ret = ~(1 << logmask); // ok + return ret; +} + +// This procedure compiles fine... +u32 good(u32 var) +{ + var = foobar(0); + return var; +} + +// This procedure does not compile... +// Same as above, but formal parameter is a pointer +// Both good() and fails() compile ok if we choose +// a different type for "ret" in foobar(). +u32 fails(u32 *var) +{ + *var = foobar(0); + return *var; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20000827-1.c b/gcc/testsuite/gcc.c-torture/compile/20000827-1.c new file mode 100644 index 000000000..a985f908b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000827-1.c @@ -0,0 +1,17 @@ +/* Copyright (C) 2000 Free Software Foundation */ +/* Contributed by Alexandre Oliva */ + +int +foo () +{ + while (1) + { + int a; + char b; + /* gcse should not merge these asm statements, since their + output operands have different modes. */ + __asm__("":"=r" (a)); __asm__("":"=r" (b)); + if (b) + return a; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000922-1.c b/gcc/testsuite/gcc.c-torture/compile/20000922-1.c new file mode 100644 index 000000000..0fef966e6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000922-1.c @@ -0,0 +1,12 @@ +extern void doit(int); +void +quick_doit(int x) +{ +#ifdef __OPTIMIZE__ + if (__builtin_constant_p (x) + && x != 0) + asm volatile ("%0" : : "i#*X"(x)); + else +#endif + doit(x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20000923-1.c b/gcc/testsuite/gcc.c-torture/compile/20000923-1.c new file mode 100644 index 000000000..9ed988682 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20000923-1.c @@ -0,0 +1,8 @@ +const int a = 3; +const int b = 50; + +void foo (void) +{ + long int x[a][b]; + asm ("" : : "r" (x) : "memory"); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001018-1.c b/gcc/testsuite/gcc.c-torture/compile/20001018-1.c new file mode 100644 index 000000000..86e5cd5dd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001018-1.c @@ -0,0 +1,10 @@ +void +foo (void) +{ + extern char i[10]; + + { + extern char i[]; + char x[sizeof (i) == 10 ? 1 : -1]; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001024-1.c b/gcc/testsuite/gcc.c-torture/compile/20001024-1.c new file mode 100644 index 000000000..59208cde1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001024-1.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2000 Free Software Foundation */ +/* Contributed by Nathan Sidwell */ + +typedef __SIZE_TYPE__ size_t; + +extern void *memset(void *, int, size_t); + +struct Baz; + +void quux(struct Baz *context) +{ + memset(context, 0, 4); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001109-1.c b/gcc/testsuite/gcc.c-torture/compile/20001109-1.c new file mode 100644 index 000000000..6e513c956 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001109-1.c @@ -0,0 +1,9 @@ +/* This does not work on NetWare, which has a default of 1-byte alignment. */ +/* { dg-xfail-if "" { "*-*-netware*" } { "*" } { "" } } */ +typedef struct _foo foo; +extern foo bar; +struct _foo { + int a; +}; + +int tst[__alignof__ (bar) >= __alignof__ (int) ? 1 : -1]; diff --git a/gcc/testsuite/gcc.c-torture/compile/20001109-2.c b/gcc/testsuite/gcc.c-torture/compile/20001109-2.c new file mode 100644 index 000000000..1448215c5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001109-2.c @@ -0,0 +1,8 @@ +/* This does not work on NetWare, which has a default of 1-byte alignment. */ +/* { dg-xfail-if "" { "*-*-netware*" } { "*" } { "" } } */ +extern struct foo bar; +struct foo { + int a; +}; + +int tst[__alignof__ (bar) >= __alignof__ (int) ? 1 : -1]; diff --git a/gcc/testsuite/gcc.c-torture/compile/20001116-1.c b/gcc/testsuite/gcc.c-torture/compile/20001116-1.c new file mode 100644 index 000000000..c356392fa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001116-1.c @@ -0,0 +1,3 @@ +int x[60]; +char *y = ((char*)&(x[2*8 + 2]) - 8); +int z = (&"Foobar"[1] - &"Foobar"[0]); diff --git a/gcc/testsuite/gcc.c-torture/compile/20001121-1.c b/gcc/testsuite/gcc.c-torture/compile/20001121-1.c new file mode 100644 index 000000000..38efe6da0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001121-1.c @@ -0,0 +1,21 @@ +extern int bar(int); + +int foo(int x) +{ + return 1 + bar( + ({ + int y; + switch (x) + { + case 0: y = 1; break; + case 1: y = 2; break; + case 2: y = 3; break; + case 3: y = 4; break; + case 4: y = 5; break; + case 5: y = 6; break; + default: y = 7; break; + } + y; + }) + ); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001123-1.c b/gcc/testsuite/gcc.c-torture/compile/20001123-1.c new file mode 100644 index 000000000..59534480d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001123-1.c @@ -0,0 +1,11 @@ + +typedef __builtin_va_list __gnuc_va_list; +typedef __gnuc_va_list va_list; + +struct X { int y; }; + +void func(va_list va) +{ + char* a = __builtin_va_arg(va, char**)[0]; + int b = __builtin_va_arg(va, struct X*)->y; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001123-2.c b/gcc/testsuite/gcc.c-torture/compile/20001123-2.c new file mode 100644 index 000000000..dcb5dd1fa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001123-2.c @@ -0,0 +1,21 @@ +/* Copyright 2000 Free Software Foundation + + by Alexandre Oliva + + Based on zlib/gzio.c. + + This used to generate duplicate labels when compiled with + sh-elf-gcc -O2 -m3 -fPIC. + + Bug reported by NIIBE Yutaka . */ + +void foo (void); + +void +bar () +{ + unsigned len; + + for (len = 0; len < 2; len++) + foo (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001205-1.c b/gcc/testsuite/gcc.c-torture/compile/20001205-1.c new file mode 100644 index 000000000..bab7b69ca --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001205-1.c @@ -0,0 +1,26 @@ +/* This does not work on m68hc11 due to the asm statement which forces + two 'long' (32-bits) variables to go in registers. */ +/* { dg-do assemble } */ +/* { dg-xfail-if "" { m6811-*-* m6812-*-* } { "*" } { "" } } */ + +static inline unsigned long rdfpcr(void) +{ + unsigned long tmp, ret; + __asm__ ("" : "=r"(tmp), "=r"(ret)); + return ret; +} + +static inline unsigned long +swcr_update_status(unsigned long swcr, unsigned long fpcr) +{ + swcr &= ~0x7e0000ul; + swcr |= (fpcr >> 3) & 0x7e0000ul; + return swcr; +} + +unsigned long osf_getsysinfo(unsigned long flags) +{ + unsigned long w; + w = swcr_update_status(flags, rdfpcr()); + return w; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001212-1.c b/gcc/testsuite/gcc.c-torture/compile/20001212-1.c new file mode 100644 index 000000000..009138c5d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001212-1.c @@ -0,0 +1,10 @@ +typedef struct +{ + long double l; +} ld; + +ld a (ld x, ld y) +{ + ld b; + b.l = x.l + y.l; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001221-1.c b/gcc/testsuite/gcc.c-torture/compile/20001221-1.c new file mode 100644 index 000000000..66ae71411 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001221-1.c @@ -0,0 +1,70 @@ +static void +foo () +{ + long maplength; + int type; + { + const long nibbles = 8; + char buf1[nibbles + 1]; + char buf2[nibbles + 1]; + char buf3[nibbles + 1]; + buf1[nibbles] = '\0'; + buf2[nibbles] = '\0'; + buf3[nibbles] = '\0'; + ((nibbles) <= 16 + ? (({ + void *__s = (buf1); + union + { + unsigned int __ui; + unsigned short int __usi; + unsigned char __uc; + } + *__u = __s; + unsigned char __c = (unsigned char)('0'); + switch ((unsigned int) (nibbles)) + { + case 16: + __u->__ui = __c * 0x01010101; + __u = __extension__ ((void *) __u + 4); + case 12: + __u->__ui = __c * 0x01010101; + __u = __extension__ ((void *) __u + 4); + case 0: + break; + } + __s; + })) + : 0); + ((nibbles) <= 16 + ? (({ + void *__s = (buf2); + union + { + unsigned int __ui; + unsigned short int __usi; + unsigned char __uc; + } + *__u = __s; + unsigned char __c = (unsigned char)('0'); + switch ((unsigned int) (nibbles)) + { + case 16: + __u->__ui = __c * 0x01010101; + __u = __extension__ ((void *) __u + 4); + case 12: + __u->__ui = __c * 0x01010101; + __u = __extension__ ((void *) __u + 4); + case 8: + __u->__ui = __c * 0x01010101; + __u = __extension__ ((void *) __u + 4); + case 4: + __u->__ui = __c * 0x01010101; + case 0: + break; + } + __s; + })) + : 0); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001222-1.c b/gcc/testsuite/gcc.c-torture/compile/20001222-1.c new file mode 100644 index 000000000..de97eeef7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001222-1.c @@ -0,0 +1,6 @@ +/* Testcase for PR c/1501. */ +double __complex__ +f (void) +{ + return ~(1.0 + 2.0i); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20001226-1.c b/gcc/testsuite/gcc.c-torture/compile/20001226-1.c new file mode 100644 index 000000000..8c93baccd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20001226-1.c @@ -0,0 +1,37 @@ +/* This does not assemble on m68hc11 because the function is larger + than 64K. */ +/* { dg-do assemble } */ +/* { dg-xfail-if "function larger than 64K" { m6811-*-* } { "*" } { "" } } */ +/* { dg-skip-if "too much code for avr" { "avr-*-*" } { "*" } { "" } } */ +/* { dg-skip-if "too much code for pdp11" { "pdp11-*-*" } { "*" } { "" } } */ +/* { dg-xfail-if "jump beyond 128K not supported" { xtensa*-*-* } { "-O0" } { "" } } */ +/* { dg-xfail-if "PR36698" { spu-*-* } { "-O0" } { "" } } */ +/* { dg-skip-if "" { m32c-*-* } { "*" } { "" } } */ +/* { dg-timeout-factor 4.0 } */ + +/* This testcase exposed two branch shortening bugs on powerpc. */ + +#define C(a,b) \ + if (a > b) goto gt; \ + if (a < b) goto lt; + +#define C4(x,b) C((x)[0], b) C((x)[1],b) C((x)[2],b) C((x)[3],b) +#define C16(x,y) C4(x, (y)[0]) C4(x, (y)[1]) C4(x, (y)[2]) C4(x, (y)[3]) + +#define C64(x,y) C16(x,y) C16(x+4,y) C16(x+8,y) C16(x+12,y) +#define C256(x,y) C64(x,y) C64(x,y+4) C64(x,y+8) C64(x,y+12) + +#define C1024(x,y) C256(x,y) C256(x+16,y) C256(x+32,y) C256(x+48,y) +#define C4096(x,y) C1024(x,y) C1024(x,y+16) C1024(x,y+32) C1024(x,y+48) + +unsigned foo(int x[64], int y[64]) +{ + C4096(x,y); + + return 0x01234567; + gt: + return 0x12345678; + lt: + return 0xF0123456; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/200031109-1.c b/gcc/testsuite/gcc.c-torture/compile/200031109-1.c new file mode 100644 index 000000000..d1d495bac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/200031109-1.c @@ -0,0 +1,11 @@ +/* For a short time on the tree-ssa branch this would warn that + value was not initialized as it was optimizing !(value = (m?1:2)) + to 0 and not setting value before. */ + +int t(int m) +{ + int value; + if (!(value = (m?1:2))) + value = 0; + return value; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010102-1.c b/gcc/testsuite/gcc.c-torture/compile/20010102-1.c new file mode 100644 index 000000000..a409b5660 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010102-1.c @@ -0,0 +1,101 @@ +/* This testcase derives from gnu obstack.c/obstack.h and failed with + -O3 -funroll-all-loops, or -O1 -frename-registers -funroll-loops on + sparc-sun-solaris2.7. + + Copyright (C) 2001 Free Software Foundation. */ + +# define PTR_INT_TYPE __PTRDIFF_TYPE__ + +struct _obstack_chunk +{ + char *limit; + struct _obstack_chunk *prev; + char contents[4]; +}; + +struct obstack +{ + long chunk_size; + struct _obstack_chunk *chunk; + char *object_base; + char *next_free; + char *chunk_limit; + PTR_INT_TYPE temp; + int alignment_mask; + struct _obstack_chunk *(*chunkfun) (void *, long); + void (*freefun) (void *, struct _obstack_chunk *); + void *extra_arg; + unsigned use_extra_arg:1; + unsigned maybe_empty_object:1; + unsigned alloc_failed:1; +}; + +extern void _obstack_newchunk (struct obstack *, int); + +struct fooalign {char x; double d;}; +#define DEFAULT_ALIGNMENT \ + ((PTR_INT_TYPE) ((char *) &((struct fooalign *) 0)->d - (char *) 0)) +union fooround {long x; double d;}; +#define DEFAULT_ROUNDING (sizeof (union fooround)) + +#ifndef COPYING_UNIT +#define COPYING_UNIT int +#endif + +#define CALL_CHUNKFUN(h, size) \ + (((h) -> use_extra_arg) \ + ? (*(h)->chunkfun) ((h)->extra_arg, (size)) \ + : (*(struct _obstack_chunk *(*) (long)) (h)->chunkfun) ((size))) + +#define CALL_FREEFUN(h, old_chunk) \ + do { \ + if ((h) -> use_extra_arg) \ + (*(h)->freefun) ((h)->extra_arg, (old_chunk)); \ + else \ + (*(void (*) (void *)) (h)->freefun) ((old_chunk)); \ + } while (0) + +void +_obstack_newchunk (h, length) + struct obstack *h; + int length; +{ + register struct _obstack_chunk *old_chunk = h->chunk; + register struct _obstack_chunk *new_chunk; + register long new_size; + register long obj_size = h->next_free - h->object_base; + register long i; + long already; + + new_size = (obj_size + length) + (obj_size >> 3) + 100; + if (new_size < h->chunk_size) + new_size = h->chunk_size; + + new_chunk = CALL_CHUNKFUN (h, new_size); + h->chunk = new_chunk; + new_chunk->prev = old_chunk; + new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size; + + if (h->alignment_mask + 1 >= DEFAULT_ALIGNMENT) + { + for (i = obj_size / sizeof (COPYING_UNIT) - 1; + i >= 0; i--) + ((COPYING_UNIT *)new_chunk->contents)[i] + = ((COPYING_UNIT *)h->object_base)[i]; + already = obj_size / sizeof (COPYING_UNIT) * sizeof (COPYING_UNIT); + } + else + already = 0; + for (i = already; i < obj_size; i++) + new_chunk->contents[i] = h->object_base[i]; + + if (h->object_base == old_chunk->contents && ! h->maybe_empty_object) + { + new_chunk->prev = old_chunk->prev; + CALL_FREEFUN (h, old_chunk); + } + + h->object_base = new_chunk->contents; + h->next_free = h->object_base + obj_size; + h->maybe_empty_object = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010107-1.c b/gcc/testsuite/gcc.c-torture/compile/20010107-1.c new file mode 100644 index 000000000..222def4d9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010107-1.c @@ -0,0 +1,6 @@ +unsigned long x[4]; + +void foo(void) +{ + ((void (*)())(x+2))(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010112-1.c b/gcc/testsuite/gcc.c-torture/compile/20010112-1.c new file mode 100644 index 000000000..69bbe169e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010112-1.c @@ -0,0 +1,14 @@ +/* Test that putting an initialized variable in a register works. */ + +#ifdef __i386__ +#define REGISTER asm ("eax") +#elif defined (__arm__) +#define REGISTER asm ("r0") +#else +/* Put examples for other architectures here. */ +#define REGISTER +#endif + +void f() { + register int i REGISTER = 3; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010113-1.c b/gcc/testsuite/gcc.c-torture/compile/20010113-1.c new file mode 100644 index 000000000..35b7c1f1d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010113-1.c @@ -0,0 +1,15 @@ +/* Origin: PR c/364 from and@genesyslab.com, very much reduced to a + testcase by Joseph Myers . + + The initializer of z is a valid address constant, and GCC 2.95.2 + accepts it as such. CVS GCC as of 2001-01-13 rejects it, but accepts + it if y is changed to x in the initializer. */ + +struct { + struct { + int x; + int y; + } p; +} v; + +int *z = &((&(v.p))->y); diff --git a/gcc/testsuite/gcc.c-torture/compile/20010114-1.c b/gcc/testsuite/gcc.c-torture/compile/20010114-1.c new file mode 100644 index 000000000..9b608aad1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010114-1.c @@ -0,0 +1,5 @@ +/* Origin: PR c/166 from Joerg Czeranski . */ +/* In the declaration of proc, x cannot be parsed as a typedef name, + so it must be parsed as a parameter name. */ +typedef int x; +void proc(int (*x)(void)) {} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010114-2.c b/gcc/testsuite/gcc.c-torture/compile/20010114-2.c new file mode 100644 index 000000000..75f5ea20e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010114-2.c @@ -0,0 +1,6 @@ +/* Origin: + from Fred Fish . See also PR c/1625. */ + +#include + +struct { int x; bool y; } foo = { 0, false }; diff --git a/gcc/testsuite/gcc.c-torture/compile/20010117-1.c b/gcc/testsuite/gcc.c-torture/compile/20010117-1.c new file mode 100644 index 000000000..d0772b3c3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010117-1.c @@ -0,0 +1,7 @@ +unsigned char u, v, w; + +void baz (void) +{ + if ((u - v - w) & 0x80) + v = 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010117-2.c b/gcc/testsuite/gcc.c-torture/compile/20010117-2.c new file mode 100644 index 000000000..813468b56 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010117-2.c @@ -0,0 +1,20 @@ +unsigned char a, b; + +void baz (void) +{ + if (b & 0x08) + { + int g = 0; + int c = (b & 0x01); + int d = a - g - c; + int e = (a & 0x0f) - (g & 0x0f); + int f = (a & 0xf0) - (g & 0xf0); + int h = (a & 0x0f) - (g & 0x0f); + + if ((a ^ g) & (a ^ d) & 0x80) b |= 0x40; + if ((d & 0xff00) == 0) b |= 0x01; + if (!((a - h - c) & 0xff)) b |= 0x02; + if ((a - g - c) & 0x80) b |= 0x80; + a = (e & 0x0f) | (f & 0xf0); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010118-1.c b/gcc/testsuite/gcc.c-torture/compile/20010118-1.c new file mode 100644 index 000000000..6d1fc6431 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010118-1.c @@ -0,0 +1,21 @@ +static unsigned int bar(void *h, unsigned int n) +{ + static int i; + return i++; +} + +static void baz(unsigned int *x) +{ + (*x)++; +} + +long +foo(void *h, unsigned int l) +{ + unsigned int n; + long m; + n = bar(h, 0); + n = bar(h, n); + m = ({ baz(&n); 21; }); + return m; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010124-1.c b/gcc/testsuite/gcc.c-torture/compile/20010124-1.c new file mode 100644 index 000000000..dd2d9c117 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010124-1.c @@ -0,0 +1,9 @@ +/* Origin: testcase from Joseph Myers , problem pointed + out in a post to comp.std.c + <980283801.3063.0.nnrp-07.c2deb1c2@news.demon.co.uk> + by Dibyendu Majumdar . + Compound literals should be parsed as postfix expressions, rather than + as cast expressions. In particular, they are valid operands of sizeof. */ + +struct s { int a; int b; }; +char x[((sizeof (struct s){ 1, 2 }) == sizeof (struct s)) ? 1 : -1]; diff --git a/gcc/testsuite/gcc.c-torture/compile/20010202-1.c b/gcc/testsuite/gcc.c-torture/compile/20010202-1.c new file mode 100644 index 000000000..e72586a33 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010202-1.c @@ -0,0 +1,6 @@ +int foo (int n, char m[1][n]); + +int foo (int n, char m[1][n]) +{ +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20010209-1.c b/gcc/testsuite/gcc.c-torture/compile/20010209-1.c new file mode 100644 index 000000000..20434644b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010209-1.c @@ -0,0 +1,7 @@ +short int a; + +int main (void) +{ + a = 65535.0; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010226-1.c b/gcc/testsuite/gcc.c-torture/compile/20010226-1.c new file mode 100644 index 000000000..f25b48390 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010226-1.c @@ -0,0 +1,24 @@ +/* { dg-require-effective-target trampolines } */ + +void f1 (void *); +void f3 (void *, void (*)(void *)); +void f2 (void *); + +int foo (void *a, int b) +{ + if (!b) + { + f1 (a); + return 1; + } + if (b) + { + void bar (void *c) + { + if (c == a) + f2 (c); + } + f3 (a, bar); + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010227-1.c b/gcc/testsuite/gcc.c-torture/compile/20010227-1.c new file mode 100644 index 000000000..767cb0d1c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010227-1.c @@ -0,0 +1,6 @@ +void foo (void) +{ + double a = 0.0; + double b = a; + if (&b != &a); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010313-1.c b/gcc/testsuite/gcc.c-torture/compile/20010313-1.c new file mode 100644 index 000000000..a5a6ee652 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010313-1.c @@ -0,0 +1,5 @@ +/* Origin: Joseph Myers . */ +/* After the open parenthesis before the __attribute__, we used to shift + the __attribute__ (expecting a parenthesised abstract declarator) + instead of reducing to the start of a parameter list. */ +void bar (int (__attribute__((__mode__(__SI__))) int foo)); diff --git a/gcc/testsuite/gcc.c-torture/compile/20010320-1.c b/gcc/testsuite/gcc.c-torture/compile/20010320-1.c new file mode 100644 index 000000000..14686d623 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010320-1.c @@ -0,0 +1,28 @@ +typedef struct sec { +const char *name; +int id; +int index; +struct sec *next; +unsigned int flags; +unsigned int user_set_vma : 1; +unsigned int reloc_done : 1; +unsigned int linker_mark : 1; +unsigned int gc_mark : 1; +unsigned int segment_mark : 1; +unsigned long long vma; } asection; + +static void pe_print_pdata (asection *section) +{ + unsigned long long i; + unsigned long long start = 0, stop = 0; + int onaline = (3*8) ; + + for (i = start; i < stop; i += onaline) + { + if (i + (3*8) > stop) + break; + + f (((unsigned long) ((( i + section->vma ) >> 32) & 0xffffffff)) , ((unsigned long) ((( i + section->vma ) & 0xffffffff))) ) ; + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20010326-1.c b/gcc/testsuite/gcc.c-torture/compile/20010326-1.c new file mode 100644 index 000000000..43acf4588 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010326-1.c @@ -0,0 +1,16 @@ +float d; +int e, f; + +void foo (void) +{ + struct { float u, v; } a = {0.0, 0.0}; + float b; + int c; + + c = e; + if (c == 0) + c = f; + b = d; + if (a.v < b) + a.v = b; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010327-1.c b/gcc/testsuite/gcc.c-torture/compile/20010327-1.c new file mode 100644 index 000000000..ce68f78df --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010327-1.c @@ -0,0 +1,15 @@ +/* { dg-skip-if "non-SI pointers" { m32c-*-* } { "*" } { "" } } */ +/* { dg-skip-if "HI mode pointer for avr" { "avr-*-*" } { "*" } { "" } } */ +/* { dg-skip-if "HI mode pointer for pdp11" { "pdp11-*-*" } { "*" } { "" } } */ +/* { dg-skip-if "non-SI pointers for w64" { "x86_64-*-mingw*" } { "*" } { "" } } */ + +/* This testcase tests whether GCC can produce static initialized data + that references addresses of size 'unsigned long', even if that's not + the same as __SIZE_TYPE__. (See 20011114-1.c for the same test of + size __SIZE_TYPE__.) + + Some rare environments might not have the required relocs to support + this; they should have this test disabled in the .x file. */ + +extern void _text; +static unsigned long x = (unsigned long) &_text - 0x10000000L - 1; diff --git a/gcc/testsuite/gcc.c-torture/compile/20010328-1.c b/gcc/testsuite/gcc.c-torture/compile/20010328-1.c new file mode 100644 index 000000000..951ae78b9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010328-1.c @@ -0,0 +1,80 @@ +typedef __SIZE_TYPE__ size_t; +typedef unsigned int __u_int; +typedef unsigned long __u_long; + +__extension__ typedef unsigned long long int __u_quad_t; +__extension__ typedef long long int __quad_t; + +typedef struct + { + int __val[2]; + } __fsid_t; + +typedef long int __blksize_t; +typedef long int __blkcnt_t; +typedef __quad_t __blkcnt64_t; +typedef __u_long __fsblkcnt_t; +typedef __u_quad_t __fsblkcnt64_t; +typedef __u_long __fsfilcnt_t; +typedef __u_quad_t __fsfilcnt64_t; +typedef __u_quad_t __ino64_t; + +extern void *memcpy (void *__restrict __dest, + __const void *__restrict __src, size_t __n) ; + +struct statfs + { + int f_type; + int f_bsize; + + __fsblkcnt_t f_blocks; + __fsblkcnt_t f_bfree; + __fsblkcnt_t f_bavail; + __fsfilcnt_t f_files; + __fsfilcnt_t f_ffree; + + __fsid_t f_fsid; + int f_namelen; + int f_spare[6]; + }; + + +struct statfs64 + { + int f_type; + int f_bsize; + __fsblkcnt64_t f_blocks; + __fsblkcnt64_t f_bfree; + __fsblkcnt64_t f_bavail; + __fsfilcnt64_t f_files; + __fsfilcnt64_t f_ffree; + __fsid_t f_fsid; + int f_namelen; + int f_spare[6]; + }; + +extern int __statfs (__const char *__file, struct statfs *__buf); +extern int __statfs64 (__const char *__file, struct statfs64 *__buf); + + +int +__statfs64 (const char *file, struct statfs64 *buf) +{ + struct statfs buf32; + + if (__statfs (file, &buf32) < 0) + return -1; + + buf->f_type = buf32.f_type; + buf->f_bsize = buf32.f_bsize; + buf->f_blocks = buf32.f_blocks; + buf->f_bfree = buf32.f_bfree; + buf->f_bavail = buf32.f_bavail; + buf->f_files = buf32.f_files; + buf->f_ffree = buf32.f_ffree; + buf->f_fsid = buf32.f_fsid; + buf->f_namelen = buf32.f_namelen; + memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010329-1.c b/gcc/testsuite/gcc.c-torture/compile/20010329-1.c new file mode 100644 index 000000000..4d495e1af --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010329-1.c @@ -0,0 +1,17 @@ +union u { + unsigned char a; + double b; +}; + +int a; + +union u foo (void) +{ + union u b; + + if (a) + b.a = 1; + else + b.a = 0; + return b; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010404-1.c b/gcc/testsuite/gcc.c-torture/compile/20010404-1.c new file mode 100644 index 000000000..f890118e1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010404-1.c @@ -0,0 +1,15 @@ +/* This testcase caused a floating point exception in the compiler when + compiled with -O2. The crash occurs when trying to simplify division + and modulo operations. */ + +#include + +extern void bar (int); + +void foo () +{ + int a = INT_MIN; + int b = -1; + bar (a / b); + bar (a % b); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010408-1.c b/gcc/testsuite/gcc.c-torture/compile/20010408-1.c new file mode 100644 index 000000000..9aa3597a2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010408-1.c @@ -0,0 +1,77 @@ +extern struct win *windows, *wtab[]; +struct win +{ + struct win *w_next; +}; + +struct auser; + +struct comm +{ + char *name; + int flags; +}; + +extern struct comm comms[]; + +extern int WindowByNoN (char *); +extern int FindCommnr (char *); +extern int AclSetPermCmd (struct auser *, char *, struct comm *); +extern int AclSetPermWin (struct auser *, struct auser *, char *, struct win *); + + +int + AclSetPerm(uu, u, mode, s) + struct auser *uu, *u; +char *mode, *s; +{ + struct win *w; + int i; + char *p, ch; + + do + { + } + while (0); + + while (*s) + { + switch (*s) + { + case '*': + return AclSetPerm(uu, u, mode, "#?"); + case '#': + if (uu) + AclSetPermWin(uu, u, mode, (struct win *)1); + else + for (w = windows; w; w = w->w_next) + AclSetPermWin((struct auser *)0, u, mode, w); + s++; + break; + case '?': + if (uu) + AclSetPermWin(uu, u, mode, (struct win *)0); + else + for (i = 0; i <= 174; i++) + AclSetPermCmd(u, mode, &comms[i]); + s++; + break; + default: + for (p = s; *p && *p != ' ' && *p != '\t' && *p != ','; p++) + ; + if ((ch = *p)) + *p++ = '\0'; + if ((i = FindCommnr(s)) != -1) + AclSetPermCmd(u, mode, &comms[i]); + else if (((i = WindowByNoN(s)) >= 0) && wtab[i]) + AclSetPermWin((struct auser *)0, u, mode, wtab[i]); + else + return -1; + if (ch) + p[-1] = ch; + s = p; + } + } + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010421-1.c b/gcc/testsuite/gcc.c-torture/compile/20010421-1.c new file mode 100644 index 000000000..bec6aa903 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010421-1.c @@ -0,0 +1,8 @@ +int j; + +void residual () +{ + long double s; + for (j = 3; j < 9; j++) + s -= 3; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010423-1.c b/gcc/testsuite/gcc.c-torture/compile/20010423-1.c new file mode 100644 index 000000000..ef7771f8e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010423-1.c @@ -0,0 +1,16 @@ +/* Origin: PR c/2618 from Cesar Eduardo Barros , + adapted to a testcase by Joseph Myers . + + Boolean conversions were causing infinite recursion between convert + and fold in certain cases. */ + +#include + +bool x; +unsigned char y; + +void +fn (void) +{ + x = y & 0x1 ? 1 : 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010426-1.c b/gcc/testsuite/gcc.c-torture/compile/20010426-1.c new file mode 100644 index 000000000..356818f9e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010426-1.c @@ -0,0 +1,19 @@ +struct { char *m; long n; } a[20]; +int b = 20, c; +void bar(void) __attribute__((__noreturn__)); + +int +foo(int x) +{ + int i; + + for (i = 0; i < x; i++) + { + a[0].m = "a"; a[0].n = 10; c=1; + a[c].m = "b"; a[c].n = 32; c++; + if (c >= b) bar (); + a[c].m = "c"; a[c].n = 80; c++; + if (c >= b) bar (); + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010503-1.c b/gcc/testsuite/gcc.c-torture/compile/20010503-1.c new file mode 100644 index 000000000..75005f456 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010503-1.c @@ -0,0 +1,17 @@ +void f1 (double); +void f2 (int); + +void +foo (int type, double xx) +{ + if (type) + f1 (xx); + else + f2 (type); +} + +void +bar (int type) +{ + foo (type, 1.0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010510-1.c b/gcc/testsuite/gcc.c-torture/compile/20010510-1.c new file mode 100644 index 000000000..23d44f864 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010510-1.c @@ -0,0 +1,3 @@ +typedef char *ident; +#ident "This is ident" +ident i; diff --git a/gcc/testsuite/gcc.c-torture/compile/20010518-1.c b/gcc/testsuite/gcc.c-torture/compile/20010518-1.c new file mode 100644 index 000000000..0a1b284b4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010518-1.c @@ -0,0 +1,205 @@ +/* This was cut down from reload1.c in May 2001, was observed to cause + a bootstrap failure for powerpc-apple-darwin1.3. + + Copyright (C) 2001 Free Software Foundation. */ + +enum insn_code +{ + CODE_FOR_extendqidi2 = 3, + CODE_FOR_nothing = 870 +}; + +struct rtx_def; + +enum machine_mode +{ + VOIDmode, + MAX_MACHINE_MODE +}; + +typedef unsigned long long HARD_REG_ELT_TYPE; +typedef HARD_REG_ELT_TYPE HARD_REG_SET[((77 + (8 * 8) - 1) / (8 * 8))]; + +enum rtx_code +{ + UNKNOWN, + NIL, + REG, + LAST_AND_UNUSED_RTX_CODE = 256 +}; + +typedef struct +{ + unsigned min_align:8; + unsigned base_after_vec:1; + unsigned min_after_vec:1; + unsigned max_after_vec:1; + unsigned min_after_base:1; + unsigned max_after_base:1; + unsigned offset_unsigned:1; + unsigned:2; + unsigned scale:8; +} +addr_diff_vec_flags; +typedef union rtunion_def +{ + long long rtwint; + int rtint; + unsigned int rtuint; + const char *rtstr; + struct rtx_def *rtx; + struct rtvec_def *rtvec; + enum machine_mode rttype; + addr_diff_vec_flags rt_addr_diff_vec_flags; + struct cselib_val_struct *rt_cselib; + struct bitmap_head_def *rtbit; + union tree_node *rttree; + struct basic_block_def *bb; +} +rtunion; +typedef struct rtx_def +{ + enum rtx_code code:16; + enum machine_mode mode:8; + unsigned int jump:1; + unsigned int call:1; + unsigned int unchanging:1; + unsigned int volatil:1; + unsigned int in_struct:1; + unsigned int used:1; + unsigned integrated:1; + unsigned frame_related:1; + rtunion fld[1]; +} + *rtx; + +enum reload_type +{ + RELOAD_FOR_INPUT, RELOAD_FOR_OUTPUT, RELOAD_FOR_INSN, + RELOAD_FOR_INPUT_ADDRESS, RELOAD_FOR_INPADDR_ADDRESS, + RELOAD_FOR_OUTPUT_ADDRESS, RELOAD_FOR_OUTADDR_ADDRESS, + RELOAD_FOR_OPERAND_ADDRESS, RELOAD_FOR_OPADDR_ADDR, + RELOAD_OTHER, RELOAD_FOR_OTHER_ADDRESS +}; + +struct reload +{ + rtx in; + rtx out; + // enum reg_class class; + enum machine_mode inmode; + enum machine_mode outmode; + enum machine_mode mode; + unsigned int nregs; + int inc; + rtx in_reg; + rtx out_reg; + int regno; + rtx reg_rtx; + int opnum; + int secondary_in_reload; + int secondary_out_reload; + enum insn_code secondary_in_icode; + enum insn_code secondary_out_icode; + enum reload_type when_needed; + unsigned int optional:1; + unsigned int nocombine:1; + unsigned int secondary_p:1; + unsigned int nongroup:1; +}; + +struct insn_chain +{ + rtx insn; +}; + +extern int n_reloads; +static short reload_order[(2 * 10 * (2 + 1))]; +int reload_spill_index[(2 * 10 * (2 + 1))]; +extern struct reload rld[(2 * 10 * (2 + 1))]; +static rtx *reg_last_reload_reg; +static HARD_REG_SET reg_reloaded_valid; +static HARD_REG_SET reg_reloaded_dead; +static HARD_REG_SET reg_reloaded_died; +static HARD_REG_SET reg_is_output_reload; +extern const unsigned int mode_size[]; +extern int target_flags; + +static void +emit_reload_insns (chain) + struct insn_chain *chain; +{ + rtx insn = chain->insn; + register int j; + rtx following_insn = (((insn)->fld[2]).rtx); + rtx before_insn = (((insn)->fld[1]).rtx); + + for (j = 0; j < n_reloads; j++) + { + register int r = reload_order[j]; + register int i = reload_spill_index[r]; + + { + rtx out = (((enum rtx_code) (rld[r].out)->code) == REG ? rld[r].out : rld[r].out_reg); + register int nregno = (((out)->fld[0]).rtuint); + + if (nregno >= 77) + { + rtx src_reg, store_insn = (rtx) 0; + + reg_last_reload_reg[nregno] = 0; + if (src_reg && ((enum rtx_code) (src_reg)->code) == REG && (((src_reg)->fld[0]).rtuint) < 77) + { + int src_regno = (((src_reg)->fld[0]).rtuint); + int nr = + (((src_regno) >= 32 + && (src_regno) <= + 63) ? (((mode_size[(int) (rld[r].mode)]) + 8 - + 1) / 8) : (((mode_size[(int) (rld[r].mode)]) + + (!(target_flags & 0x00000020) ? 4 : + 8) - 1) / (!(target_flags & 0x00000020) ? 4 : 8))); + rtx note = 0; + + while (nr-- > 0) + { + ((reg_reloaded_dead) + [(src_regno + nr) / ((unsigned) (8 * 8))] &= + ~(((HARD_REG_ELT_TYPE) (1)) << ((src_regno + nr) % ((unsigned) (8 * 8))))); + ((reg_reloaded_valid) + [(src_regno + nr) / ((unsigned) (8 * 8))] |= + ((HARD_REG_ELT_TYPE) (1)) << ((src_regno + nr) % ((unsigned) (8 * 8)))); + ((reg_is_output_reload) + [(src_regno + nr) / ((unsigned) (8 * 8))] |= + ((HARD_REG_ELT_TYPE) (1)) << ((src_regno + nr) % ((unsigned) (8 * 8)))); + if (note) + ((reg_reloaded_died) + [(src_regno) / ((unsigned) (8 * 8))] |= + ((HARD_REG_ELT_TYPE) (1)) << ((src_regno) % ((unsigned) (8 * 8)))); + else + ((reg_reloaded_died) + [(src_regno) / ((unsigned) (8 * 8))] &= + ~(((HARD_REG_ELT_TYPE) (1)) << ((src_regno) % ((unsigned) (8 * 8))))); + } + reg_last_reload_reg[nregno] = src_reg; + } + } + else + { + int num_regs = + (((nregno) >= 32 + && (nregno) <= + 63) + ? (((mode_size + [(int) (((enum machine_mode) (rld[r].out)->mode))]) + + 8 - + 1) / + 8) + : (((mode_size + [(int) (((enum machine_mode) (rld[r].out)->mode))]) + + (!(target_flags & 0x00000020) ? 4 : 8) - 1) / (!(target_flags & 0x00000020) ? 4 : 8))); + while (num_regs-- > 0) + reg_last_reload_reg[nregno + num_regs] = 0; + } + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010518-2.c b/gcc/testsuite/gcc.c-torture/compile/20010518-2.c new file mode 100644 index 000000000..f35d7c6b9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010518-2.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ + +/* This test fails on HC11/HC12 when it is compiled without -mshort because + the array is too large (INT_MAX/2 > 64K). Force to use 16-bit ints + for it. */ +/* { dg-options "-w -mshort" { target m6811-*-* m6812-*-* } } */ + +/* Large static storage. */ + +#include + +static volatile char chars_1[INT_MAX / 2]; +static volatile char chars_2[1]; + +int +foo (void) +{ + chars_1[10] = 'y'; + chars_2[0] = 'x'; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010525-1.c b/gcc/testsuite/gcc.c-torture/compile/20010525-1.c new file mode 100644 index 000000000..2e4ae382a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010525-1.c @@ -0,0 +1,6 @@ +static int kind_varread(char *str) +{ + if (0 == memcmp("%_#", str, 3)) return 2; + /* NOTREACHED */ +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20010605-1.c b/gcc/testsuite/gcc.c-torture/compile/20010605-1.c new file mode 100644 index 000000000..036b79698 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010605-1.c @@ -0,0 +1,15 @@ +int +main (int argc, char **argv) +{ + int size = 10; + + typedef struct { + char val[size]; + } block; + block retframe_block() + { + return *(block*)0; + } + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010605-2.c b/gcc/testsuite/gcc.c-torture/compile/20010605-2.c new file mode 100644 index 000000000..b8d9d5892 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010605-2.c @@ -0,0 +1,17 @@ +/* Origin: Joseph Myers . */ +/* As an extension, GCC allows a struct or union to be cast to its own + type, but failed to allow this when a typedef was involved. + Reported as PR c/2735 by . */ +union u { int i; }; +typedef union u uu; +union u a; +uu b; + +void +foo (void) +{ + a = (union u) b; + a = (uu) b; + b = (union u) a; + b = (uu) a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010605-3.c b/gcc/testsuite/gcc.c-torture/compile/20010605-3.c new file mode 100644 index 000000000..a43c0b1e4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010605-3.c @@ -0,0 +1,20 @@ +struct A { unsigned long buf[100]; }; +int foo(unsigned int *x) +{ + unsigned int a; + + if (!x) + return -22; + +#ifdef __ia64__ + if (({ + register long b asm ("r8") = 0; + register long c asm ("r9") = 0; + asm ("" : "=r"(c), "=r"(b) : "m"(*(struct A *)x), "1"(b)); + a = (unsigned int) c; + b; })) + return -14; +#endif + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010610-1.c b/gcc/testsuite/gcc.c-torture/compile/20010610-1.c new file mode 100644 index 000000000..ee8e2431b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010610-1.c @@ -0,0 +1,19 @@ +/* Origin: Kaveh R. Ghazi + + Boolean types were not accepted as array sizes nor as switch + quantities. */ + +#include + +int +main(void) +{ + bool arr[(bool)1]; + + switch (arr[0]) + { + default:; + } + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010611-1.c b/gcc/testsuite/gcc.c-torture/compile/20010611-1.c new file mode 100644 index 000000000..87723bd49 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010611-1.c @@ -0,0 +1,24 @@ +/* Origin: PR c/3116 from Andreas Jaeger . */ +/* When determining type compatibility of function types, we must remove + qualifiers from argument types. We used to fail to do this properly + in store_parm_decls when comparing prototype and non-prototype + declarations. */ +struct _IO_FILE { + int _flags; +}; + +typedef struct _IO_FILE __FILE; +typedef struct _IO_FILE _IO_FILE; +typedef long int wchar_t; + +extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n, + __FILE *__restrict __stream); + +wchar_t * +fgetws (buf, n, fp) + wchar_t *buf; + int n; + _IO_FILE *fp; +{ + return (wchar_t *)0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010701-1.c b/gcc/testsuite/gcc.c-torture/compile/20010701-1.c new file mode 100644 index 000000000..7fb7ab5b1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010701-1.c @@ -0,0 +1,5 @@ +/* Test that postfix attributes only apply to a single declared object. + (decl_attributes used to chain them onto the end of the prefix attributes, + which caused them to apply to other declarations as well.) */ +/* Origin: Joseph Myers . */ +void __attribute__((__noreturn__)) foo (const char *, ...) __attribute__((__format__(__printf__, 1, 2))), bar (void); diff --git a/gcc/testsuite/gcc.c-torture/compile/20010706-1.c b/gcc/testsuite/gcc.c-torture/compile/20010706-1.c new file mode 100644 index 000000000..44aec371a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010706-1.c @@ -0,0 +1,5 @@ + +foo(unsigned int x) +{ + return (x << 1) | (x >> 31); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010711-1.c b/gcc/testsuite/gcc.c-torture/compile/20010711-1.c new file mode 100644 index 000000000..a0787421f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010711-1.c @@ -0,0 +1,11 @@ +typedef unsigned long long value; + +void foo (value *v) {} + +void test () +{ + value v; + foo (&v); + if (v-- > 0) + foo (&v); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010711-2.c b/gcc/testsuite/gcc.c-torture/compile/20010711-2.c new file mode 100644 index 000000000..2f8d68ba4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010711-2.c @@ -0,0 +1,11 @@ +typedef unsigned long long value; + +void foo (value *v) {} + +void test () +{ + value v; + foo (&v); + if (v-- == 1) + foo (&v); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010714-1.c b/gcc/testsuite/gcc.c-torture/compile/20010714-1.c new file mode 100644 index 000000000..fc4bdbac7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010714-1.c @@ -0,0 +1,5 @@ +/* Test that prefix attributes after a comma only apply to a single + declared object or function. */ +/* Origin: Joseph Myers . */ + +__attribute__((noreturn)) void d0 (void), __attribute__((format(printf, 1, 2))) d1 (const char *, ...), d2 (void); diff --git a/gcc/testsuite/gcc.c-torture/compile/20010824-1.c b/gcc/testsuite/gcc.c-torture/compile/20010824-1.c new file mode 100644 index 000000000..8e67722b9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010824-1.c @@ -0,0 +1,7 @@ +void f(int n) +{ +bugcauser: + if (n != 0) + f(n-1); + return; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010903-1.c b/gcc/testsuite/gcc.c-torture/compile/20010903-1.c new file mode 100644 index 000000000..8e519f26e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010903-1.c @@ -0,0 +1,28 @@ +struct A { + long a; +}; + +static inline void foo(struct A *x) +{ + __asm__ __volatile__("" : "+m"(x->a) : "r"(x) : "memory", "cc"); +} + +static inline void bar(struct A *x) +{ + foo(x); +} + +struct B { char buf[640]; struct A a; }; +struct B b[32]; + +int baz(void) +{ + int i; + struct B *j; + for (i = 1; i < 32; i++) + { + j = &b[i]; + bar(&j->a); + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010903-2.c b/gcc/testsuite/gcc.c-torture/compile/20010903-2.c new file mode 100644 index 000000000..a5d78c011 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010903-2.c @@ -0,0 +1,15 @@ +extern int __dummy (void *__preg, const char *__string); +extern int rpmatch (const char *response); + +int +rpmatch (const char *response) +{ + auto inline int try (void *re); + + inline int try (void *re) + { + return __dummy (re, response); + } + static void *yesre; + return (try (&yesre)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010911-1.c b/gcc/testsuite/gcc.c-torture/compile/20010911-1.c new file mode 100644 index 000000000..f5a4724bc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010911-1.c @@ -0,0 +1,4 @@ +/* Test for segfault handling an empty attribute. */ +/* Origin: PR c/4294 from . */ + +void __attribute__(()) foo(); diff --git a/gcc/testsuite/gcc.c-torture/compile/20011010-1.c b/gcc/testsuite/gcc.c-torture/compile/20011010-1.c new file mode 100644 index 000000000..b01375543 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011010-1.c @@ -0,0 +1,10 @@ +extern int used (void); + + +int foo () +{ + int i; + for (; used (); ({while (1) if (used ()) return 0;})) + i++; + return i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011023-1.c b/gcc/testsuite/gcc.c-torture/compile/20011023-1.c new file mode 100644 index 000000000..eca1adf17 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011023-1.c @@ -0,0 +1,14 @@ +/* Test whether tree inlining works with prototyped nested functions. */ + +extern void foo (char *x); +void bar (void); +void bar (void) +{ + auto void baz (void); + void baz (void) + { + char tmp[2]; + foo (tmp); + } + baz (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011029-1.c b/gcc/testsuite/gcc.c-torture/compile/20011029-1.c new file mode 100644 index 000000000..3b2bcdf2e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011029-1.c @@ -0,0 +1,9 @@ +void foo (void *) __attribute__ ((noreturn)); + +void +bar (void *x) +{ + if (__builtin_setjmp (x)) + return; + foo (x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011106-1.c b/gcc/testsuite/gcc.c-torture/compile/20011106-1.c new file mode 100644 index 000000000..9363780a6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011106-1.c @@ -0,0 +1,7 @@ +/* Test that functions passed to the comma operator are correctly converted + to pointers. */ +/* Origin: Joseph Myers . */ + +void foo (void); +void (*fp) (void); +char x[sizeof (1, foo) == sizeof (fp) ? 1 : -1]; diff --git a/gcc/testsuite/gcc.c-torture/compile/20011106-2.c b/gcc/testsuite/gcc.c-torture/compile/20011106-2.c new file mode 100644 index 000000000..358f9d2ed --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011106-2.c @@ -0,0 +1,7 @@ +/* Test the the type of a component of a conditional expression between + two structures is correct. */ +/* Origin: Joseph Myers . */ + +struct s { char c; } a, b; +int c; +char x[sizeof ((c ? a : b).c) == 1 ? 1 : -1]; diff --git a/gcc/testsuite/gcc.c-torture/compile/20011109-1.c b/gcc/testsuite/gcc.c-torture/compile/20011109-1.c new file mode 100644 index 000000000..f1987a74b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011109-1.c @@ -0,0 +1,51 @@ +typedef struct { short x[4]; } S; +typedef struct { unsigned int a, b, c; S *d; } T; + +S *(*foo) (T *, int, int, int, int); +unsigned short *(*bar)(const T *); +unsigned short baz(T *,const int); + +T *die (void) +{ + typedef struct { unsigned int a, b, e; double f, g; } U; + + char h[8], i[2053], j[2053]; + double k, l, m; + U n; + T *o; + unsigned short p; + int q, r; + long s; + unsigned short *t; + S *u; + unsigned char *v, *w; + unsigned int x; + + o = 0; + for (x = 0; x < n.e; x++) + { + l = 1.0; + if (n.g - n.f <= 1.0) + l = ((1 << o->c) - 1) / (n.g - n.f); + v = w; + for (r = o->b - 1; r >= 0; r--) + { + u = foo (o, 0, r, o->a, 1); + if (!u) + break; + t = bar (o); + for (q = 0; q < (int) o->a; q++) + { + h[0] = *v; + s = *v++; + k = (double) s; + m = l*k; + p = m < 0 ? 0 : m > (1 << o->c) - 1 ? (1 << o->c) - 1 : m + 0.5; + p = baz (o,p); + t[q] = p; + *u++ = o->d[p]; + } + } + } + return o; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011114-1.c b/gcc/testsuite/gcc.c-torture/compile/20011114-1.c new file mode 100644 index 000000000..5e6e82184 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011114-1.c @@ -0,0 +1,2 @@ +extern void _text; +static __SIZE_TYPE__ x = (__SIZE_TYPE__) &_text - 0x10000000L - 1; diff --git a/gcc/testsuite/gcc.c-torture/compile/20011114-2.c b/gcc/testsuite/gcc.c-torture/compile/20011114-2.c new file mode 100644 index 000000000..46f0aedeb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011114-2.c @@ -0,0 +1,13 @@ +typedef struct { int c, d, e, f, g; } D; + +void bar (unsigned long, unsigned long); +void foo (D *y) +{ + int x = 0; + + if (y->f == 0) + x |= 0x1; + if (y->g == 0) + x |= 0x2; + bar ((x << 16) | (y->c & 0xffff), (y->d << 16) | (y->e & 0xffff)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011114-3.c b/gcc/testsuite/gcc.c-torture/compile/20011114-3.c new file mode 100644 index 000000000..882792525 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011114-3.c @@ -0,0 +1,42 @@ +typedef struct { int s, t; } C; +C x; +int foo (void); +void bar (int); + +int baz (void) +{ + int a = 0, c, d = 0; + C *b = &x; + + while ((c = foo ())) + switch(c) + { + case 23: + bar (1); + break; + default: + break; + } + + if (a == 0 || (a & 1)) + { + if (b->s) + { + if (a) + bar (1); + else + a = 16; + } + else if (b->t) + { + if (a) + bar (1); + else + a = 32; + } + } + + if (d && (a & ~127)) + bar (2); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011114-4.c b/gcc/testsuite/gcc.c-torture/compile/20011114-4.c new file mode 100644 index 000000000..516ef4f23 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011114-4.c @@ -0,0 +1,38 @@ +static inline int foo (long x) +{ + register int a = 0; + register unsigned b; + + do + { + b = (x & 0x7f); + x = (x >> 7) | ~(-1L >> 7); + a += 1; + } + while ((x != 0 || (b & 0x40) != 0) && (x != -1 || (b & 0x40) == 0)); + return a; +} + +static inline int bar (unsigned long x) +{ + register int a = 0; + register unsigned b; + + do + { + b = (x & 0x7f); + x >>= 7; + a++; + } + while (x != 0); + return a; +} + +int +baz (unsigned long x, int y) +{ + if (y) + return foo ((long) x); + else + return bar (x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011119-1.c b/gcc/testsuite/gcc.c-torture/compile/20011119-1.c new file mode 100644 index 000000000..b4b80ae2f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011119-1.c @@ -0,0 +1,10 @@ +/* { dg-require-weak "" } */ +/* { dg-require-alias "" } */ +#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname) +#define ASMNAME2(prefix, cname) STRING (prefix) cname +#define STRING(x) #x + +extern inline int foo (void) { return 23; } +int xxx(void) __asm__(ASMNAME ("xxx")); +int xxx(void) { return 23; } +extern int foo (void) __attribute__ ((weak, alias ("xxx"))); diff --git a/gcc/testsuite/gcc.c-torture/compile/20011119-2.c b/gcc/testsuite/gcc.c-torture/compile/20011119-2.c new file mode 100644 index 000000000..e06809f33 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011119-2.c @@ -0,0 +1,12 @@ +/* { dg-require-weak "" } */ +/* { dg-require-alias "" } */ +#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname) +#define ASMNAME2(prefix, cname) STRING (prefix) cname +#define STRING(x) #x + +extern inline int foo (void) { return 23; } +int bar (void) { return foo (); } +extern int foo (void) __attribute__ ((weak, alias ("xxx"))); +int baz (void) { return foo (); } +int xxx(void) __asm__(ASMNAME ("xxx")); +int xxx(void) { return 23; } diff --git a/gcc/testsuite/gcc.c-torture/compile/20011130-1.c b/gcc/testsuite/gcc.c-torture/compile/20011130-1.c new file mode 100644 index 000000000..55d4af482 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011130-1.c @@ -0,0 +1,7 @@ +struct S { int i; }; +extern struct S x[]; +char *bar (const struct S *); +void foo (void) +{ + bar (x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011130-2.c b/gcc/testsuite/gcc.c-torture/compile/20011130-2.c new file mode 100644 index 000000000..e3cb5f46a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011130-2.c @@ -0,0 +1,54 @@ +/* This testcase caused infinite loop in life info computation + after if conversion on IA-64. Conditional register dead for + pseudo holding sign-extended k was improperly computed, + resulting in this pseudo being live at start of bb if it was + dead at the end and vice versa; as it was a bb which had edge + to itself, this resulted in alternative propagating this basic + block forever. */ + +typedef struct { + unsigned char a; + unsigned char b; +} S0; + +typedef struct { + S0 *c; + int d; + unsigned int e; + unsigned char *f[3]; + void *g; +} S1; + +int bar (int, void *); + +int foo (S1 *x, float y) +{ + S0 *h; + int i, j, k, l, m; + float n, o, p; + unsigned char *q, *r[3]; + + h = x->c; + m = h->a; + l = h->b; + n = y; + o = 0.0; + if (x->d == 8) + for (j = 0; j < x->e; j++) + for (k = 0; k < 3; k++) + { + n = y; + o = 0.0; + if (m) + q = x->f[k] + x->e - 1 - j; + else + q = x->f[k] + j; + p = (*q - o) * y / (n - o); + p = 0.0 > p ? 0.0 : p; + p = y < p ? y : p; + if (l) + p = r[k][(int) p]; + bar (p, x->g); + } + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011205-1.c b/gcc/testsuite/gcc.c-torture/compile/20011205-1.c new file mode 100644 index 000000000..ffc5ac419 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011205-1.c @@ -0,0 +1,10 @@ +/* Failure to mark_addressable all operands before evaluation means we + don't set up the proper temporaries, which leaves us with an asm that + doesn't match its contraints. */ + +long foo() +{ + long x; + asm("" : "=r"(x) : "m"(x)); + return x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011217-1.c b/gcc/testsuite/gcc.c-torture/compile/20011217-1.c new file mode 100644 index 000000000..3e89ca04c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011217-1.c @@ -0,0 +1,20 @@ +/* Test that the initializer of a compound literal is properly walked + when tree inlining. */ +/* Origin: PR c/5105 from . */ + +typedef struct { long p; } pt; + +inline pt f (pt _p) +{ + long p = _p.p; + + return (pt) { (p) }; +} + +static int mmap_mem (void) +{ + pt p; + p = f (p); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011217-2.c b/gcc/testsuite/gcc.c-torture/compile/20011217-2.c new file mode 100644 index 000000000..0d9935969 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011217-2.c @@ -0,0 +1,19 @@ +/* Test that the initializer of a compound literal is properly walked + when tree inlining. */ +/* Origin: glibc (as reported in PR c/5105) from . */ + +inline int +finite (double __x) +{ + return (__extension__ + (((((union { double __d; int __i[2]; }) {__d: __x}).__i[1] + | 0x800fffffu) + 1) >> 31)); +} + +int +main (void) +{ + double x = 1.0; + + return finite (x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011218-1.c b/gcc/testsuite/gcc.c-torture/compile/20011218-1.c new file mode 100644 index 000000000..bf63489b8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011218-1.c @@ -0,0 +1,16 @@ +/* This testcase failed on Alpha at -O2 because $27 hard register + for the indirect call was exposed too early and reload couldn't + allocate it for multiplication and division. */ + +struct S { + int a, b; + void (*f) (long, int); +}; + +void foo (struct S *x) +{ + long c = x->a * 50; + c /= (long) x->b; + c *= (long) x->b; + x->f (c, 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011219-1.c b/gcc/testsuite/gcc.c-torture/compile/20011219-1.c new file mode 100644 index 000000000..04923092d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011219-1.c @@ -0,0 +1,29 @@ +/* This testcase failed on IA-64 at -O2 during scheduling. */ + +void * baz (unsigned long); +static inline double ** +bar (long w, long x, long y, long z) +{ + long i, a = x - w + 1, b = z - y + 1; + double **m = (double **) baz (sizeof (double *) * (a + 1)); + + m += 1; + m -= w; + m[w] = (double *) baz (sizeof (double) * (a * b + 1)); + m[w] += 1; + m[w] -= y; + for (i = w + 1; i <= x; i++) + m[i] = m[i - 1] + b; + return m; +} + +void +foo (double w[], int x, double y[], double z[]) +{ + int i; + double **a; + + a = bar (1, 50, 1, 50); + for (i = 1; i <= x; i++) + a[1][i] = - w[x - i] / w[x]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011219-2.c b/gcc/testsuite/gcc.c-torture/compile/20011219-2.c new file mode 100644 index 000000000..2ad7eb1a3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011219-2.c @@ -0,0 +1,20 @@ +/* This testcase failed on Alpha at -O2 when simplifying conditional + expressions. */ + +struct S { + unsigned long a; + double b, c; +}; + +extern double bar (double, double); + +int +foo (unsigned long x, unsigned int y, struct S *z) +{ + unsigned int a = z->a; + int b = y / z->a > 1 ? y / z->a : 1; + + a = y / b < z->a ? y / b : z->a; + z->c = z->b * bar ((double) a, (double) x); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011229-1.c b/gcc/testsuite/gcc.c-torture/compile/20011229-1.c new file mode 100644 index 000000000..97b265543 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011229-1.c @@ -0,0 +1,78 @@ +/* ICE: call insn does not satisfy its constraints, MMIX port. + Origin: ghostscript-6.52, reduction from hp@bitrange.com. */ +struct s0 +{ + void (*init_color)(void *, void *); +}; +struct s1 +{ + void (*map_cmyk)(short, void *, void **, void *); + void (*map_rgb_alpha)(short, void *, void **, void *); +}; +struct s5 +{ + long fill1; int fill2; + long fill3; unsigned int fill4, fill5; +}; +struct s2 +{ + struct s5 x, y; +}; +struct s3 +{ + long dev_color; + unsigned int key; +}; +struct s4 +{ + unsigned char spp; + int alpha; + struct mc_ + { + unsigned int values[14]; + unsigned int mask, test; + int exact; + } mask_color; + void **pis; + struct s0 *pcs; + struct dd_ + { + struct s2 row[2]; + struct s2 pixel0; + } dda; + struct s3 clues[256]; +}; +extern struct s1 *get_cmap_procs (void **, void *); +int image_render_color (struct s4 *, unsigned char *, int, void *); +int +image_render_color (struct s4 *penum, unsigned char *buffer, + int data_x, void *dev) +{ + struct s3 *clues = penum->clues; + void **pis = penum->pis; + struct s2 pnext; + struct s0 *pcs = penum->pcs; + struct s1 *cmap_procs = get_cmap_procs(pis, dev); + void (*map_4)(short, void *, void **, void *) = + (penum->alpha ? cmap_procs->map_rgb_alpha : cmap_procs->map_cmyk); + unsigned int mask = penum->mask_color.mask; + unsigned int test = penum->mask_color.test; + struct s3 *pic_next = &clues[1]; + int spp = penum->spp; + unsigned char *psrc = buffer + data_x * spp; + unsigned char v[6]; + + pnext = penum->dda.pixel0; + __builtin_memset (&v, 0, sizeof(v)); + (*(pcs)->init_color) (0, 0); + + if (spp == 4) + { + v[0] = psrc[0]; + v[1] = psrc[1]; + if ((buffer[0] & mask) == test && penum->mask_color.exact) + pic_next->dev_color = 0; + (*map_4)(v[0], &pic_next->dev_color, pis, dev); + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20011229-2.c b/gcc/testsuite/gcc.c-torture/compile/20011229-2.c new file mode 100644 index 000000000..bb49bd18e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011229-2.c @@ -0,0 +1,17 @@ +/* Test whether jump threading doesn't ICE if redirecting the jump to exit + block. */ + +extern int bar (); +extern void baz (); + +void foo () +{ + int x; + + do + { + if ((x = bar ()) == 1) + baz (); + } + while (x == 1); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020103-1.c b/gcc/testsuite/gcc.c-torture/compile/20020103-1.c new file mode 100644 index 000000000..b9861688d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020103-1.c @@ -0,0 +1,22 @@ +/* This testcase failed on Alpha at -O2 when simplifying conditional + expressions. */ + +int foo (void); + +struct A +{ + int a, b, c, d; +}; + +void bar (struct A *x) +{ + int e, f; + + e = foo (); + e = e / x->b; + if (e < 1) + e = 1; + f = (x->a + x->c) / e; + if (f < x->d) + x->d -= (1 << 16) / 8; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020106-1.c b/gcc/testsuite/gcc.c-torture/compile/20020106-1.c new file mode 100644 index 000000000..c114af1aa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020106-1.c @@ -0,0 +1,8 @@ +/* Origin: PR c/5279 from . */ + +int +foo () +{ + extern long long Y; + return (0 > Y++); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020109-1.c b/gcc/testsuite/gcc.c-torture/compile/20020109-1.c new file mode 100644 index 000000000..532fe6de2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020109-1.c @@ -0,0 +1,23 @@ +/* This testcase ICEd when 2 different successors of a basic block + were successfully threaded and try_forward_edges was not expecting + that. */ + +typedef struct A +{ + struct A *s, *t; + unsigned int u; +} A; + +void bar (A *); + +void +foo (A *x, A *y, A *z) +{ + while (y + && (((y && y->t && y->t->u) ? y : z)->t + == ((x && x->t && x->t->u) ? x : z)->t)) + y = y->s; + + if (y) + bar (y); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020109-2.c b/gcc/testsuite/gcc.c-torture/compile/20020109-2.c new file mode 100644 index 000000000..316731565 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020109-2.c @@ -0,0 +1,30 @@ +typedef union +{ + unsigned char member3; + signed short member4; + unsigned int member5; +} +UNI02; + +struct srt_dat_t +{ + UNI02 un2; + unsigned long member1; + signed short member2; +}; + +struct srt_dat_t exsrt1; +void +extern_test (struct srt_dat_t arg1) +{ + arg1.un2.member3++; + arg1.member1++; + arg1.member2++; +} + +int +main (void) +{ + extern_test (exsrt1); + return (0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020110.c b/gcc/testsuite/gcc.c-torture/compile/20020110.c new file mode 100644 index 000000000..90e0ce95d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020110.c @@ -0,0 +1,12 @@ +/* Copyright 2002 Free Software Foundation */ + +/* Make sure the nested extern declaration doesn't conflict with the + non-extern one in the enclosing scope. */ + +void foo() { + static long bar; + + { + extern int bar; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020116-1.c b/gcc/testsuite/gcc.c-torture/compile/20020116-1.c new file mode 100644 index 000000000..6c023edca --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020116-1.c @@ -0,0 +1,28 @@ +void noret (void) __attribute__ ((noreturn)); +int foo (int, char **); +char *a, *b; +int d; + +int +main (int argc, char **argv) +{ + register int c; + + d = 1; + while ((c = foo (argc, argv)) != -1) + switch (c) { + case 's': + case 'c': + case 'f': + a = b; + break; + case 'v': + d = 1; + break; + case 'V': + d = 0; + break; + } + noret (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020120-1.c b/gcc/testsuite/gcc.c-torture/compile/20020120-1.c new file mode 100644 index 000000000..e049a9720 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020120-1.c @@ -0,0 +1,55 @@ +/* This ICEed on IA-32 with -O2 -mcpu=i386, because reload was trying + to reload into %sil register. */ + +struct A +{ + void *a; + unsigned int b, c, d; +}; + +struct B +{ + struct A *e; +}; + +void bar (struct A *); +void baz (struct A *); + +static inline unsigned int +inl (unsigned int v, unsigned char w, unsigned char x, unsigned char y, + unsigned char z) +{ + switch (v) + { + case 2: + return ((w & 0xf8) << 8) | ((x & 0xfc) << 3) | ((y & 0xf8) >> 3); + case 4: + return (z << 24) | (w << 16) | (x << 8) | y; + default: + return 0; + } +} + +void foo (struct B *x, int y, const float *z) +{ + struct A *a = x->e; + + if (y) + { + if (x->e->a) + bar (x->e); + } + else + { + unsigned char c[4]; + unsigned int b; + + c[0] = z[0]; c[1] = z[1]; c[2] = z[2]; c[3] = z[3]; + b = inl (a->b, c[0], c[1], c[2], c[3] ); + if (a->a) + bar (a); + else + baz (a); + a->c = b; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020121-1.c b/gcc/testsuite/gcc.c-torture/compile/20020121-1.c new file mode 100644 index 000000000..f8950f4ce --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020121-1.c @@ -0,0 +1,30 @@ +/* This testcase resulted in a 'unrecognizeable insn' on powerpc-linux-gnu + because of a missing trunc_int_for_mode in simplify_and_const_int. */ + +struct display { + struct disphist *hstent; + int pid; + int status; +}; + +struct disphist { + struct disphist *next; + char *name; + int startTries; + unsigned rLogin:2, + sd_how:2, + sd_when:2, + lock:1, + goodExit:1; + char *nuser, *npass, **nargs; +}; + +void +StartDisplay (struct display *d) +{ + d->pid = 0; + d->status = 0; + d->hstent->lock = d->hstent->rLogin = d->hstent->goodExit = + d->hstent->sd_how = d->hstent->sd_when = 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20020129-1.c b/gcc/testsuite/gcc.c-torture/compile/20020129-1.c new file mode 100644 index 000000000..7b17ba475 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020129-1.c @@ -0,0 +1,17 @@ +/* Test call to static variable. */ + +typedef struct +{ + long long a[10]; +} A; + +void bar (A *); + +typedef int (*B)(int); + +void foo (void) +{ + static A a; + bar (&a); + (*(B)&a) (1); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020206-1.c b/gcc/testsuite/gcc.c-torture/compile/20020206-1.c new file mode 100644 index 000000000..c21c56454 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020206-1.c @@ -0,0 +1,18 @@ +/* Origin: PR optimization/5429 from Philipp Thomas . */ +/* This testcase caused ICE on IA-32 -O2 -march=i686 due to rtl sharing + problem in noce_process_if_block. Fixed by + http://gcc.gnu.org/ml/gcc-patches/2002-01/msg02146.html. */ + +typedef struct { + unsigned char a; +} A; + +unsigned int foo (A *x) +{ + unsigned char b[2] = { 0, 0 }; + unsigned char c = 0; + + c = (x->a) ? b[1] : b[0]; + + return (unsigned int) c; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020210-1.c b/gcc/testsuite/gcc.c-torture/compile/20020210-1.c new file mode 100644 index 000000000..5ca27f4f6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020210-1.c @@ -0,0 +1,2 @@ +/* PR c/5615 */ +void f(int a, struct {int b[a];} c) {} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020303-1.c b/gcc/testsuite/gcc.c-torture/compile/20020303-1.c new file mode 100644 index 000000000..a120adf71 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020303-1.c @@ -0,0 +1,5 @@ +/* With -fzero-initialized-in-bss, we made I a common symbol instead + of a symbol in the .bss section. Not only does that break semantics, + but a common symbol can't be weak. */ + +int i __attribute__((weak)) = 0; diff --git a/gcc/testsuite/gcc.c-torture/compile/20020304-1.c b/gcc/testsuite/gcc.c-torture/compile/20020304-1.c new file mode 100644 index 000000000..3940d5ffd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020304-1.c @@ -0,0 +1,777 @@ +/* In 3.0, this test case (extracted from Bigloo) crashes the compiler in + bb-reorder.c. This is a regression from 2.95, already fixed in 3.1. + + Original bug report is c/5830 by Manuel Serrano . + */ + +typedef union scmobj { + struct pair { + union scmobj *car; + union scmobj *cdr; + } pair_t; + struct vector { + long header; + int length; + union scmobj *obj0; + } vector_t; +} *obj_t; + +extern obj_t create_vector (int); +extern obj_t make_pair (obj_t, obj_t); +extern long bgl_list_length (obj_t); +extern int BGl_equalzf3zf3zz__r4_equivalence_6_2z00 (obj_t, obj_t); +extern obj_t BGl_evcompilezd2lambdazd2zz__evcompilez00 (obj_t + BgL_formalsz00_39, + obj_t BgL_bodyz00_40, + obj_t BgL_wherez00_41, + obj_t + BgL_namedzf3zf3_42, + obj_t BgL_locz00_43); + +obj_t +BGl_evcompilezd2lambdazd2zz__evcompilez00 (obj_t BgL_formalsz00_39, + obj_t BgL_bodyz00_40, + obj_t BgL_wherez00_41, + obj_t BgL_namedzf3zf3_42, + obj_t BgL_locz00_43) +{ + if (BGl_equalzf3zf3zz__r4_equivalence_6_2z00 + (BgL_formalsz00_39, + ((obj_t) (obj_t) ((long) (((long) (0) << 2) | 2))))) { + BgL_tagzd21966zd2_943: + if ((BgL_namedzf3zf3_42 != + ((obj_t) (obj_t) ((long) (((long) (1) << 2) | 2))))) { + obj_t BgL_v1042z00_998; + { + int BgL_auxz00_4066; + BgL_auxz00_4066 = (int) (((long) 3)); + BgL_v1042z00_998 = create_vector (BgL_auxz00_4066); + } + { + obj_t BgL_arg1586z00_1000; + BgL_arg1586z00_1000 = make_pair (BgL_wherez00_41, BgL_bodyz00_40); + { + int BgL_auxz00_4070; + BgL_auxz00_4070 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1042z00_998))->vector_t.obj0))[BgL_auxz00_4070] = + BgL_arg1586z00_1000, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + } + { + int BgL_auxz00_4073; + BgL_auxz00_4073 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1042z00_998))->vector_t.obj0))[BgL_auxz00_4073] = + BgL_locz00_43, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4078; + int BgL_auxz00_4076; + { + long BgL_auxz00_4079; + { + long BgL_auxz00_4080; + BgL_auxz00_4080 = bgl_list_length (BgL_formalsz00_39); + BgL_auxz00_4079 = (BgL_auxz00_4080 + ((long) 37)); + } + BgL_auxz00_4078 = + (obj_t) ((long) (((long) (BgL_auxz00_4079) << 2) | 1)); + } + BgL_auxz00_4076 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1042z00_998))->vector_t.obj0))[BgL_auxz00_4076] = + BgL_auxz00_4078, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1042z00_998; + } else { + obj_t BgL_v1043z00_1005; + { + int BgL_auxz00_4085; + BgL_auxz00_4085 = (int) (((long) 3)); + BgL_v1043z00_1005 = create_vector (BgL_auxz00_4085); + } + { + int BgL_auxz00_4088; + BgL_auxz00_4088 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1043z00_1005))->vector_t.obj0))[BgL_auxz00_4088] = + BgL_bodyz00_40, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + int BgL_auxz00_4091; + BgL_auxz00_4091 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1043z00_1005))->vector_t.obj0))[BgL_auxz00_4091] = + BgL_locz00_43, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4096; + int BgL_auxz00_4094; + { + long BgL_auxz00_4097; + { + long BgL_auxz00_4098; + BgL_auxz00_4098 = bgl_list_length (BgL_formalsz00_39); + BgL_auxz00_4097 = (BgL_auxz00_4098 + ((long) 42)); + } + BgL_auxz00_4096 = + (obj_t) ((long) (((long) (BgL_auxz00_4097) << 2) | 1)); + } + BgL_auxz00_4094 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1043z00_1005))->vector_t.obj0))[BgL_auxz00_4094] = + BgL_auxz00_4096, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1043z00_1005; + } + } else { + if (((((long) BgL_formalsz00_39) & ((1 << 2) - 1)) == 3)) { + if (BGl_equalzf3zf3zz__r4_equivalence_6_2z00 + (((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t).cdr), + ((obj_t) (obj_t) ((long) (((long) (0) << 2) | 2))))) { + goto BgL_tagzd21966zd2_943; + } else { + obj_t BgL_cdrzd21979zd2_953; + BgL_cdrzd21979zd2_953 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t).cdr); + if (((((long) BgL_cdrzd21979zd2_953) & ((1 << 2) - 1)) == 3)) { + if (BGl_equalzf3zf3zz__r4_equivalence_6_2z00 + (((((obj_t) ((long) BgL_cdrzd21979zd2_953 - 3))->pair_t).cdr), + ((obj_t) (obj_t) ((long) (((long) (0) << 2) | 2))))) { + goto BgL_tagzd21966zd2_943; + } else { + obj_t BgL_cdrzd21986zd2_956; + BgL_cdrzd21986zd2_956 = + ((((obj_t) ((long) BgL_cdrzd21979zd2_953 - 3))->pair_t).cdr); + if (((((long) BgL_cdrzd21986zd2_956) & ((1 << 2) - 1)) == 3)) { + if (BGl_equalzf3zf3zz__r4_equivalence_6_2z00 + (((((obj_t) ((long) BgL_cdrzd21986zd2_956 - 3))->pair_t). + cdr), + ((obj_t) (obj_t) ((long) (((long) (0) << 2) | 2))))) { + goto BgL_tagzd21966zd2_943; + } else { + obj_t BgL_cdrzd21994zd2_959; + { + obj_t BgL_auxz00_4120; + BgL_auxz00_4120 = + ((((obj_t) ((long) BgL_cdrzd21979zd2_953 - 3))->pair_t). + cdr); + BgL_cdrzd21994zd2_959 = + ((((obj_t) ((long) BgL_auxz00_4120 - 3))->pair_t).cdr); + } + if (((((long) BgL_cdrzd21994zd2_959) & ((1 << 2) - 1)) == 3)) { + if (BGl_equalzf3zf3zz__r4_equivalence_6_2z00 + (((((obj_t) ((long) BgL_cdrzd21994zd2_959 - 3))-> + pair_t).cdr), + ((obj_t) (obj_t) ((long) (((long) (0) << 2) | 2))))) { + goto BgL_tagzd21966zd2_943; + } else { + int BgL_testz00_4128; + { + obj_t BgL_auxz00_4129; + BgL_auxz00_4129 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t). + car); + BgL_testz00_4128 = + ((((long) BgL_auxz00_4129) & ((1 << 2) - 1)) == 3); + } + if (BgL_testz00_4128) { + BgL_tagzd21971zd2_948: + if ((BgL_namedzf3zf3_42 != + ((obj_t) (obj_t) + ((long) (((long) (1) << 2) | 2))))) { + obj_t BgL_v1052z00_1026; + { + int BgL_auxz00_4134; + BgL_auxz00_4134 = (int) (((long) 3)); + BgL_v1052z00_1026 = create_vector (BgL_auxz00_4134); + } + { + obj_t BgL_arg1606z00_1028; + { + obj_t BgL_v1053z00_1029; + { + int BgL_auxz00_4137; + BgL_auxz00_4137 = (int) (((long) 3)); + BgL_v1053z00_1029 = + create_vector (BgL_auxz00_4137); + } + { + int BgL_auxz00_4140; + BgL_auxz00_4140 = (int) (((long) 2)); + ((& + (((obj_t) (BgL_v1053z00_1029))->vector_t. + obj0))[BgL_auxz00_4140] = + BgL_formalsz00_39, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + { + int BgL_auxz00_4143; + BgL_auxz00_4143 = (int) (((long) 1)); + ((& + (((obj_t) (BgL_v1053z00_1029))->vector_t. + obj0))[BgL_auxz00_4143] = + BgL_bodyz00_40, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + { + int BgL_auxz00_4146; + BgL_auxz00_4146 = (int) (((long) 0)); + ((& + (((obj_t) (BgL_v1053z00_1029))->vector_t. + obj0))[BgL_auxz00_4146] = + BgL_wherez00_41, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + BgL_arg1606z00_1028 = BgL_v1053z00_1029; + } + { + int BgL_auxz00_4149; + BgL_auxz00_4149 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1052z00_1026))->vector_t.obj0)) + [BgL_auxz00_4149] = + BgL_arg1606z00_1028, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + } + { + int BgL_auxz00_4152; + BgL_auxz00_4152 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1052z00_1026))->vector_t.obj0)) + [BgL_auxz00_4152] = + BgL_locz00_43, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4157; + int BgL_auxz00_4155; + BgL_auxz00_4157 = + (obj_t) ((long) + (((long) (((long) 55)) << 2) | 1)); + BgL_auxz00_4155 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1052z00_1026))->vector_t.obj0)) + [BgL_auxz00_4155] = + BgL_auxz00_4157, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1052z00_1026; + } else { + obj_t BgL_v1054z00_1030; + { + int BgL_auxz00_4160; + BgL_auxz00_4160 = (int) (((long) 3)); + BgL_v1054z00_1030 = create_vector (BgL_auxz00_4160); + } + { + obj_t BgL_arg1608z00_1032; + BgL_arg1608z00_1032 = + make_pair (BgL_bodyz00_40, BgL_formalsz00_39); + { + int BgL_auxz00_4164; + BgL_auxz00_4164 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1054z00_1030))->vector_t.obj0)) + [BgL_auxz00_4164] = + BgL_arg1608z00_1032, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + } + { + int BgL_auxz00_4167; + BgL_auxz00_4167 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1054z00_1030))->vector_t.obj0)) + [BgL_auxz00_4167] = + BgL_locz00_43, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4172; + int BgL_auxz00_4170; + BgL_auxz00_4172 = + (obj_t) ((long) + (((long) (((long) 56)) << 2) | 1)); + BgL_auxz00_4170 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1054z00_1030))->vector_t.obj0)) + [BgL_auxz00_4170] = + BgL_auxz00_4172, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1054z00_1030; + } + } else { + int BgL_testz00_4175; + { + obj_t BgL_auxz00_4176; + { + obj_t BgL_auxz00_4177; + BgL_auxz00_4177 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))-> + pair_t).cdr); + BgL_auxz00_4176 = + ((((obj_t) ((long) BgL_auxz00_4177 - 3))->pair_t). + car); + } + BgL_testz00_4175 = + ((((long) BgL_auxz00_4176) & ((1 << 2) - 1)) == 3); + } + if (BgL_testz00_4175) { + goto BgL_tagzd21971zd2_948; + } else { + int BgL_testz00_4181; + { + obj_t BgL_auxz00_4182; + { + obj_t BgL_auxz00_4183; + { + obj_t BgL_auxz00_4184; + BgL_auxz00_4184 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))-> + pair_t).cdr); + BgL_auxz00_4183 = + ((((obj_t) ((long) BgL_auxz00_4184 - 3))-> + pair_t).cdr); + } + BgL_auxz00_4182 = + ((((obj_t) ((long) BgL_auxz00_4183 - 3))-> + pair_t).car); + } + BgL_testz00_4181 = + ((((long) BgL_auxz00_4182) & ((1 << 2) - 1)) == + 3); + } + if (BgL_testz00_4181) { + goto BgL_tagzd21971zd2_948; + } else { + goto BgL_tagzd21971zd2_948; + } + } + } + } + } else { + int BgL_testz00_4189; + { + obj_t BgL_auxz00_4190; + BgL_auxz00_4190 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t). + car); + BgL_testz00_4189 = + ((((long) BgL_auxz00_4190) & ((1 << 2) - 1)) == 3); + } + if (BgL_testz00_4189) { + goto BgL_tagzd21971zd2_948; + } else { + int BgL_testz00_4193; + { + obj_t BgL_auxz00_4194; + { + obj_t BgL_auxz00_4195; + BgL_auxz00_4195 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t). + cdr); + BgL_auxz00_4194 = + ((((obj_t) ((long) BgL_auxz00_4195 - 3))->pair_t). + car); + } + BgL_testz00_4193 = + ((((long) BgL_auxz00_4194) & ((1 << 2) - 1)) == 3); + } + if (BgL_testz00_4193) { + goto BgL_tagzd21971zd2_948; + } else { + int BgL_testz00_4199; + { + obj_t BgL_auxz00_4200; + { + obj_t BgL_auxz00_4201; + { + obj_t BgL_auxz00_4202; + BgL_auxz00_4202 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))-> + pair_t).cdr); + BgL_auxz00_4201 = + ((((obj_t) ((long) BgL_auxz00_4202 - 3))-> + pair_t).cdr); + } + BgL_auxz00_4200 = + ((((obj_t) ((long) BgL_auxz00_4201 - 3))->pair_t). + car); + } + BgL_testz00_4199 = + ((((long) BgL_auxz00_4200) & ((1 << 2) - 1)) == 3); + } + if (BgL_testz00_4199) { + goto BgL_tagzd21971zd2_948; + } else { + if ((BgL_namedzf3zf3_42 != + ((obj_t) (obj_t) + ((long) (((long) (1) << 2) | 2))))) { + obj_t BgL_v1050z00_1022; + { + int BgL_auxz00_4209; + BgL_auxz00_4209 = (int) (((long) 3)); + BgL_v1050z00_1022 = + create_vector (BgL_auxz00_4209); + } + { + obj_t BgL_arg1604z00_1024; + BgL_arg1604z00_1024 = + make_pair (BgL_wherez00_41, BgL_bodyz00_40); + { + int BgL_auxz00_4213; + BgL_auxz00_4213 = (int) (((long) 2)); + ((& + (((obj_t) (BgL_v1050z00_1022))->vector_t. + obj0))[BgL_auxz00_4213] = + BgL_arg1604z00_1024, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + } + { + int BgL_auxz00_4216; + BgL_auxz00_4216 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1050z00_1022))->vector_t.obj0)) + [BgL_auxz00_4216] = + BgL_locz00_43, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4221; + int BgL_auxz00_4219; + BgL_auxz00_4221 = + (obj_t) ((long) + (((long) (((long) 50)) << 2) | 1)); + BgL_auxz00_4219 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1050z00_1022))->vector_t.obj0)) + [BgL_auxz00_4219] = + BgL_auxz00_4221, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1050z00_1022; + } else { + obj_t BgL_v1051z00_1025; + { + int BgL_auxz00_4224; + BgL_auxz00_4224 = (int) (((long) 3)); + BgL_v1051z00_1025 = + create_vector (BgL_auxz00_4224); + } + { + int BgL_auxz00_4227; + BgL_auxz00_4227 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1051z00_1025))->vector_t.obj0)) + [BgL_auxz00_4227] = + BgL_bodyz00_40, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + { + int BgL_auxz00_4230; + BgL_auxz00_4230 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1051z00_1025))->vector_t.obj0)) + [BgL_auxz00_4230] = + BgL_locz00_43, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4235; + int BgL_auxz00_4233; + BgL_auxz00_4235 = + (obj_t) ((long) + (((long) (((long) 54)) << 2) | 1)); + BgL_auxz00_4233 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1051z00_1025))->vector_t.obj0)) + [BgL_auxz00_4233] = + BgL_auxz00_4235, + ((obj_t) (obj_t) + ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1051z00_1025; + } + } + } + } + } + } + } else { + int BgL_testz00_4238; + { + obj_t BgL_auxz00_4239; + BgL_auxz00_4239 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t).car); + BgL_testz00_4238 = + ((((long) BgL_auxz00_4239) & ((1 << 2) - 1)) == 3); + } + if (BgL_testz00_4238) { + goto BgL_tagzd21971zd2_948; + } else { + int BgL_testz00_4242; + { + obj_t BgL_auxz00_4243; + BgL_auxz00_4243 = + ((((obj_t) ((long) BgL_cdrzd21979zd2_953 - 3))->pair_t). + car); + BgL_testz00_4242 = + ((((long) BgL_auxz00_4243) & ((1 << 2) - 1)) == 3); + } + if (BgL_testz00_4242) { + goto BgL_tagzd21971zd2_948; + } else { + if ((BgL_namedzf3zf3_42 != + ((obj_t) (obj_t) ((long) (((long) (1) << 2) | 2))))) { + obj_t BgL_v1048z00_1018; + { + int BgL_auxz00_4248; + BgL_auxz00_4248 = (int) (((long) 3)); + BgL_v1048z00_1018 = create_vector (BgL_auxz00_4248); + } + { + obj_t BgL_arg1602z00_1020; + BgL_arg1602z00_1020 = + make_pair (BgL_wherez00_41, BgL_bodyz00_40); + { + int BgL_auxz00_4252; + BgL_auxz00_4252 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1048z00_1018))->vector_t.obj0)) + [BgL_auxz00_4252] = + BgL_arg1602z00_1020, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + } + { + int BgL_auxz00_4255; + BgL_auxz00_4255 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1048z00_1018))->vector_t.obj0)) + [BgL_auxz00_4255] = + BgL_locz00_43, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4260; + int BgL_auxz00_4258; + BgL_auxz00_4260 = + (obj_t) ((long) (((long) (((long) 49)) << 2) | 1)); + BgL_auxz00_4258 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1048z00_1018))->vector_t.obj0)) + [BgL_auxz00_4258] = + BgL_auxz00_4260, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1048z00_1018; + } else { + obj_t BgL_v1049z00_1021; + { + int BgL_auxz00_4263; + BgL_auxz00_4263 = (int) (((long) 3)); + BgL_v1049z00_1021 = create_vector (BgL_auxz00_4263); + } + { + int BgL_auxz00_4266; + BgL_auxz00_4266 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1049z00_1021))->vector_t.obj0)) + [BgL_auxz00_4266] = + BgL_bodyz00_40, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + int BgL_auxz00_4269; + BgL_auxz00_4269 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1049z00_1021))->vector_t.obj0)) + [BgL_auxz00_4269] = + BgL_locz00_43, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4274; + int BgL_auxz00_4272; + BgL_auxz00_4274 = + (obj_t) ((long) (((long) (((long) 53)) << 2) | 1)); + BgL_auxz00_4272 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1049z00_1021))->vector_t.obj0)) + [BgL_auxz00_4272] = + BgL_auxz00_4274, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1049z00_1021; + } + } + } + } + } + } else { + int BgL_testz00_4277; + { + obj_t BgL_auxz00_4278; + BgL_auxz00_4278 = + ((((obj_t) ((long) BgL_formalsz00_39 - 3))->pair_t).car); + BgL_testz00_4277 = + ((((long) BgL_auxz00_4278) & ((1 << 2) - 1)) == 3); + } + if (BgL_testz00_4277) { + goto BgL_tagzd21971zd2_948; + } else { + if ((BgL_namedzf3zf3_42 != + ((obj_t) (obj_t) ((long) (((long) (1) << 2) | 2))))) { + obj_t BgL_v1046z00_1014; + { + int BgL_auxz00_4283; + BgL_auxz00_4283 = (int) (((long) 3)); + BgL_v1046z00_1014 = create_vector (BgL_auxz00_4283); + } + { + obj_t BgL_arg1600z00_1016; + BgL_arg1600z00_1016 = + make_pair (BgL_wherez00_41, BgL_bodyz00_40); + { + int BgL_auxz00_4287; + BgL_auxz00_4287 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1046z00_1014))->vector_t.obj0)) + [BgL_auxz00_4287] = + BgL_arg1600z00_1016, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + } + { + int BgL_auxz00_4290; + BgL_auxz00_4290 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1046z00_1014))->vector_t.obj0)) + [BgL_auxz00_4290] = + BgL_locz00_43, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4295; + int BgL_auxz00_4293; + BgL_auxz00_4295 = + (obj_t) ((long) (((long) (((long) 48)) << 2) | 1)); + BgL_auxz00_4293 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1046z00_1014))->vector_t.obj0)) + [BgL_auxz00_4293] = + BgL_auxz00_4295, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1046z00_1014; + } else { + obj_t BgL_v1047z00_1017; + { + int BgL_auxz00_4298; + BgL_auxz00_4298 = (int) (((long) 3)); + BgL_v1047z00_1017 = create_vector (BgL_auxz00_4298); + } + { + int BgL_auxz00_4301; + BgL_auxz00_4301 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1047z00_1017))->vector_t.obj0)) + [BgL_auxz00_4301] = + BgL_bodyz00_40, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + int BgL_auxz00_4304; + BgL_auxz00_4304 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1047z00_1017))->vector_t.obj0)) + [BgL_auxz00_4304] = + BgL_locz00_43, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4309; + int BgL_auxz00_4307; + BgL_auxz00_4309 = + (obj_t) ((long) (((long) (((long) 52)) << 2) | 1)); + BgL_auxz00_4307 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1047z00_1017))->vector_t.obj0)) + [BgL_auxz00_4307] = + BgL_auxz00_4309, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1047z00_1017; + } + } + } + } + } else { + if ((BgL_namedzf3zf3_42 != + ((obj_t) (obj_t) ((long) (((long) (1) << 2) | 2))))) { + obj_t BgL_v1044z00_1010; + { + int BgL_auxz00_4314; + BgL_auxz00_4314 = (int) (((long) 3)); + BgL_v1044z00_1010 = create_vector (BgL_auxz00_4314); + } + { + obj_t BgL_arg1598z00_1012; + BgL_arg1598z00_1012 = make_pair (BgL_wherez00_41, BgL_bodyz00_40); + { + int BgL_auxz00_4318; + BgL_auxz00_4318 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1044z00_1010))->vector_t.obj0)) + [BgL_auxz00_4318] = + BgL_arg1598z00_1012, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + } + { + int BgL_auxz00_4321; + BgL_auxz00_4321 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1044z00_1010))->vector_t.obj0))[BgL_auxz00_4321] + = + BgL_locz00_43, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4326; + int BgL_auxz00_4324; + BgL_auxz00_4326 = + (obj_t) ((long) (((long) (((long) 47)) << 2) | 1)); + BgL_auxz00_4324 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1044z00_1010))->vector_t.obj0))[BgL_auxz00_4324] + = + BgL_auxz00_4326, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1044z00_1010; + } else { + obj_t BgL_v1045z00_1013; + { + int BgL_auxz00_4329; + BgL_auxz00_4329 = (int) (((long) 3)); + BgL_v1045z00_1013 = create_vector (BgL_auxz00_4329); + } + { + int BgL_auxz00_4332; + BgL_auxz00_4332 = (int) (((long) 2)); + ((&(((obj_t) (BgL_v1045z00_1013))->vector_t.obj0))[BgL_auxz00_4332] + = + BgL_bodyz00_40, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + int BgL_auxz00_4335; + BgL_auxz00_4335 = (int) (((long) 1)); + ((&(((obj_t) (BgL_v1045z00_1013))->vector_t.obj0))[BgL_auxz00_4335] + = + BgL_locz00_43, ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + { + obj_t BgL_auxz00_4340; + int BgL_auxz00_4338; + BgL_auxz00_4340 = + (obj_t) ((long) (((long) (((long) 51)) << 2) | 1)); + BgL_auxz00_4338 = (int) (((long) 0)); + ((&(((obj_t) (BgL_v1045z00_1013))->vector_t.obj0))[BgL_auxz00_4338] + = + BgL_auxz00_4340, + ((obj_t) (obj_t) ((long) (((long) (3) << 2) | 2)))); + } + return BgL_v1045z00_1013; + } + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020304-2.c b/gcc/testsuite/gcc.c-torture/compile/20020304-2.c new file mode 100644 index 000000000..9a162d493 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020304-2.c @@ -0,0 +1,10 @@ +/* This testcase ICEd because a SUBREG of MEM/v was never + simplified. */ +volatile unsigned long long *a; + +unsigned char +foo (void) +{ + unsigned char b = (*a != 0); + return b; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020309-1.c b/gcc/testsuite/gcc.c-torture/compile/20020309-1.c new file mode 100644 index 000000000..b74061764 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020309-1.c @@ -0,0 +1,14 @@ +int +sub1 (char *p, int i) +{ + char j = p[i]; + + { + void + sub2 () + { + i = 2; + p = p + 2; + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020309-2.c b/gcc/testsuite/gcc.c-torture/compile/20020309-2.c new file mode 100644 index 000000000..77699e43d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020309-2.c @@ -0,0 +1,16 @@ +/* This testcase ICEd on IA-32 at -O2, because loop was calling convert_modes + between a MODE_FLOAT and MODE_INT class modes. */ + +typedef union +{ + double d; + long long ll; +} A; + +void +foo (A x, A **y, A z) +{ + for (; *y; y++) + if (x.ll == 262 && (*y)->d == z.d) + break; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020312-1.c b/gcc/testsuite/gcc.c-torture/compile/20020312-1.c new file mode 100644 index 000000000..bb950ff31 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020312-1.c @@ -0,0 +1,25 @@ +/* This does not compile on HC11/HC12 due to the asm which requires + two 32-bit registers. */ +/* { dg-do assemble } */ +/* { dg-xfail-if "" { m6811-*-* m6812-*-* } { "*" } { "" } } */ +/* { dg-skip-if "" { pdp11-*-* } { "-O0" } { "" } } */ + +/* PR optimization/5892 */ +typedef struct { unsigned long a; unsigned int b, c; } A; +typedef struct { unsigned long a; A *b; int c; } B; + +static inline unsigned int +bar (unsigned int x) +{ + unsigned long r; + asm ("" : "=r" (r) : "0" (x)); + return r >> 31; +} + +int foo (B *x) +{ + A *y; + y = x->b; + y->b = bar (x->c); + y->c = ({ unsigned int z = 1; (z << 24) | (z >> 24); }); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020314-1.c b/gcc/testsuite/gcc.c-torture/compile/20020314-1.c new file mode 100644 index 000000000..b21eb14f8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020314-1.c @@ -0,0 +1,26 @@ +typedef struct tux_req_struct tux_req_t; +struct tux_req_struct +{ + struct socket *sock; + char usermode; + char *userbuf; + unsigned int userlen; + char error; + void *private; +}; +void user_send_buffer (tux_req_t *req, int cachemiss) +{ + int ret; +repeat: + switch (ret) { + case -11: + if (add_output_space_event(req, req->sock)) { + del_tux_atom(req); + goto repeat; + } + do { } while (0); + break; + default: + add_req_to_workqueue(req); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020315-1.c b/gcc/testsuite/gcc.c-torture/compile/20020315-1.c new file mode 100644 index 000000000..c6c9daa2f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020315-1.c @@ -0,0 +1,34 @@ +/* PR bootstrap/4128 */ + +extern int bar (char *, char *, int, int); +extern long baz (char *, char *, int, int); + +int sgt (char *a, char *b, int c, int d) +{ + return bar (a, b, c, d) > 0; +} + +long dgt (char *a, char *b, int c, int d) +{ + return baz (a, b, c, d) > 0; +} + +int sne (char *a, char *b, int c, int d) +{ + return bar (a, b, c, d) != 0; +} + +long dne (char *a, char *b, int c, int d) +{ + return baz (a, b, c, d) != 0; +} + +int seq (char *a, char *b, int c, int d) +{ + return bar (a, b, c, d) == 0; +} + +long deq (char *a, char *b, int c, int d) +{ + return baz (a, b, c, d) == 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020318-1.c b/gcc/testsuite/gcc.c-torture/compile/20020318-1.c new file mode 100644 index 000000000..097a35d79 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020318-1.c @@ -0,0 +1,16 @@ +/* PR c/5656 + This testcase ICEd on IA-32 at -O3, due to tree inliner not converting + parameter assignment when using K&R syntax. */ + +void foo (c) + char c; +{ + (void) &c; +} + +int bar (void); + +void baz (void) +{ + foo (bar ()); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020319-1.c b/gcc/testsuite/gcc.c-torture/compile/20020319-1.c new file mode 100644 index 000000000..be5b9c2fe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020319-1.c @@ -0,0 +1,20 @@ +/* This testcase ICEd in combine.c:do_SUBST() self-test for sign-extended +CONST_INT because expr.c:expand_expr() was not sign-extending array index +into constant strings. */ + +typedef unsigned char uch; +extern uch outbuf[]; +extern unsigned outcnt; + +extern void flush_outbuf (void); + +int zip(void) +{ + outcnt = 0; + + {outbuf[outcnt++]=(uch)("\037\213"[0]); if (outcnt==16384) flush_outbuf();}; + {outbuf[outcnt++]=(uch)("\037\213"[1]); if (outcnt==16384) flush_outbuf();}; + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20020320-1.c b/gcc/testsuite/gcc.c-torture/compile/20020320-1.c new file mode 100644 index 000000000..385c061e1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020320-1.c @@ -0,0 +1,24 @@ +/* PR bootstrap/4192 + This testcase caused infinite loop in flow (several places), + because flow assumes gen_jump generates simple_jump_p. */ + +typedef void (*T) (void); +extern T x[]; + +void +foo (void) +{ + static T *p = x; + static _Bool a; + T f; + + if (__builtin_expect (a, 0)) + return; + + while ((f = *p)) + { + p++; + f (); + } + a = 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020323-1.c b/gcc/testsuite/gcc.c-torture/compile/20020323-1.c new file mode 100644 index 000000000..ed3c66651 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020323-1.c @@ -0,0 +1,26 @@ +/* This testcase caused ICE on powerpc at -O3, because regrename did + not handle match_dup of match_operator if the RTLs were not shared. */ + +struct A +{ + unsigned char *a0, *a1; + int a2; +}; + +void bar (struct A *); + +unsigned int +foo (int x) +{ + struct A a; + unsigned int b; + + if (x < -128 || x > 255 || x == -1) + return 26; + + a.a0 = (unsigned char *) &b; + a.a1 = a.a0 + sizeof (unsigned int); + a.a2 = 0; + bar (&a); + return b; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020330-1.c b/gcc/testsuite/gcc.c-torture/compile/20020330-1.c new file mode 100644 index 000000000..cac709912 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020330-1.c @@ -0,0 +1,27 @@ +/* PR 5446 */ +/* This testcase is similar to gcc.c-torture/compile/20011219-1.c except + with parts of it omitted, causing an ICE with -O3 on IA-64. */ + +void * baz (unsigned long); +static inline double ** +bar (long w, long x, long y, long z) +{ + long i, a = x - w + 1, b = z - y + 1; + double **m = (double **) baz (sizeof (double *) * (a + 1)); + + m += 1; + m -= w; + m[w] = (double *) baz (sizeof (double) * (a * b + 1)); + for (i = w + 1; i <= x; i++) + m[i] = m[i - 1] + b; + return m; +} + +void +foo (double w[], int x, double y[], double z[]) +{ + int i; + double **a; + + a = bar (1, 50, 1, 50); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020409-1.c b/gcc/testsuite/gcc.c-torture/compile/20020409-1.c new file mode 100644 index 000000000..1bdc08ff3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020409-1.c @@ -0,0 +1,9 @@ +/* PR c/5078 */ + +#include + +int f(int i) +{ + i -= 2 * (INT_MAX + 1); + return i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020415-1.c b/gcc/testsuite/gcc.c-torture/compile/20020415-1.c new file mode 100644 index 000000000..95cdc1eaf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020415-1.c @@ -0,0 +1,22 @@ +/* Check that floating point casts of integer operations don't ICE. */ +/* The first of these routines caused problems for a patch, that wasn't + otherwise caught by a full bootstrap, the regression test suite or + SPEC CPU2000. */ + +double +andop (unsigned int x) +{ + return x & 1; +} + +double +orop (unsigned int x) +{ + return x | 1; +} + +double +notop (unsigned int x) +{ + return ~x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020418-1.c b/gcc/testsuite/gcc.c-torture/compile/20020418-1.c new file mode 100644 index 000000000..df01e6847 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020418-1.c @@ -0,0 +1,18 @@ +/* PR c/6358 + This testcase ICEd on IA-32 in foo, because current_function_return_rtx + was assigned a hard register only after expand_null_return was called, + thus return pseudo was clobbered twice and the hard register not at + all. */ + +void baz (void); + +double foo (void) +{ + baz (); + return; +} + +double bar (void) +{ + baz (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020530-1.c b/gcc/testsuite/gcc.c-torture/compile/20020530-1.c new file mode 100644 index 000000000..a6794892e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020530-1.c @@ -0,0 +1,16 @@ +/* PR optimization/6822 */ + +extern unsigned char foo1 (void); +extern unsigned short foo2 (void); + +int bar1 (void) +{ + unsigned char q = foo1 (); + return (q < 0x80) ? 64 : 0; +} + +int bar2 (void) +{ + unsigned short h = foo2 (); + return (h < 0x8000) ? 64 : 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020604-1.c b/gcc/testsuite/gcc.c-torture/compile/20020604-1.c new file mode 100644 index 000000000..8b958040e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020604-1.c @@ -0,0 +1,93 @@ +/* { dg-do assemble } */ +/* { dg-xfail-if "The array is too big" { "m6811-*-* m6812-*-*" } { "*" } { "" } } */ +/* { dg-skip-if "The array is too big" { "avr-*-*" "pdp11-*-*" } { "*" } { "" } } */ +/* { dg-xfail-if "The array too big" { "h8300-*-*" } { "-mno-h" "-mn" } { "" } } */ +/* { dg-skip-if "" { m32c-*-* } { } { } } */ + +/* PR c/6957 + This testcase ICEd at -O2 on IA-32, because + (insn 141 139 142 (set (subreg:SF (reg:QI 72) 0) + (plus:SF (reg:SF 73) + (reg:SF 76))) 525 {*fop_sf_comm_nosse} (insn_list 134 (nil)) + (expr_list:REG_DEAD (reg:SF 73) (nil))) + couldn't be reloaded. */ + +void +foo (unsigned int n, int x, int y, unsigned char *z) +{ + int a, b; + float c[2048][4]; + + switch (x) + { + case 0x1906: + a = b = -1; + break; + case 0x190A: + a = b = -1; + break; + case 0x8049: + a = b = -1; + break; + case 0x1907: + a = 1; + b = 2; + break; + default: + return; + } + + if (a >= 0) + { + unsigned char *d = z; + unsigned int i; + for (i = 0; i < n; i++) + { + do + { + union + { + float r; + unsigned int i; + } + e; + e.r = c[i][1]; + d[a] = + ((e.i >= 0x3f7f0000) ? ((int) e.i < + 0) ? (unsigned char) 0 + : (unsigned char) 255 : (e.r = + e.r * (255.0F / 256.0F) + + 32768.0F, (unsigned char) e.i)); + } + while (0); + d += y; + } + } + + if (b >= 0) + { + unsigned char *d = z; + unsigned int i; + for (i = 0; i < n; i++) + { + do + { + union + { + float r; + unsigned int i; + } + e; + e.r = c[i][2]; + d[b] = + ((e.i >= 0x3f7f0000) ? ((int) e.i < + 0) ? (unsigned char) 0 + : (unsigned char) 255 : (e.r = + e.r * (255.0F / 256.0F) + + 32768.0F, (unsigned char) e.i)); + } + while (0); + d += y; + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020605-1.c b/gcc/testsuite/gcc.c-torture/compile/20020605-1.c new file mode 100644 index 000000000..960a4be7e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020605-1.c @@ -0,0 +1,17 @@ +/* This testcase caused on IA-32 -O2 endless loop in + merge_blocks when trying to merge a basic block + with itself. */ + +void f (void) +{ + char *c; + do + { + if (c) + break; + } + while (1); + if (!c) + while (1) + f (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020701-1.c b/gcc/testsuite/gcc.c-torture/compile/20020701-1.c new file mode 100644 index 000000000..1258cec28 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020701-1.c @@ -0,0 +1,75 @@ +/* PR target/7177 + Problem with cris-axis-elf: ICE in global. + Origin: hp@axis.com. */ + +typedef __SIZE_TYPE__ size_t; +void f1 (void *); +char *f2 (const char *); +int atoi (const char *); +char *strchr (const char *, int); +int strcmp (const char *, const char *); +size_t strlen (const char *); +typedef enum { A, B, C } t1; +extern const char _v[]; + +static t1 +f (const char* p1, const char* p2, char p3) +{ + char *v1; + char *v2; + char *a; + char *v3; + char *v4; + char *v5; + char *e; + char *v6; + t1 r = C; + + v1 = f2 (p2); + v4 = f2 (p1); + + a = v2 = v1; + e = v5 = v4; + memcpy (&e, &e, sizeof (e)); + + v3 = strchr (v2, ','); + v6 = strchr (v5, ','); + + while ((_v + 1)[(unsigned) *a] & 4) + a++; + while ((_v + 1)[(unsigned) *e] & 4) + e++; + + if (a == v3 && e == v6) + { + if (p3) + r = atoi (v5) < atoi (v2) ? B : A; + else + r = atoi (v5) > atoi (v2) ? B : A; + v2 = ++a; + v5 = ++e; + v3 = strchr (v2, ','); + v6 = strchr (v5, ','); + + while ((_v + 1)[(unsigned) *a] & 4) + a++; + while ((_v + 1)[(unsigned) *e] & 4) + e++; + + if (a == v3 && e == v6) + { + if (r == B) + r = B; + else if (p3) + r = atoi (v5) < atoi (v2) ? B : A; + else + r = atoi (v5) > atoi (v2) ? B : A; + } + else + r = C; + } + + f1 (v1); + f1 (v4); + return r; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020706-1.c b/gcc/testsuite/gcc.c-torture/compile/20020706-1.c new file mode 100644 index 000000000..c8811bc68 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020706-1.c @@ -0,0 +1,50 @@ +// Contributed by Alexandre Oliva +// From Red Hat case 106165. + +typedef struct s1 +{ + unsigned short v1; + unsigned char *v2; +} S1; + +extern void bar(const struct s1 *const hdb); +extern unsigned char* foo (); + +unsigned int sn; +S1 *hdb; +S1 *pb; +unsigned short len; + +unsigned int crashIt() +{ + unsigned char *p; + unsigned int nsn; + unsigned short cnt; + + if (sn != 0) return 1; + + if ((len < 12) || ((p = (((pb->v1) >= 8) ? pb->v2 : foo() )) == 0)) + return 1; + + nsn = ( + (((*(unsigned int*)p) & 0x000000ff) << 24) | + (((*(unsigned int*)p) & 0x0000ff00) << 8) | + (((*(unsigned int*)p) & 0x00ff0000) >> 8) | + (((*(unsigned int*)p) & 0xff000000) >> 24) ); + p += 4; + + cnt = (unsigned short) (( + (((*(unsigned int*)p) & 0x000000ff) << 24) | + (((*(unsigned int*)p) & 0x0000ff00) << 8) | + (((*(unsigned int*)p) & 0x00ff0000) >> 8) | + (((*(unsigned int*)p) & 0xff000000) >> 24) ) & + 0xffff); + + if ((len != 12 + (cnt * 56)) || (nsn == 0)) + { + bar(hdb); + return 1; + } + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020706-2.c b/gcc/testsuite/gcc.c-torture/compile/20020706-2.c new file mode 100644 index 000000000..b84dda60f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020706-2.c @@ -0,0 +1,26 @@ +// Contributed by Alexandre Oliva +// From Red Hat case 106165. + +typedef unsigned short (FUNC_P) (void *, unsigned char *, unsigned short); + +void crashIt(int id, FUNC_P *func, unsigned char *funcparm) +{ + unsigned char buff[5], reverse[4]; + unsigned char *bp = buff; + unsigned char *rp = reverse; + unsigned short int count = 0; + unsigned short cnt; + while (id > 0) + { + *rp++ = (unsigned char) (id & 0x7F); + id >>= 7; + count++; + } + cnt = count + 1; + while ((count--) > 1) + { + *bp++ = (unsigned char)(*(--rp) | 0x80); + } + *bp++ = *(--rp); + (void)(*func)(funcparm, buff, cnt); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020709-1.c b/gcc/testsuite/gcc.c-torture/compile/20020709-1.c new file mode 100644 index 000000000..af0e1ddf4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020709-1.c @@ -0,0 +1,7 @@ +extern double atof (__const char *__nptr) __attribute__ ((__pure__)); + +void bar (char *s) +{ + union {double val; unsigned int a, b;} u; + u.val = atof (s); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020710-1.c b/gcc/testsuite/gcc.c-torture/compile/20020710-1.c new file mode 100644 index 000000000..bf6c9066c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020710-1.c @@ -0,0 +1,12 @@ +/* Red Hat bugzilla #68395 + PR middle-end/7245 + This testcase ICEd on IA-32 because shift & compare patterns + predicates allowed any immediate, but constraints allowed only + numbers from 1 to 31. */ + +void foo (int *x, unsigned int y) +{ + int a = y >> -13; + if (a) + *x = a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020715-1.c b/gcc/testsuite/gcc.c-torture/compile/20020715-1.c new file mode 100644 index 000000000..5294133f3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020715-1.c @@ -0,0 +1,22 @@ +/* PR optimization/7153 */ +/* Verify that GCC doesn't promote a register when its + lifetime is not limited to one basic block. */ + +void f(char); +void g(void); + +void scale(void) +{ + int width; + char bytes; + char *src; + + if (width) + { + bytes = *src; + g(); + width *= bytes; + } + + f(bytes); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020807-1.c b/gcc/testsuite/gcc.c-torture/compile/20020807-1.c new file mode 100644 index 000000000..c1cc81504 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020807-1.c @@ -0,0 +1,33 @@ +int x; + +static int +__attribute__ ((noinline)) +foo (void) +{ + return 0; +} + +static void +__attribute__ ((noinline)) +bar (void) +{ +} + +static inline void +baz (void) +{ + char arr[x]; + +lab: + if (foo () == -1) + { + bar (); + goto lab; + } +} + +void +test (void) +{ + baz (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020910-1.c b/gcc/testsuite/gcc.c-torture/compile/20020910-1.c new file mode 100644 index 000000000..092809b76 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020910-1.c @@ -0,0 +1,19 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int a; +#else +unsigned int x0 = 0; + +typedef struct { + unsigned int field1 : 20; + unsigned int field2 : 12; +} XX; + +static XX yy; + +static void foo (void) +{ + yy.field1 = (unsigned int ) (&x0); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/20020926-1.c b/gcc/testsuite/gcc.c-torture/compile/20020926-1.c new file mode 100644 index 000000000..260e84454 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020926-1.c @@ -0,0 +1,21 @@ +/* PR c/7160 */ +/* Verify that the register-to-stack converter properly handles + branches without return value containing function calls. */ + +extern int gi; + +extern int foo1(int, int); +extern void foo2(int, int); +extern float foo3(int); + +float bar(int i1, int i2) +{ + int i3; + + if (i2) { + i3 = foo1(i1, gi); + foo2(i1, i3); + } + else + return foo3(i2); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020927-1.c b/gcc/testsuite/gcc.c-torture/compile/20020927-1.c new file mode 100644 index 000000000..b93d8a18d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020927-1.c @@ -0,0 +1,26 @@ +/* PR optimization/7520 */ +/* ICE at -O3 on x86 due to register life problems caused by + the return-without-value in bar. */ + +int +foo () +{ + int i; + long long int j; + + while (1) + { + if (j & 1) + ++i; + j >>= 1; + if (j) + return i; + } +} + +int +bar () +{ + if (foo ()) + return; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20020930-1.c b/gcc/testsuite/gcc.c-torture/compile/20020930-1.c new file mode 100644 index 000000000..d2fa3748a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020930-1.c @@ -0,0 +1,10 @@ +/* PR c/8002 */ + +float expm1f(float x) { + union { + float value; + unsigned word; + } sf_u; + sf_u.word = (unsigned) x * 2; + return x + sf_u.value; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021001-1.c b/gcc/testsuite/gcc.c-torture/compile/20021001-1.c new file mode 100644 index 000000000..9f0f9c097 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021001-1.c @@ -0,0 +1,4 @@ +int foo (double x, double y) +{ + return !__builtin_isunordered (x, y); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021007-1.c b/gcc/testsuite/gcc.c-torture/compile/20021007-1.c new file mode 100644 index 000000000..de4c0defa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021007-1.c @@ -0,0 +1,11 @@ +/* PR c/7411 */ +/* Verify that GCC simplifies the null addition to i before + virtual register substitution tries it and winds up with + a memory to memory move. */ + +void foo () +{ + int i = 0,j; + + i+=j=0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021008-1.c b/gcc/testsuite/gcc.c-torture/compile/20021008-1.c new file mode 100644 index 000000000..9d5a7f276 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021008-1.c @@ -0,0 +1,11 @@ +/* Origin: PR target/7434 Gwenole Beauchesne */ + +int main(void) +{ + static const int align_g[] = { 1, 2, 4, 8, 16 }; + char * buf; + int i = 0; + volatile long double val = 0; + val = *((long double *)(buf + align_g[i])); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021015-1.c b/gcc/testsuite/gcc.c-torture/compile/20021015-1.c new file mode 100644 index 000000000..789b8a8b1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021015-1.c @@ -0,0 +1,12 @@ +/* PR target/7370. */ + +int g (int *x, int *y); + +void f () +{ + int x, y; + char a[4000]; + + g (&x, &y); + x = x/y + x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021015-2.c b/gcc/testsuite/gcc.c-torture/compile/20021015-2.c new file mode 100644 index 000000000..6b158c5bd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021015-2.c @@ -0,0 +1,7 @@ +/* PR target/8232. */ + +int f (char *p, char *q, int i) +{ + return bcmp (p, q, i); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20021103-1.c b/gcc/testsuite/gcc.c-torture/compile/20021103-1.c new file mode 100644 index 000000000..82802001a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021103-1.c @@ -0,0 +1,10 @@ +/* PR middle-end/8408 */ +/* Verify that the recognizer explicitly + handles ADDRESSOF operands. */ + +void foo(void) +{ + double d1 = 3.14159, d2; + if (&d2 == &d1) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021108-1.c b/gcc/testsuite/gcc.c-torture/compile/20021108-1.c new file mode 100644 index 000000000..01b6e4ed7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021108-1.c @@ -0,0 +1,7 @@ +int +main() +{ +l1: + return &&l1-&&l2; +l2:; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021110.c b/gcc/testsuite/gcc.c-torture/compile/20021110.c new file mode 100644 index 000000000..dd2aa7e09 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021110.c @@ -0,0 +1,10 @@ +/* PR c/8439 */ +/* Verify that GCC properly handles null increments. */ + +struct empty { +}; + +void foo(struct empty *p) +{ + p++; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021119-1.c b/gcc/testsuite/gcc.c-torture/compile/20021119-1.c new file mode 100644 index 000000000..d4306b89b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021119-1.c @@ -0,0 +1,11 @@ +/* PR c/8588 */ +/* Contributed by Volker Reichelt. */ + +/* Verify that GCC converts integer constants + in shift operations. */ + +void foo() +{ + unsigned int i, j; + j = (i >> 0xf0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021120-1.c b/gcc/testsuite/gcc.c-torture/compile/20021120-1.c new file mode 100644 index 000000000..423f8ec19 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021120-1.c @@ -0,0 +1,9 @@ +/* PR c/8518 */ +/* Contributed by Volker Reichelt. */ + +/* Verify that GCC doesn't get confused by the + redefinition of an extern inline function. */ + +extern int inline foo () { return 0; } +extern int inline bar () { return 0; } +static int inline bar () { return foo(); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20021120-2.c b/gcc/testsuite/gcc.c-torture/compile/20021120-2.c new file mode 100644 index 000000000..51f0e257d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021120-2.c @@ -0,0 +1,9 @@ +/* PR c/8518 */ +/* Contributed by Volker Reichelt. */ + +/* Verify that GCC doesn't get confused by the + redefinition of an extern inline function. */ + +extern int inline foo () { return 0; } +extern int inline bar () { return 0; } +static int bar () { return foo(); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20021124-1.c b/gcc/testsuite/gcc.c-torture/compile/20021124-1.c new file mode 100644 index 000000000..3ab2b2ef4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021124-1.c @@ -0,0 +1,7 @@ +/* PR optimization/8275 */ +/* Contributed by Volker Reichelt. */ + +unsigned int foo (unsigned int u) +{ + return (u >> 32) & 0xffff; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021204-1.c b/gcc/testsuite/gcc.c-torture/compile/20021204-1.c new file mode 100644 index 000000000..4e8d3fefc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021204-1.c @@ -0,0 +1,16 @@ +/* PR c/7622 */ + +/* Verify that GCC can handle the mix of + extern inline and nested functions. */ + +extern inline int t() +{ + int q() { return 0; } + + return q(); +} + +int foo() +{ + return t(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021205-1.c b/gcc/testsuite/gcc.c-torture/compile/20021205-1.c new file mode 100644 index 000000000..73648e949 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021205-1.c @@ -0,0 +1,9 @@ +typedef struct x x; +extern void *baz(char *); +struct x { char * (*bar) (int); }; +static x **foo() { return ((x**)baz(0)); } +int xyzzy() +{ + baz((*foo())->bar(0)); + return 3; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021212-1.c b/gcc/testsuite/gcc.c-torture/compile/20021212-1.c new file mode 100644 index 000000000..b89669d75 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021212-1.c @@ -0,0 +1,15 @@ +/* PR optimization/8334 */ +/* Verify that GCC produces valid operands + after simplifying an addition. */ + +void foo(int m, int n, double *f) +{ + int i, j, k = 1; + + for (j = 0; j < n; j++) { + for (i = k; i < m; i++) { + f[i] = (double) (i * j); + f[i + j] = (double) ((i + 1) * j); + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021230-1.c b/gcc/testsuite/gcc.c-torture/compile/20021230-1.c new file mode 100644 index 000000000..45ab51fd5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021230-1.c @@ -0,0 +1,8 @@ +/* SH has special handling for combined and/shift sequences. Make + sure that it behaves properly when one input is in the MACL register. */ +int r, t; + +static void initRGB() +{ + t = ((r*255/3) & 0xff) << 16; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030109-1.c b/gcc/testsuite/gcc.c-torture/compile/20030109-1.c new file mode 100644 index 000000000..4df7d1872 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030109-1.c @@ -0,0 +1,6 @@ +void foo () +{ + int x1, x2, x3; + + bar (&x2 - &x1, &x3 - &x2); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030110-1.c b/gcc/testsuite/gcc.c-torture/compile/20030110-1.c new file mode 100644 index 000000000..1cbbaea3c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030110-1.c @@ -0,0 +1,39 @@ +extern char bpp; + +void foo() +{ + if (bpp == 32) + { + if (2 < 8) + { + do + { + while (inb(0x9ae8) & (0x0100 >> (2 +1))); + } + while(0); + } + else + { + do + { + while (inb(0x9ae8) & (0x0100 >> (2))); + } + while(0); + } + } + else + do + { + while (inb(0x9ae8) & (0x0100 >> (1))); + } + while(0); + if (8 < 8) + { + do + { + while (inb(0x9ae8) & (0x0100 >> (8 +1))); + } + while(0); + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20030125-1.c b/gcc/testsuite/gcc.c-torture/compile/20030125-1.c new file mode 100644 index 000000000..656304e2d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030125-1.c @@ -0,0 +1,24 @@ + int count; + + int func(int *valp) { + int val, locked = 0; + + while ((val = *valp) != 0) { + if (count) { + if (count) + locked = 1; + else + locked = 1; + + if (!locked) + continue; + } + + if (!count) + count--; + + break; + } + + return val; + } diff --git a/gcc/testsuite/gcc.c-torture/compile/20030206-1.c b/gcc/testsuite/gcc.c-torture/compile/20030206-1.c new file mode 100644 index 000000000..1e0d54458 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030206-1.c @@ -0,0 +1,14 @@ +/* PR c/9530 */ +/* Contributed by Volker Reichelt. */ + +/* Verify that the call to 'foo' is not turned + into a sibling call. */ + +void foo(float d); + +float bar(float d); + +float baz(float d) +{ + foo(bar(d)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030216-1.c b/gcc/testsuite/gcc.c-torture/compile/20030216-1.c new file mode 100644 index 000000000..8f692f092 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030216-1.c @@ -0,0 +1,42 @@ +/* PR c/8086 */ + +#define P(x) \ + (((((((((((((((((((((((((((((((( \ + (x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) \ + *(x)+a) + +int +polynomial(int a) +{ + return P(3); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030219-1.c b/gcc/testsuite/gcc.c-torture/compile/20030219-1.c new file mode 100644 index 000000000..ecc943f77 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030219-1.c @@ -0,0 +1,6 @@ +int global_one; + +void clobber_register() +{ + *(volatile unsigned char *)(0xE0000000 * global_one) = 0x00; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030220-1.c b/gcc/testsuite/gcc.c-torture/compile/20030220-1.c new file mode 100644 index 000000000..59a03e42c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030220-1.c @@ -0,0 +1,20 @@ +/* PR optimization/9768 */ +/* Originator: Randolph Chung */ + +inline int fixfloor (long x) +{ + if (x >= 0) + return (x >> 16); + else + return ~((~x) >> 16); +} + +inline int fixtoi (long x) +{ + return fixfloor(x) + ((x & 0x8000) >> 15); +} + +int foo(long x, long y) +{ + return fixtoi(x*y); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030224-1.c b/gcc/testsuite/gcc.c-torture/compile/20030224-1.c new file mode 100644 index 000000000..6832dc81e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030224-1.c @@ -0,0 +1,17 @@ +void zzz (char *s1, char *s2, int len, int *q) +{ + int z = 5; + unsigned int i, b; + struct { char a[z]; } x; + + for (i = 0; i < len; i++) + s1[i] = s2[i]; + + b = z & 0x3; + + len += (b == 0 ? 0 : 1) + z; + + *q = len; + + foo (x, x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030305-1.c b/gcc/testsuite/gcc.c-torture/compile/20030305-1.c new file mode 100644 index 000000000..2f608196f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030305-1.c @@ -0,0 +1,18 @@ +/* PR c/9799 */ +/* Verify that GCC doesn't crash on excess elements + in initializer for a flexible array member. */ + +typedef struct { + int aaa; +} s1_t; + +typedef struct { + int bbb; + s1_t s1_array[]; +} s2_t; + +static s2_t s2_array[]= { + { 1, 4 }, + { 2, 5 }, + { 3, 6 } +}; diff --git a/gcc/testsuite/gcc.c-torture/compile/20030310-1.c b/gcc/testsuite/gcc.c-torture/compile/20030310-1.c new file mode 100644 index 000000000..0e89e0bfc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030310-1.c @@ -0,0 +1,13 @@ +static inline void +foo (char accept) +{ + char s; + while (s == accept) ; +} + +static void +bar (void) +{ + char ch; + foo (ch); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030314-1.c b/gcc/testsuite/gcc.c-torture/compile/20030314-1.c new file mode 100644 index 000000000..02d4fed52 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030314-1.c @@ -0,0 +1,18 @@ +/* PR optimization/8396 */ +/* Originator: */ + +/* Verify that the tree inliner doesn't mess up the types + when passing the value of read-only constant arguments. */ + +static inline bar(const short int xs, const short int xe) +{ + if (xe && (xs < xe)) + ; +} + +void f() +{ + short int xe; + + bar(0, xe); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030319-1.c b/gcc/testsuite/gcc.c-torture/compile/20030319-1.c new file mode 100644 index 000000000..dc5ab5774 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030319-1.c @@ -0,0 +1,14 @@ +/* PR 10073 */ +typedef struct +{ + unsigned short digits[4]; +} INT_64; + +INT_64 int_64_com (INT_64 a) +{ + a.digits[0] ^= 0xFFFF; + a.digits[1] ^= 0xFFFF; + a.digits[2] ^= 0xFFFF; + a.digits[3] ^= 0xFFFF; + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030320-1.c b/gcc/testsuite/gcc.c-torture/compile/20030320-1.c new file mode 100644 index 000000000..72d0d0966 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030320-1.c @@ -0,0 +1,44 @@ +/* Failed on powerpc64-linux with a segfault due to ifcvt generating + conditional returns without updating dominance info. + Extracted from glibc's dl-load.c. */ + +typedef __SIZE_TYPE__ size_t; + +static size_t +is_dst (const char *start, const char *name, const char *str, + int is_path, int secure) +{ + size_t len; + _Bool is_curly = 0; + + if (name[0] == '{') + { + is_curly = 1; + ++name; + } + + len = 0; + while (name[len] == str[len] && name[len] != '\0') + ++len; + + if (is_curly) + { + if (name[len] != '}') + return 0; + + + --name; + + len += 2; + } + else if (name[len] != '\0' && name[len] != '/' + && (!is_path || name[len] != ':')) + return 0; + + if (__builtin_expect (secure, 0) + && ((name[len] != '\0' && (!is_path || name[len] != ':')) + || (name != start + 1 && (!is_path || name[-2] != ':')))) + return 0; + + return len; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030323-1.c b/gcc/testsuite/gcc.c-torture/compile/20030323-1.c new file mode 100644 index 000000000..8ea602dee --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030323-1.c @@ -0,0 +1,17 @@ +/* PR c/10178. The following code would ICE because we didn't check for + overflow when computing the range of the switch-statment, and therefore + decided it could be implemented using bit-tests. */ + +int +banana(long citron) +{ + switch (citron) { + case 0x80000000: + case 0x40000: + case 0x40001: + return 1; + break; + } + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20030330-1.c b/gcc/testsuite/gcc.c-torture/compile/20030330-1.c new file mode 100644 index 000000000..a5d5de23b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030330-1.c @@ -0,0 +1,7 @@ +/* PR c/10083 */ +/* This will result in a very small constant for umul_highpart, which + uncovered a bug in the Alpha machine description. */ + +unsigned long f(unsigned long x) { + return x % 0x3fffffffffffffff; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030331-1.c b/gcc/testsuite/gcc.c-torture/compile/20030331-1.c new file mode 100644 index 000000000..e5db36bf3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030331-1.c @@ -0,0 +1,13 @@ +/* From PR/9301. Fixed by ebotcazou's patch for PR/9493. */ + +void bar (void); + +void foo (int a, int b, int c, int d, int e) +{ + if (a) + bar(); + if (b && c) + ; + if (d && e) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030405-1.c b/gcc/testsuite/gcc.c-torture/compile/20030405-1.c new file mode 100644 index 000000000..0bdafb923 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030405-1.c @@ -0,0 +1,30 @@ +/* When compiled with -pedantic, this program will cause an ICE when the + constant propagator tries to set the value of *str to UNDEFINED. + + This happens because *str is erroneously considered as a store alias. + The aliasing code is then making *str an alias leader for its alias set + and when the PHI node at the end of the while() is visited the first + time, CCP will try to assign it a value of UNDEFINED, but the default + value for *str is a constant. */ +typedef __SIZE_TYPE__ size_t; +size_t strlength (const char * const); +char foo(); + +static const char * const str = "mingo"; + +bar() +{ + size_t c; + char *x; + + c = strlength (str); + while (c < 10) + { + if (c > 5) + *x = foo (); + if (*x < 'a') + break; + } + + return *x == '3'; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030410-1.c b/gcc/testsuite/gcc.c-torture/compile/20030410-1.c new file mode 100644 index 000000000..9127ede83 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030410-1.c @@ -0,0 +1,27 @@ +/* PR 10201 */ + +extern struct _zend_compiler_globals compiler_globals; +typedef struct _zend_executor_globals zend_executor_globals; +extern zend_executor_globals executor_globals; + +typedef struct _zend_ptr_stack { + int top; + void **top_element; +} zend_ptr_stack; +struct _zend_compiler_globals { +}; +struct _zend_executor_globals { + int *uninitialized_zval_ptr; + zend_ptr_stack argument_stack; +}; + +static inline void safe_free_zval_ptr(int *p) +{ + if (p!=(executor_globals.uninitialized_zval_ptr)) { + } +} +zend_executor_globals executor_globals; +static inline void zend_ptr_stack_clear_multiple(void) +{ + executor_globals.argument_stack.top -= 2; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030415-1.c b/gcc/testsuite/gcc.c-torture/compile/20030415-1.c new file mode 100644 index 000000000..bcca4c85d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030415-1.c @@ -0,0 +1,4 @@ +float g(float f) +{ + return fabs(f); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030416-1.c b/gcc/testsuite/gcc.c-torture/compile/20030416-1.c new file mode 100644 index 000000000..c3d18b682 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030416-1.c @@ -0,0 +1,16 @@ +void foo(int x) +{ + if (x > 3) + {;} + else + bar(); + x = 9; +} + +main() +{ + int j; + + foo(j); + return j; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030418-1.c b/gcc/testsuite/gcc.c-torture/compile/20030418-1.c new file mode 100644 index 000000000..f6d5a4af5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030418-1.c @@ -0,0 +1,16 @@ +/* PR optimization/7675 */ +/* Contributed by Volker Reichelt */ + +/* Verify that we don't put automatic variables + in registers too early. */ + +extern int dummy (int *); + +void foo(int i) +{ + int j=i; + + void bar() { int x=j, y=i; } + + dummy(&i); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030503-1.c b/gcc/testsuite/gcc.c-torture/compile/20030503-1.c new file mode 100644 index 000000000..3c2b28d83 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030503-1.c @@ -0,0 +1,12 @@ +void foo () +{ + if (1) + goto foo; + else + for (;;) + { + foo: + bar (); + return; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030518-1.c b/gcc/testsuite/gcc.c-torture/compile/20030518-1.c new file mode 100644 index 000000000..8cf203451 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030518-1.c @@ -0,0 +1,14 @@ +/* Test case from PR middle-end/10472 */ + +extern void f (char *); + +void foo (char *s) +{ + f (__builtin_stpcpy (s, "hi")); +} + +void bar (char *s) +{ + f (__builtin_mempcpy (s, "hi", 3)); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20030530-1.c b/gcc/testsuite/gcc.c-torture/compile/20030530-1.c new file mode 100644 index 000000000..b479ea22b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030530-1.c @@ -0,0 +1,23 @@ +union tree_node; +typedef union tree_node *tree; +struct tree_common +{ + tree type; + unsigned lang_flag_0 : 1; +}; +union tree_node +{ + struct tree_common common; +}; +static void +java_check_regular_methods (tree class_decl) +{ + int saw_constructor = class_decl->common.type->common.lang_flag_0; + tree class = class_decl->common.type; + for (;;) + { + if (class) + if (class_decl->common.type) + bar (class); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030530-3.c b/gcc/testsuite/gcc.c-torture/compile/20030530-3.c new file mode 100644 index 000000000..0a93d2f13 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030530-3.c @@ -0,0 +1,16 @@ +struct tree_decl +{ + unsigned in_system_header_flag:1; +}; +union tree_node +{ + struct tree_decl decl; +}; +typedef union tree_node *tree; +static int +redeclaration_error_message (olddecl) + tree olddecl; +{ + if (({olddecl;})->decl.in_system_header_flag) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030604-1.c b/gcc/testsuite/gcc.c-torture/compile/20030604-1.c new file mode 100644 index 000000000..7e36bfeb3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030604-1.c @@ -0,0 +1,18 @@ +/* PR optimization/10876 */ +/* Contributed by Christian Ehrhardt */ + +/* Verify that the SPARC port doesn't emit + (minus) (reg) (const_int) insns. */ + +void f(void) +{ + unsigned int butterfly, block, offset; + double *Z; + + for (block = 0; block < 512; block += 512) { + double T1re, T2re; + offset = butterfly + block; + T1re += T2re; + T2re = Z[offset] + T1re; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030605-1.c b/gcc/testsuite/gcc.c-torture/compile/20030605-1.c new file mode 100644 index 000000000..f5e102318 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030605-1.c @@ -0,0 +1,12 @@ +/* Test for proper preparation of the comparison operands for + generation of a conditional trap. Produced unrecognizable + rtl on Sparc. */ + +struct blah { char *b_data; }; + +void set_bh_page(struct blah *bh, unsigned long offset) +{ + if ((1UL << 12 ) <= offset) + __builtin_trap() ; + bh->b_data = (char *)offset; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030612-1.c b/gcc/testsuite/gcc.c-torture/compile/20030612-1.c new file mode 100644 index 000000000..8edbd92bd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030612-1.c @@ -0,0 +1,11 @@ +static inline void +foo (long long const v0, long long const v1) +{ + bar (v0 == v1); +} + +void +test (void) +{ + foo (0, 1); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030624-1.c b/gcc/testsuite/gcc.c-torture/compile/20030624-1.c new file mode 100644 index 000000000..9c293fc34 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030624-1.c @@ -0,0 +1,6 @@ +/* Derived from PR optimization/11311 */ + +double pow(double, double); + +double foo(double x) { return pow(x,261); } + diff --git a/gcc/testsuite/gcc.c-torture/compile/20030703-1.c b/gcc/testsuite/gcc.c-torture/compile/20030703-1.c new file mode 100644 index 000000000..4b45f5e57 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030703-1.c @@ -0,0 +1,10 @@ +/* Extracted from PR target/10700. */ +/* The following code used to cause an ICE on 64-bit targets. */ + +int SAD_Block(int *); +void MBMotionEstimation(int *act_block, int block) +{ + SAD_Block(act_block + ( (8 * (block == 1 || block == 3)) + + (8 * (block == 2 || block == 3)))); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20030704-1.c b/gcc/testsuite/gcc.c-torture/compile/20030704-1.c new file mode 100644 index 000000000..101355c8b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030704-1.c @@ -0,0 +1,17 @@ +/* PR c/11428. */ + +/* fold_single_bit_test() failed to return a tree of the type that the + outer expression was looking for. Specifically, it returned a tree + whose type corresponded to QImode for !p->m, but the desired result + type was int, which corresponded to SImode. emit_move_insn() later + tried to copy a reg:QI to reg:SI, causing an ICE. */ + +struct s { + int m : 1; +}; + +int +foo (struct s *p) +{ + return !p->m; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030707-1.c b/gcc/testsuite/gcc.c-torture/compile/20030707-1.c new file mode 100644 index 000000000..8ce964512 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030707-1.c @@ -0,0 +1,13 @@ +/* PR c/11449. */ + +/* sign_bit_p() in fold-const.c failed to notice that (int) 0x80000000 + was the sign bit of m. As a result, fold_single_bit_test() + returned ((unsigned int) m >> 31), and that was eventually passed + to invert_truthvalue(), which did not know how to handle + RROTATE_EXPR, causing an ICE. */ + +int +foo (int m) +{ + return !(m & ((int) 0x80000000)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030708-1.c b/gcc/testsuite/gcc.c-torture/compile/20030708-1.c new file mode 100644 index 000000000..5a693d8f7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030708-1.c @@ -0,0 +1,13 @@ +/* PR 10795. */ + +/* ix86_expand_carry_flag_compare() in i386.c swapped the comparison + operands without checking that the compare instruction, cmpl, would + accept the swapped operands. */ + +extern const char a[]; + +int +foo (const char *p) +{ + return (p > a) ? 0 : 2; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030716-1.c b/gcc/testsuite/gcc.c-torture/compile/20030716-1.c new file mode 100644 index 000000000..ceb4b6171 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030716-1.c @@ -0,0 +1,7 @@ +void baz(int i); + +void foo(int i, int A[i+1]) +{ + int j=A[i]; + void bar() { baz(A[i]); } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030725-1.c b/gcc/testsuite/gcc.c-torture/compile/20030725-1.c new file mode 100644 index 000000000..26f271401 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030725-1.c @@ -0,0 +1,9 @@ +/* This testcase caused ICE on any 64-bit arch at -O2/-O3 due to + fold/extract_muldiv/convert destroying its argument. */ +int x, *y, z, *p; + +void +foo (void) +{ + p = y + (8 * (x == 1 || x == 3) + z); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030804-1.c b/gcc/testsuite/gcc.c-torture/compile/20030804-1.c new file mode 100644 index 000000000..189fde3ce --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030804-1.c @@ -0,0 +1,9 @@ +/* Extracted from PR middle-end/11771. */ +/* The following testcase used to ICE without -ffast-math from unbounded + recursion in fold. This was due to the logic in negate_expr_p not + matching that in negate_expr. */ + +double f(double x) { + return -(1 - x) + (x ? -(1 - x) : 0); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20030821-1.c b/gcc/testsuite/gcc.c-torture/compile/20030821-1.c new file mode 100644 index 000000000..34700ae18 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030821-1.c @@ -0,0 +1,24 @@ +/* PR target/11805. */ + +/* Consider the following sequence. + + (set (cc0) + (and:HI (reg:HI 0) + (const_int 1))) + + (set (pc) + (if_then_else (le (cc0) + (const_int 0)) + (label_ref 17) + (pc))) + + On h8300, the first insn does not set the overflow flag, but the + second requires the overflow flag. As a result, when the final + wants to output the jump insn, it cannot find a test insn that + gives appropriate condition flags. */ + +unsigned char +foo (unsigned char a) +{ + return (a & 1) > 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030823-1.c b/gcc/testsuite/gcc.c-torture/compile/20030823-1.c new file mode 100644 index 000000000..89a3ea50a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030823-1.c @@ -0,0 +1,18 @@ +struct A +{ + int a; +}; + +int foo (struct A *a) +{ + static int c = 30; + int x; + + a->a = c; + /* Dominator optimizations will replace the use of 'a->a' with 'c', but + they won't copy the virtual operands for 'c' from its originating + statement. This exposes symbol 'c' without a correct SSA version + number. */ + x = a->a; + return x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030902-1.c b/gcc/testsuite/gcc.c-torture/compile/20030902-1.c new file mode 100644 index 000000000..56c2650b8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030902-1.c @@ -0,0 +1,37 @@ +typedef __SIZE_TYPE__ size_t; +typedef unsigned long int reg_syntax_t; +struct re_pattern_buffer +{ + unsigned char *buffer; +}; +typedef enum +{ + jump, + jump_n, +} re_opcode_t; +static int +foo (bufp) + struct re_pattern_buffer *bufp; +{ + int mcnt; + unsigned char *p = bufp->buffer; + switch (((re_opcode_t) * p++)) + { + unconditional_jump: + ; + /* This test case caused an ICE because the statement insertion + routines were failing to update basic block boundaries. */ + case jump: + do + { + (mcnt) = *(p) & 0377; + } + while (0); + (p) += 2; + p += mcnt; + case jump_n: + (mcnt) = *(p + 2) & 0377; + if (mcnt) + goto unconditional_jump; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030903-1.c b/gcc/testsuite/gcc.c-torture/compile/20030903-1.c new file mode 100644 index 000000000..fa4d30db6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030903-1.c @@ -0,0 +1,33 @@ +/* Derived from PR optimization/11700. */ +/* The compiler used to ICE during reload for m68k targets. */ + +void check_complex (__complex__ double, __complex__ double, + __complex__ double, __complex__ int); +void check_float (double, double, double, int); +extern double _Complex conj (double _Complex); +extern double carg (double _Complex __z); + +static double minus_zero; + +void +conj_test (void) +{ + check_complex (conj (({ __complex__ double __retval; + __real__ __retval = (0.0); + __imag__ __retval = (0.0); + __retval; })), + ({ __complex__ double __retval; + __real__ __retval = (0.0); + __imag__ __retval = (minus_zero); + __retval; }), 0, 0); +} + +void +carg_test (void) +{ + check_float (carg (({ __complex__ double __retval; + __real__ __retval = (2.0); + __imag__ __retval = (0); + __retval; })), 0, 0, 0); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20030904-1.c b/gcc/testsuite/gcc.c-torture/compile/20030904-1.c new file mode 100644 index 000000000..09fd015b1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030904-1.c @@ -0,0 +1,94 @@ +struct A +{ + long a1; + double *a2; +}; + +struct B +{ + void *b1; + double b2, b3; + struct + { + int d1; + double d2; + } b4; +}; + +struct C +{ + struct A *c1; + void *c2; +}; + +long fn1 (struct A *, double); +void fn2 (void *, const char *); +double fn3 (double); +double fn4 (double); +int fn5 (void *, double, double); + +int +foo (struct B *x) +{ + struct C *e = x->b1; + struct A *f = e->c1; + long g, h, i; + double *j, k; + g = fn1 (f, 0.5 * (x->b2 + x->b3)), h = g + 1, i = f->a1; + j = f->a2, k = x->b4.d2; + fn2 (x, "something"); + if (g <= 0) + { + double l = j[2] - j[1]; + if (l > 0.0 && l <= 0.02) + k = (x->b4.d1 == 1 + ? ((1.0 / l) < 25 ? 25 : (1.0 / l)) + : fn3 ((1.0 / l) < 25 ? 25 : (1.0 / l))); + } + else + { + double m = j[h] - j[g], n = 0.0, l = 0.0; + if (g > 1) + n = j[g] - j[g - 1]; + if (h < i) + l = j[h + 1] - j[h]; + if (n > 0.02) + n = 0; + if (m > 0.02) + m = 0; + if (l > 0.02) + l = 0; + if (m < n) + { + double o = m; + m = n; + n = o; + } + if (l < n) + { + double o = l; + l = n; + n = o; + } + if (l < m) + { + double o = l; + l = m; + m = o; + } + if (n != 0.0) + k = (x->b4.d1 == 1 + ? ((1 / m) < 25 ? 25 : (1 / m)) + : fn3 ((1 / m) < 25 ? 25 : (1 / m))); + else if (m != 0.0) + k = (x->b4.d1 == 1 + ? ((2 / (m + l)) < 25 ? 25 : (2 / (m + l))) + : fn3 ((2 / (m + l)) < 25 ? 25 : (2 / (m + l)))); + else if (l != 0.0) + k = (x->b4.d1 == 1 + ? ((1 / l) < 25 ? 25 : (1 / l)) + : fn3 ((1 / l) < 25 ? 25 : (1 / l))); + } + fn5 (e->c2, 0.5 * (x->b2 + x->b3), (x->b4.d1 == 1 ? k : fn4 (k))); + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030907-1.c b/gcc/testsuite/gcc.c-torture/compile/20030907-1.c new file mode 100644 index 000000000..e362b9102 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030907-1.c @@ -0,0 +1,25 @@ +/* PR 11665 + Orgin: jwhite@cse.unl.edu + The problem was in initializer_constant_valid_p, + "for a CONSTRUCTOR, only the last element + of the CONSTRUCTOR was being checked" + (from the email of the patch which fixed this). + This used to ICE because GCC thought gdt_table was a + constant value when it is not. */ + +int x; +struct gdt +{ +unsigned a,b,c,d,e,f; +}; +void f() +{ +struct gdt gdt_table[2]= +{ + { + 0, + ( (((unsigned)(&x))<<(24))&(-1<<(8)) ), + }, +}; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20030910-1.c b/gcc/testsuite/gcc.c-torture/compile/20030910-1.c new file mode 100644 index 000000000..9fad10920 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030910-1.c @@ -0,0 +1,11 @@ +/* The gimplifier was getting confused when taking the real or + imaginary component of a complex rvalue. */ + +void test() +{ + __complex double dc; + double d; + + d = __real (dc * dc); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20030917-1.c b/gcc/testsuite/gcc.c-torture/compile/20030917-1.c new file mode 100644 index 000000000..38b6598af --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030917-1.c @@ -0,0 +1,18 @@ +typedef struct string STR; +typedef struct atbl ARRAY; +struct string { + unsigned char str_pok; +}; +struct atbl { + int ary_fill; +}; +blah(size,strp) +register int size; +register STR **strp; +{ + register ARRAY *ar; + ar->ary_fill = size - 1; + while (size--) + (*strp)->str_pok &= ~128; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20030921-1.c b/gcc/testsuite/gcc.c-torture/compile/20030921-1.c new file mode 100644 index 000000000..8199dc657 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030921-1.c @@ -0,0 +1,10 @@ +/* PR 12281 The darwin back-end was causing the function + f is not being emitted. TREE_SYMBOL_REFERENCED was being set + instead of calling mark_referenced. */ + + +static void f(void); +void g(void (*x) (void)){x();} +static inline void f(void){} +void h(){g(f);} +int main(){h();return 0;} diff --git a/gcc/testsuite/gcc.c-torture/compile/20031002-1.c b/gcc/testsuite/gcc.c-torture/compile/20031002-1.c new file mode 100644 index 000000000..a023994f4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031002-1.c @@ -0,0 +1,9 @@ +/* PR/12292 + http://gcc.gnu.org/ml/gcc-patches/2003-10/msg00143.html */ + +char flags; + +int bug12292(int t) +{ + flags &= ~(1 << (t + 4)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20031010-1.c b/gcc/testsuite/gcc.c-torture/compile/20031010-1.c new file mode 100644 index 000000000..33c71c6d1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031010-1.c @@ -0,0 +1,4 @@ +/* This crashed the ARM backend with -mcpu=iwmmxt -O because an insn + required a split which was not available for the iwmmxt. */ +inline int *f1(int* a, int* b) { if (*b < *a) return b; return a; } +int f2(char *d, char *e, int f) { int g = e - d; return *f1(&f, &g); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20031011-1.c b/gcc/testsuite/gcc.c-torture/compile/20031011-1.c new file mode 100644 index 000000000..e35d76211 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031011-1.c @@ -0,0 +1,21 @@ +/* PR optimization/12544 */ +/* Origin: Tony Hosking */ + +/* Verify that non-local structures passed by invisible + reference are correctly put in the stack. */ + +typedef struct { + int a; + int f; +} A; + +A *b; + +void x (A a) { + void y () { + a.a = 0; + } + + b = &a; + y(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20031011-2.c b/gcc/testsuite/gcc.c-torture/compile/20031011-2.c new file mode 100644 index 000000000..026845509 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031011-2.c @@ -0,0 +1,15 @@ +/* PR optimization/12260. */ + +extern int f(void); +extern int g(int); + +static char buf[512]; +void h(int l) { + while (l) { + char *op = buf; + if (f() == 0) + break; + if (g(op - buf + 1)) + break; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20031023-1.c b/gcc/testsuite/gcc.c-torture/compile/20031023-1.c new file mode 100644 index 000000000..67f8ea918 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031023-1.c @@ -0,0 +1,66 @@ +#ifndef ASIZE +# define ASIZE 0x10000000000UL +#endif + +#include + +#if LONG_MAX < 8 * ASIZE +# undef ASIZE +# define ASIZE 4096 +#endif + +extern void abort (void); + +int __attribute__((noinline)) +foo (const char *s) +{ + if (!s) + return 1; + if (s[0] != 'a') + abort (); + s += ASIZE - 1; + if (s[0] != 'b') + abort (); + return 0; +} + +int (*fn) (const char *) = foo; + +int __attribute__((noinline)) +bar (void) +{ + char s[ASIZE]; + s[0] = 'a'; + s[ASIZE - 1] = 'b'; + foo (s); + foo (s); + return 0; +} + +int __attribute__((noinline)) +baz (long i) +{ + if (i) + return fn (0); + else + { + char s[ASIZE]; + s[0] = 'a'; + s[ASIZE - 1] = 'b'; + foo (s); + foo (s); + return fn (0); + } +} + +int +main (void) +{ + if (bar ()) + abort (); + if (baz (0) != 1) + abort (); + if (baz (1) != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20031023-2.c b/gcc/testsuite/gcc.c-torture/compile/20031023-2.c new file mode 100644 index 000000000..663e44715 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031023-2.c @@ -0,0 +1,2 @@ +#define ASIZE 0x1000000000UL +#include "20031023-1.c" diff --git a/gcc/testsuite/gcc.c-torture/compile/20031023-3.c b/gcc/testsuite/gcc.c-torture/compile/20031023-3.c new file mode 100644 index 000000000..f4a16c73c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031023-3.c @@ -0,0 +1,2 @@ +#define ASIZE 0x100000000UL +#include "20031023-1.c" diff --git a/gcc/testsuite/gcc.c-torture/compile/20031023-4.c b/gcc/testsuite/gcc.c-torture/compile/20031023-4.c new file mode 100644 index 000000000..5c61f3743 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031023-4.c @@ -0,0 +1,2 @@ +#define ASIZE 0x80000000UL +#include "20031023-1.c" diff --git a/gcc/testsuite/gcc.c-torture/compile/20031031-1.c b/gcc/testsuite/gcc.c-torture/compile/20031031-1.c new file mode 100644 index 000000000..e641b78a3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031031-1.c @@ -0,0 +1,36 @@ +/* PR/11640 */ + +int +internal_insn_latency (int insn_code, int insn2_code) +{ + switch (insn_code) + { + case 256: + switch (insn2_code) + { + case 267: + return 8; + case 266: + return 8; + case 265: + return 8; + case 264: + return 8; + case 263: + return 8; + } + break; + case 273: + switch (insn2_code) + { + case 267: + return 5; + case 266: + return 5; + case 277: + return 3; + } + break; + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20031031-2.c b/gcc/testsuite/gcc.c-torture/compile/20031031-2.c new file mode 100644 index 000000000..d69dc75ca --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031031-2.c @@ -0,0 +1,36 @@ +/* PR/10239 */ + +enum node_type +{ + INITIAL = 0, FREE, + PRECOLORED, + SIMPLIFY, SIMPLIFY_SPILL, SIMPLIFY_FAT, FREEZE, SPILL, + SELECT, + SPILLED, COALESCED, COLORED, + LAST_NODE_TYPE +}; + +inline void +put_web (enum node_type type) +{ + switch (type) + { + case INITIAL: + case FREE: + case FREEZE: + case SPILL: + foo (); + break; + case PRECOLORED: + bar (); + break; + default: + baz (); + } +} + +void +reset_lists () +{ + put_web (INITIAL); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20031102-1.c b/gcc/testsuite/gcc.c-torture/compile/20031102-1.c new file mode 100644 index 000000000..e32b8bd86 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031102-1.c @@ -0,0 +1,12 @@ +/* PR optimization/10817. + Check that the following code doesn't cause any problems + for GCC's if-conversion passes. */ + +int foo(int t) +{ + int result = 0; + if (t != 0) + result = t; + return result; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20031112-1.c b/gcc/testsuite/gcc.c-torture/compile/20031112-1.c new file mode 100644 index 000000000..466b29edf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031112-1.c @@ -0,0 +1,2 @@ +extern __inline int __finite (double __value) { return 0; } +extern __typeof (__finite) __finite __asm__ ("" "__GI___finite"); diff --git a/gcc/testsuite/gcc.c-torture/compile/20031113-1.c b/gcc/testsuite/gcc.c-torture/compile/20031113-1.c new file mode 100644 index 000000000..74c031c3d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031113-1.c @@ -0,0 +1,21 @@ +/* On Darwin, the stub for simple_cst_equal was not being emitted at all + causing the as to die and not create an object file. */ + +int +attribute_list_contained () +{ + return (simple_cst_equal ()); +} +int +simple_cst_list_equal () +{ + return (simple_cst_equal ()); +} + + +int __attribute__((noinline)) +simple_cst_equal () +{ + return simple_cst_list_equal (); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20031124-1.c b/gcc/testsuite/gcc.c-torture/compile/20031124-1.c new file mode 100644 index 000000000..102e71aa8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031124-1.c @@ -0,0 +1,8 @@ +/* PR 13143 */ + +int f (void *ptr) +{ + extern char const stop[]; + return ptr >= (void *) &stop; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20031125-1.c b/gcc/testsuite/gcc.c-torture/compile/20031125-1.c new file mode 100644 index 000000000..d3e92679c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031125-1.c @@ -0,0 +1,34 @@ +short *_offsetTable; +/* This tests to make sure PRE splits the entry block ->block 0 edge + when there are multiple block 0 predecessors. + This is done so that we don't end up with an insertion on the + entry block -> block 0 edge which would require a split at insertion + time. + PR 13163. */ +void proc4WithoutFDFE(char *dst, const char *src, int next_offs, int bw, + int bh, int pitch) +{ + do { + int i = bw; + int code = *src++; + int x, l; + int length = *src++ + 1; + + for (l = 0; l < length; l++) { + int x; + + for (x = 0; x < 4; x++) ; + if (i == 0) + dst += pitch * 3; + } + char *dst2 = dst + _offsetTable[code] + next_offs; + + for (x = 0; x < 4; x++) { + int j = 0; + (dst + pitch * x)[j] = (dst2 + pitch * x)[j]; + } + dst += pitch * 3; + } while (--bh); +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/20031125-2.c b/gcc/testsuite/gcc.c-torture/compile/20031125-2.c new file mode 100644 index 000000000..42b72480e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031125-2.c @@ -0,0 +1,18 @@ +struct BlobSpan { + int right; +}; +/* This test makes sure we don't accidently cause a bad insertion to occur + by choosing the wrong variable name so that we end up with a use not + dominated by a def. */ +void render_blob_line(struct BlobSpan blobdata) { + int buf[4 * 8]; + int *data = buf; + int i, n = 0; + if (blobdata.right) + n++; + if (n) + for (; i < 2 * n;) + data[i] = 0; + n *= 2; + for (; n;) ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20031203-1.c b/gcc/testsuite/gcc.c-torture/compile/20031203-1.c new file mode 100644 index 000000000..70547fdfe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031203-1.c @@ -0,0 +1,20 @@ +void make_file_symbol_completion_list (char *); +/* This tests to make sure PRE doesn't choose the wrong name when + inserting phi nodes. Otherwise, we get uses that aren't dominated + by defs. + PR 13177. */ +void location_completer (char *text) +{ + char *p, *symbol_start = text; + for (p = text; *p != '\0'; ++p) { + if (*p == '\\' && p[1] == '\'') + p++; + else if (*p == ':') + symbol_start = p + 1; + else + symbol_start = p + 1; + make_file_symbol_completion_list(symbol_start); + } +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/20031203-2.c b/gcc/testsuite/gcc.c-torture/compile/20031203-2.c new file mode 100644 index 000000000..47f561bae --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031203-2.c @@ -0,0 +1,6 @@ +/* Don't ICE on stupid user tricks. */ + +int foo(int bar) +{ + return (&bar)[-1]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20031203-3.c b/gcc/testsuite/gcc.c-torture/compile/20031203-3.c new file mode 100644 index 000000000..341a9df98 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031203-3.c @@ -0,0 +1,7 @@ +/* Don't ICE on user silliness. GCC 3.4 and before accepts this without + comment; 3.5 warns. Perhaps eventually we'll declare this an error. */ + +void bar (void) +{ + ({}); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20031208-1.c b/gcc/testsuite/gcc.c-torture/compile/20031208-1.c new file mode 100644 index 000000000..02586dfe1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031208-1.c @@ -0,0 +1,6 @@ +extern int foo(int, ...); +int bar(void) { + long double l = 1.2345E6; + foo(0, l); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20031220-1.c b/gcc/testsuite/gcc.c-torture/compile/20031220-1.c new file mode 100644 index 000000000..026a2687f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031220-1.c @@ -0,0 +1,21 @@ +/* PR optimization/13031 */ +/* The following code used to ICE on alphaev67-*-* at -O2 with an + unrecognizable instruction, caused by local register allocation + substituting a register for a constant in a conditional branch. */ + +void emit(int, int); +int f(void); +static int signals[5]; + +static inline void select(int sel, void *klass) +{ + emit(klass ? 0 : f(), signals[sel ? 0 : 1]); +} + +void all(void *gil, void *l, void *icon) +{ + while (l) + if (icon) + select(0, gil); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20031220-2.c b/gcc/testsuite/gcc.c-torture/compile/20031220-2.c new file mode 100644 index 000000000..45c827794 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031220-2.c @@ -0,0 +1,44 @@ +/* PR target/12749 + Orgin: Matt Thomas + This used to cause GCC to write out an instruction for i386 when using a L64 host + which gas could not handle because GCC would write a full 64bit hex string out. */ + + +float fabsf (float); +typedef int __int32_t; +typedef unsigned int __uint32_t; +typedef union +{ + float value; + __uint32_t word; +} ieee_float_shape_type; +extern float __ieee754_expf (float); +extern float __ieee754_sinhf (float); +static const float one = 1.0, shuge = 1.0e37; +float +__ieee754_sinhf(float x) +{ + float t,w,h; + __int32_t ix,jx; + do { ieee_float_shape_type gf_u; gf_u.value = (x); (jx) = gf_u.word; } while (0); + ix = jx&0x7fffffff; + if(ix>=0x7f800000) return x+x; + h = 0.5; + if (jx<0) h = -h; + if (ix < 0x41b00000) { + if (ix<0x31800000) + if(shuge+x>one) return x; + t = expm1f(fabsf(x)); + if(ix<0x3f800000) return h*((float)2.0*t-t*t/(t+one)); + return h*(t+t/(t+one)); + } + if (ix < 0x42b17180) return h*__ieee754_expf(fabsf(x)); + if (ix<=0x42b2d4fc) { + w = __ieee754_expf((float)0.5*fabsf(x)); + t = h*w; + return t*w; + } + return x*shuge; +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/20031227-1.c b/gcc/testsuite/gcc.c-torture/compile/20031227-1.c new file mode 100644 index 000000000..41597bd18 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031227-1.c @@ -0,0 +1,17 @@ +/* PR opt/13159 -- test unswitching a loop multiple times. */ + +void +foo (void) +{ + long j, k, p, g; + + while (p) + { + while (k < 0 && j < 0) + ; + if (g) + ; + else if (g) + ; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20031231-1.c b/gcc/testsuite/gcc.c-torture/compile/20031231-1.c new file mode 100644 index 000000000..bbd8e7cb5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031231-1.c @@ -0,0 +1,51 @@ +extern int f1 (int, void *); +extern int *f2 (void) __attribute__ ((__const__)); +extern int f3 (int, void *); + +int +test (int x, char *y, int z) +{ + int b = 0; + + if (x < 1024) + { + y[0] = '\0'; + + do + { + switch (f1 (x, y + b)) + { + case -1: + if (b == 0) + return -1; + else + return b; + + default: + b++; + } + } + while (y[b - 1] != '\0' && y[b - 1] != '\n' && b < z); + } + else + { + do + { + switch (f3 (x, y + b)) + { + case -1: + if ((*f2 ()) == 4) + continue; + if (b == 0) + return -1; + else + return b; + + default: + b++; + } + } + while (y[b - 1] != '\0' && y[b - 1] != '\n' && b < z); + } + return b; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040101-1.c b/gcc/testsuite/gcc.c-torture/compile/20040101-1.c new file mode 100644 index 000000000..baa0e4f93 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040101-1.c @@ -0,0 +1,30 @@ +/* { dg-skip-if "not enough registers" { pdp11-*-* } { "-O[12s]" } { "" } } */ + +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; + +#define CF (1<<0) +#define PF (1<<2) +#define AF (1<<4) +#define ZF (1<<6) +#define SF (1<<7) +#define OF (1<<11) + +#define EFLAGS_BITS (CF|PF|AF|ZF|SF|OF) + +void test16(uint16_t x, uint32_t eflags) +{ + uint16_t bsr_result; + uint32_t bsr_eflags; + uint16_t bsf_result; + uint32_t bsf_eflags; + + __asm volatile("" + : "=&r" (bsr_result), "=&r" (bsr_eflags) + : "r" (x), "i" (~EFLAGS_BITS), "r" (eflags)); + __asm volatile("" + : "=&r" (bsf_result), "=&r" (bsf_eflags) + : "r" (x), "i" (~EFLAGS_BITS), "r" (eflags)); + printf("%08x %04x bsrw %02x %08x bsfw %02x %08x\n", + x, eflags, bsr_result, bsr_eflags, bsf_result, bsf_eflags); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040109-1.c b/gcc/testsuite/gcc.c-torture/compile/20040109-1.c new file mode 100644 index 000000000..028bd17c0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040109-1.c @@ -0,0 +1,25 @@ +/* PR target/13380. + On m32r, the condition code register, (reg:SI 17), was replaced with + a pseudo reg, which would cause an unrecognized insn. */ + +void +foo (unsigned int a, unsigned int b) +{ + if (a > b) + { + while (a) + { + switch (b) + { + default: + a = 0; + case 2: + a = 0; + case 1: + a = 0; + case 0: + ; + } + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040121-1.c b/gcc/testsuite/gcc.c-torture/compile/20040121-1.c new file mode 100644 index 000000000..2039472fd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040121-1.c @@ -0,0 +1,41 @@ +/* PR target/12898 + 0x8000 needs multiple instructions to be emitted on Alpha; the + fluff around it causes it to be emitted in a no_new_pseudos + context, which triggered a problem in alpha.c. */ + +void f (const char *, ...); +int g (void); +void *p (void); + +int isymBase, ilineBase, sym_hdr, want_line, proc_desc; +char *lines; + +void print_file_desc (int *fdp) +{ + char *str_base = p (); + int symi, pdi = g (); + + for (symi = 0; isymBase;) + { + int proc_ptr = proc_desc + pdi; + f("1", isymBase, proc_ptr + *fdp, str_base); + if (want_line && *fdp) + { + int delta; + long cur_line = proc_ptr; + char *line_ptr = lines + proc_ptr; + char *line_end = p (); + + f("2", sym_hdr); + while (line_ptr < line_end) + { + delta = *line_ptr; + if (delta) + line_ptr++; + else + delta = line_ptr[1] ^ 0x8000; + f("3", cur_line, delta); + } + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040124-1.c b/gcc/testsuite/gcc.c-torture/compile/20040124-1.c new file mode 100644 index 000000000..01c900238 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040124-1.c @@ -0,0 +1,22 @@ +int +f1 (int a, int b) +{ + int i, j, k; + + switch (b) + { + case (-9): + j = 4; + break; + case (-10): + j = 10; + break; + case (-8): + j = 15; + break; + } + + i = f2 (f3 (b == (-9) ? k : a), j); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040130-1.c b/gcc/testsuite/gcc.c-torture/compile/20040130-1.c new file mode 100644 index 000000000..e661c176a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040130-1.c @@ -0,0 +1,28 @@ +/* PR target/11475 */ +/* Origin: */ + +/* This used to fail on SPARC because of a broken pattern. */ + +#pragma pack(2) + +struct +{ + unsigned char G936:7; + unsigned short G937:6; + unsigned int :4; + unsigned short :14; + unsigned int G938:8; +#if __INT_MAX__ >= 2147483647L + unsigned int :30; +#endif + unsigned short :16; +#if __INT_MAX__ >= 2147483647L + unsigned int :18; +#endif + unsigned short G939:9; +} G928b; + +void TestG928(void) +{ + G928b.G936 |= G928b.G939; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040202-1.c b/gcc/testsuite/gcc.c-torture/compile/20040202-1.c new file mode 100644 index 000000000..ba32c8049 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040202-1.c @@ -0,0 +1,8 @@ +/* PR target/13789 */ +/* Failed on SPARC due to a bug in store_expr. */ + +void *foo (void *c) +{ + void *a = __builtin_extract_return_addr (c); + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040209-1.c b/gcc/testsuite/gcc.c-torture/compile/20040209-1.c new file mode 100644 index 000000000..d256d58e3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040209-1.c @@ -0,0 +1,9 @@ +/* The following code used to ICE in fold_convert. */ + +float ceilf(float); + +int foo(float x) +{ + return (double)ceilf(x); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20040214-1.c b/gcc/testsuite/gcc.c-torture/compile/20040214-1.c new file mode 100644 index 000000000..90b09dcdb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040214-1.c @@ -0,0 +1,7 @@ +void foo(void) +{ + char c; + + for (c = -75; c <= 75; c++) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040214-2.c b/gcc/testsuite/gcc.c-torture/compile/20040214-2.c new file mode 100644 index 000000000..352d5a5d7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040214-2.c @@ -0,0 +1,57 @@ +/* http://gcc.gnu.org/ml/gcc-patches/2004-02/msg01307.html */ + +typedef struct xdef xdef; +struct xdef +{ + char xtyp; + xdef *next; + int y; +}; + +extern void b (); +extern void *foo (void *bar); +extern void *foo2 (void *bar1, void *bar2); +extern void *qwe; + +static void +c (xdef * xp) +{ + b (xp); +} +static void +a (xdef ** xpp) +{ + xdef *xp; + xp = *xpp; + + foo (xp); + xp = foo2 (xp, qwe); + b (xp->next); + foo (xp); + if (xp->y) + { + foo (xp); + if (xp) + { + xdef *p = foo2 (xp, qwe); + foo2 (xp, p); + xp = foo (p); + } + else + { + foo2 (foo(*xpp), *xpp); + } + } + *xpp = foo2 (xpp, qwe); +} + +void +b (xdef ** xpp) +{ + xdef *xp = *xpp; + if (!xp) + return; + if (xp->xtyp == 0) + a (xpp); + c (xp); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040216-1.c b/gcc/testsuite/gcc.c-torture/compile/20040216-1.c new file mode 100644 index 000000000..12d5e5ea7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040216-1.c @@ -0,0 +1,4 @@ +int foo (int a, int b, int c, int d) +{ + return ~a & ~b & ~c & ~d; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040219-1.c b/gcc/testsuite/gcc.c-torture/compile/20040219-1.c new file mode 100644 index 000000000..d3bc9272b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040219-1.c @@ -0,0 +1 @@ +double foo() { return __builtin_isgreater(0.,0.); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20040220-1.c b/gcc/testsuite/gcc.c-torture/compile/20040220-1.c new file mode 100644 index 000000000..8a4a5ba6d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040220-1.c @@ -0,0 +1,16 @@ +/* PR 14194 */ + +int irqs; + +static inline __attribute__((always_inline)) +int kstat_irqs (void) { + int i, sum = 0; + for (i = 0; i < 1; i++) + if (__builtin_expect(i, 0)) + sum += irqs; + return sum; +} + +int show_interrupts (void) { + return kstat_irqs (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040303-1.c b/gcc/testsuite/gcc.c-torture/compile/20040303-1.c new file mode 100644 index 000000000..6b2452ada --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040303-1.c @@ -0,0 +1,16 @@ +typedef struct input { + struct input *next; +} input_t; +static input_t *inputs = (input_t *)((void *)0); +void +RemoveInput(unsigned long id) +{ + input_t *ip; + input_t *prev; + while (1) + if (ip == (input_t *)id) + break; + if (ip == (input_t *)((void *)0)) + return; + prev->next = ip->next; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040303-2.c b/gcc/testsuite/gcc.c-torture/compile/20040303-2.c new file mode 100644 index 000000000..6751620a4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040303-2.c @@ -0,0 +1,23 @@ +void abort(void); +int x, y; +void init_xy(void); +void +test4(void) +{ + init_xy(); + _Bool iftemp0; + int x1 = x; + _Bool iftemp1; + x1++; + if (x1 != 3) + { + iftemp1 = 1; + goto endfirstif; + } + iftemp1 = 0; + endfirstif: + iftemp0 = iftemp1; + if (iftemp0) + abort(); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20040304-1.c b/gcc/testsuite/gcc.c-torture/compile/20040304-1.c new file mode 100644 index 000000000..ee277d799 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040304-1.c @@ -0,0 +1,20 @@ +void +cpplib_macroExpand (char * pfile) +{ + int nargs; + int rest_args; + int token = -1; + rest_args = 0; + do + { + if (rest_args != 0) + continue; + if (nargs == 0) + { + rest_args = 1; + token = macarg (pfile, rest_args); + } + } + while (token == 20); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20040309-1.c b/gcc/testsuite/gcc.c-torture/compile/20040309-1.c new file mode 100644 index 000000000..df8390f20 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040309-1.c @@ -0,0 +1,20 @@ +static const char default_tupleseps[] = ", \t"; + + +fubar (tupleseps) + const char *tupleseps; +{ + char *kp, *sp; + const char *septmp; + const char *tseplist; + tseplist = (tupleseps) ? tupleseps : default_tupleseps; + while (kp) + { + if (*tseplist) + septmp = tseplist; + bar (*septmp); + if (*tseplist) + if (*kp) + ; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040310-1.c b/gcc/testsuite/gcc.c-torture/compile/20040310-1.c new file mode 100644 index 000000000..f0c85f0ad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040310-1.c @@ -0,0 +1,10 @@ +void I_wacom () +{ + char buffer[50], *p; + int RequestData (char *cmd) + { + p = buffer; + foo (buffer); + } + RequestData (0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040317-1.c b/gcc/testsuite/gcc.c-torture/compile/20040317-1.c new file mode 100644 index 000000000..4a3455115 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040317-1.c @@ -0,0 +1,4 @@ +int String2Array(int len, char strarr[][len]) +{ + strarr[0]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040317-2.c b/gcc/testsuite/gcc.c-torture/compile/20040317-2.c new file mode 100644 index 000000000..3c8ee2b8e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040317-2.c @@ -0,0 +1,25 @@ +typedef struct _ScaleRec *ScaleWidget; +typedef struct +{ + short *x; + unsigned short *width; +} Table; +typedef struct +{ + Table table; +} ScalePart; +typedef struct _ScaleRec +{ + ScalePart scale; +} ScaleRec; +static int +FindPixel (ScaleWidget sw, short x, short y, + short * img_x, short * img_y, unsigned long * img_pixel) +{ + if (sw->scale.table.x[(int) *img_x] + + (short) sw->scale.table.width[(int) *img_x] < x) + { + ++*img_x; + return FindPixel (sw, x, y, img_x, img_y, img_pixel); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040317-3.c b/gcc/testsuite/gcc.c-torture/compile/20040317-3.c new file mode 100644 index 000000000..e6982c3e3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040317-3.c @@ -0,0 +1,11 @@ +I_wacom () +{ + char buffer[50], *p; + int RequestData (char *cmd) + { + p = buffer; + foo (buffer); + } + RequestData (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20040323-1.c b/gcc/testsuite/gcc.c-torture/compile/20040323-1.c new file mode 100644 index 000000000..77ddadc9d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040323-1.c @@ -0,0 +1,12 @@ +/* PR middle-end/14694 */ +/* { dg-require-alias "" } */ + +unsigned int _rtld_global = 1; +extern unsigned int _rtld_local __attribute__ ((alias ("_rtld_global"))); + +unsigned int +_dl_start (void *arg) +{ + unsigned int elf_machine_rel () { return _rtld_local; } + return elf_machine_rel (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040401-1.c b/gcc/testsuite/gcc.c-torture/compile/20040401-1.c new file mode 100644 index 000000000..ee727a9b2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040401-1.c @@ -0,0 +1,6 @@ +int __atomic_readv_replacement(unsigned char iov_len, int count, int i) { + unsigned char bytes = 0; + if ((unsigned char)((char)127 - bytes) < iov_len) + return 22; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040415-1.c b/gcc/testsuite/gcc.c-torture/compile/20040415-1.c new file mode 100644 index 000000000..1b1537a7b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040415-1.c @@ -0,0 +1,5 @@ +int isdigit (int); +int f (const char *type) +{ + return isdigit ((unsigned char) *type++); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040415-2.c b/gcc/testsuite/gcc.c-torture/compile/20040415-2.c new file mode 100644 index 000000000..e78e81e8c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040415-2.c @@ -0,0 +1,7 @@ +int isascii (int); + +int f1 (const char *type) +{ + return isascii ((unsigned char) *type++); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20040419-1.c b/gcc/testsuite/gcc.c-torture/compile/20040419-1.c new file mode 100644 index 000000000..76910455f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040419-1.c @@ -0,0 +1,3 @@ +/* This used to ICE because PHI-OPT would produce non-gimple code. */ + +int f(double d0, double d1) { return d0 > 0 == d1 > 0; } diff --git a/gcc/testsuite/gcc.c-torture/compile/20040602-1.c b/gcc/testsuite/gcc.c-torture/compile/20040602-1.c new file mode 100644 index 000000000..8f751e362 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040602-1.c @@ -0,0 +1,5 @@ +/* Test type qualifiers. These should as equal types. */ +extern volatile unsigned long foo; +typedef unsigned long ulong; +extern volatile ulong foo; +volatile ulong foo; diff --git a/gcc/testsuite/gcc.c-torture/compile/20040610-1.c b/gcc/testsuite/gcc.c-torture/compile/20040610-1.c new file mode 100644 index 000000000..37fb65ca2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040610-1.c @@ -0,0 +1,5 @@ +int foo (float x) +{ + float i = __builtin_inff (); + return x != i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040611-1.c b/gcc/testsuite/gcc.c-torture/compile/20040611-1.c new file mode 100644 index 000000000..8a5528b90 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040611-1.c @@ -0,0 +1,8 @@ +/* This would cause PRE load motion to generate invalid code and ICE */ +void foo (char *name) +{ + if (*name) + name ++; + while (name[0]); + asm ("" : "=r" (name)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040614-1.c b/gcc/testsuite/gcc.c-torture/compile/20040614-1.c new file mode 100644 index 000000000..d99d27896 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040614-1.c @@ -0,0 +1,20 @@ +#ifndef NO_LABEL_VALUES +void f(int r1, int *fp) +{ + void *hlbl_tbl[] = { &&label1 }; + goto *hlbl_tbl[r1]; + *fp = 0; + label0: + fp += 8; + label1: + *fp = 0; + if (r1) + goto label2; + if (r1) + goto label0; + label2: + ; +} +#else +int x; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/20040621-1.c b/gcc/testsuite/gcc.c-torture/compile/20040621-1.c new file mode 100644 index 000000000..8a2ebb07e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040621-1.c @@ -0,0 +1,17 @@ +/* This test woudl cause partial redundancies too complex for PRE + to insert using a single temporary due to them not being GIMPLE + expressions. */ +int ssbgst (int c, int k) +{ + int a, i, j; + + a = 0; + i = 1; + j = k; + while (j) + { + a += (j + i) * (k + i + c) + (j + i + c); + j = j - 1; + } + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040624-1.c b/gcc/testsuite/gcc.c-torture/compile/20040624-1.c new file mode 100644 index 000000000..8eb92a4a7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040624-1.c @@ -0,0 +1,3 @@ +struct s { float f[1]; }; +struct s foo(); +float bar() { return foo().f[0]; } diff --git a/gcc/testsuite/gcc.c-torture/compile/20040705-1.c b/gcc/testsuite/gcc.c-torture/compile/20040705-1.c new file mode 100644 index 000000000..1e45ee289 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040705-1.c @@ -0,0 +1,2 @@ +extern char foo[], bar[]; +void f (void) { memcpy (foo, bar, 7); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20040708-1.c b/gcc/testsuite/gcc.c-torture/compile/20040708-1.c new file mode 100644 index 000000000..4a553917e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040708-1.c @@ -0,0 +1,68 @@ +/* PR rtl-optimization/16199 */ +/* Origin: Olaf Klein */ + +typedef enum { + APR_LOCK_FCNTL, + APR_LOCK_FLOCK, + APR_LOCK_SYSVSEM, + APR_LOCK_PROC_PTHREAD, + APR_LOCK_POSIXSEM, + APR_LOCK_DEFAULT +} apr_lockmech_e; + +struct apr_proc_mutex_unix_lock_methods_t { + unsigned int flags; + const char *name; +}; + +typedef struct apr_proc_mutex_unix_lock_methods_t apr_proc_mutex_unix_lock_methods_t; + +extern const apr_proc_mutex_unix_lock_methods_t apr_proc_mutex_unix_sysv_methods; + +struct apr_proc_mutex_t { + const apr_proc_mutex_unix_lock_methods_t *inter_meth; + int curr_locked; + char *fname; +}; + +typedef struct apr_proc_mutex_t apr_proc_mutex_t; + +extern const apr_proc_mutex_unix_lock_methods_t apr_proc_mutex_unix_proc_pthread_methods; + +extern const apr_proc_mutex_unix_lock_methods_t apr_proc_mutex_unix_fcntl_methods; + +static int proc_mutex_choose_method(apr_proc_mutex_t *new_mutex, apr_lockmech_e mech) +{ + switch (mech) { + case APR_LOCK_FCNTL: + new_mutex->inter_meth = &apr_proc_mutex_unix_fcntl_methods; + break; + case APR_LOCK_FLOCK: + return ((20000 + 50000) + 23); + break; + case APR_LOCK_SYSVSEM: + new_mutex->inter_meth = &apr_proc_mutex_unix_sysv_methods; + break; + case APR_LOCK_POSIXSEM: + return ((20000 + 50000) + 23); + break; + case APR_LOCK_PROC_PTHREAD: + new_mutex->inter_meth = &apr_proc_mutex_unix_proc_pthread_methods; + break; + case APR_LOCK_DEFAULT: + new_mutex->inter_meth = &apr_proc_mutex_unix_proc_pthread_methods; + break; + default: + return ((20000 + 50000) + 23); + } + return 0; +} + +const char* apr_proc_mutex_defname(void) +{ + apr_proc_mutex_t mutex; + + if (proc_mutex_choose_method(&mutex, APR_LOCK_DEFAULT) != 0) { + return "unknown"; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040709-1.c b/gcc/testsuite/gcc.c-torture/compile/20040709-1.c new file mode 100644 index 000000000..c8c9cc357 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040709-1.c @@ -0,0 +1,10 @@ +/* PR target/16364 */ +union foo { + long double ld; +} bar; + +double +sub (union foo baz) +{ + return baz.ld / 2; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040726-1.c b/gcc/testsuite/gcc.c-torture/compile/20040726-1.c new file mode 100644 index 000000000..e53ccd655 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040726-1.c @@ -0,0 +1,14 @@ +/* PR rtl-optimization/16643 */ +void foo (int a, int b, int c, int d, int e, int *f) +{ + if (a == 0) + if (b == 0) + if (c == 0) + if (d == 0) + { + *f = e; + return; + } + *f = e; + return; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040726-2.c b/gcc/testsuite/gcc.c-torture/compile/20040726-2.c new file mode 100644 index 000000000..ce60095fd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040726-2.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* From a failure after the global ccp pass. */ +typedef struct +{ + char n[129]; +} A; + +const A C = { + 0, + 0 +}; + +extern const A *const B; + +void bar(const char *); + +void foo () +{ + bar (B->n); +} + +const A *const B = &C; diff --git a/gcc/testsuite/gcc.c-torture/compile/20040727-1.c b/gcc/testsuite/gcc.c-torture/compile/20040727-1.c new file mode 100644 index 000000000..a46abec1e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040727-1.c @@ -0,0 +1,32 @@ +/* Extracted from boehm-gc/os_dep.c on Darwin. It caused an ICE when + trying to merge alias information from two pointers that had + different type memory tags. */ +typedef int thread_state_flavor_t; +typedef int exception_behavior_t; +typedef unsigned int exception_mask_t; +typedef unsigned int exception_handler_t; +typedef unsigned int mach_msg_type_number_t; +static struct { + mach_msg_type_number_t count; + exception_mask_t masks[16]; + exception_handler_t ports[16]; + thread_state_flavor_t flavors[16]; +} GC_old_exc_ports; + +typedef exception_handler_t *exception_handler_array_t; +typedef thread_state_flavor_t *exception_flavor_array_t; + + +int task_get_exception_ports +( + mach_msg_type_number_t *masksCnt, + exception_handler_array_t old_handlers, + exception_flavor_array_t old_flavors +); + +void GC_dirty_init() +{ + task_get_exception_ports(GC_old_exc_ports.masks, + GC_old_exc_ports.ports, + GC_old_exc_ports.flavors); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040730-1.c b/gcc/testsuite/gcc.c-torture/compile/20040730-1.c new file mode 100644 index 000000000..6f224e9a3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040730-1.c @@ -0,0 +1,17 @@ +/* PR tree-opt/16827 + This used to ICE in tree-ssa-loop-im.c */ + +extern unsigned short dev_roles[]; +void super_1_sync(int *rdev2) +{ + int i; + int max_dev = 0; + + for (i =0;i<20;i++) + if (rdev2[i] > max_dev) + max_dev = rdev2[i]; + + for (i=0; ic) + bar1(a); + else + { + if (p) bar2(a,a.c); + bar3(a.c); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040824-1.c b/gcc/testsuite/gcc.c-torture/compile/20040824-1.c new file mode 100644 index 000000000..7d81932f3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040824-1.c @@ -0,0 +1,2 @@ +/* This caused an out-of-range address on the MIPS port. */ +void foo (char *x) { __builtin_prefetch (x + 0x8000); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20040901-1.c b/gcc/testsuite/gcc.c-torture/compile/20040901-1.c new file mode 100644 index 000000000..68aaa74ae --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040901-1.c @@ -0,0 +1,2 @@ +typedef enum {a, b} __attribute__((__mode__(__QI__))) x; +x foo; diff --git a/gcc/testsuite/gcc.c-torture/compile/20040907-1.c b/gcc/testsuite/gcc.c-torture/compile/20040907-1.c new file mode 100644 index 000000000..d1dd6f22d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040907-1.c @@ -0,0 +1,13 @@ +void ProdWord_bla ( gtL, gtRes, lnL ) + int *gtL, *gtRes; + int lnL; +{ + while ( 1 < lnL ) + { + *gtRes++ = *gtL++; + --lnL; + } + if ( 0 < lnL ) + if ( gtL[0] == gtL[1] ) + *gtRes++ = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040908-1.c b/gcc/testsuite/gcc.c-torture/compile/20040908-1.c new file mode 100644 index 000000000..f52bf5ee0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040908-1.c @@ -0,0 +1,12 @@ +/* PR 17186 */ + +double foo() +{ + int i; + double d; + + if (i) + bar(); + else + if (d) return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040909-1.c b/gcc/testsuite/gcc.c-torture/compile/20040909-1.c new file mode 100644 index 000000000..8bbf90191 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040909-1.c @@ -0,0 +1,13 @@ +static __inline__ int +one_utf8_to_utf16 () { } + +static __inline__ unsigned char +conversion_loop (int (*const one_conversion)()) +{ +return one_conversion (); +} +static unsigned char +convert_utf8_utf16 () +{ + return conversion_loop (one_utf8_to_utf16); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040914-1.c b/gcc/testsuite/gcc.c-torture/compile/20040914-1.c new file mode 100644 index 000000000..824664c88 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040914-1.c @@ -0,0 +1,39 @@ +extern int clobber_k (int *); +extern int barrier (void); +int t, u; + +int +process_second_stream(void) +{ + int k; + int i = 0, j = 0, result; + + clobber_k (&k); + + while(t) + ; + + while(!j) + { + while(!j) + { + barrier (); + if (t == 0) + break; + else if(t == 1) + t = 2; + else + { + if(t < 0) + j=1; + if(u < 0) + k = i++; + } + } + + if(!j && u) + j=1; + } + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040916-1.c b/gcc/testsuite/gcc.c-torture/compile/20040916-1.c new file mode 100644 index 000000000..1a6a9f47f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040916-1.c @@ -0,0 +1,12 @@ +/* PR tree-optimization/17512 + + We used to try to fold "(char) (X ^ Y)", where '^' is + TRUTH_XOR_EXPR into ((char) X ^ (char) Y), creating TRUTH_XOR_EXPR + with its operands being of type char, which is invalid. */ + +char +foo (int p) +{ + int q = p; + return (p != 0) == (p == q); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20041005-1.c b/gcc/testsuite/gcc.c-torture/compile/20041005-1.c new file mode 100644 index 000000000..b0a65117e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20041005-1.c @@ -0,0 +1,6 @@ +/* This wrongly caused duplicate definitions of x in the assembler + output. */ +/* Origin: Joseph Myers */ + +static int x = 1; +void f (void) { extern int x; } diff --git a/gcc/testsuite/gcc.c-torture/compile/20041007-1.c b/gcc/testsuite/gcc.c-torture/compile/20041007-1.c new file mode 100644 index 000000000..ce524703d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20041007-1.c @@ -0,0 +1,16 @@ +/* PR rtl-optimization/17027 */ +/* Origin: dbk */ +/* Testcase by Christian Ehrhardt */ + +int bar(void); +void baz (void) __attribute__ ((noreturn)); /* noreturn is required */ + +void foo (void) +{ + while (bar ()) { + switch (1) { + default: + baz (); + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20041018-1.c b/gcc/testsuite/gcc.c-torture/compile/20041018-1.c new file mode 100644 index 000000000..3cc0c8f8c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20041018-1.c @@ -0,0 +1,18 @@ +void +foo (int y, int z, unsigned char **t, int **c, int *b) +{ + int i, j, k; + unsigned char a[2]; + + a[0] = 0; + a[1] = 0; + for (j = 0; j < z; j++) + for (i = 0; i < y; i++, a[0] += 3) + for (k = 0; k < 3; k++) + c[0][k] += 3 * b[k]; + for (i = 0; i < 3; i++) + if (t[0][i] + c[0][i] / a[0] <= 0) + t[0][i] = 0; + else + t[0][i] = t[0][i] + c[0][i] / a[0]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20041026-1.c b/gcc/testsuite/gcc.c-torture/compile/20041026-1.c new file mode 100644 index 000000000..3d6ae8fcd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20041026-1.c @@ -0,0 +1,5 @@ +int +foo (double x, long double y) +{ + return __builtin_isgreater (x, y); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20041119-1.c b/gcc/testsuite/gcc.c-torture/compile/20041119-1.c new file mode 100644 index 000000000..3e0e565f4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20041119-1.c @@ -0,0 +1,30 @@ +/* PR rtl-optimization/17825 */ +#ifdef __i386__ +register unsigned int reg __asm ("esi"); +#elif defined __x86_64__ +register unsigned int reg __asm ("r14"); +#else +unsigned int reg; +#endif + +struct S +{ + unsigned int h[8]; +} *b; +unsigned int c; +void foo (int); + +void +bar (void) +{ + unsigned int j, k, l, m; + + j = (reg & 0xffff) | ((b->h[2] & 0xffff) << 16); + k = c & 0xffff; + if (k == 0) + foo (0); + l = (j / k) & 0xffff; + m = (j % k) & 0xffff; + reg = (reg & 0xffff0000) | l; + b->h[2] = (b->h[2] & 0xffff0000) | m; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20041211-1.c b/gcc/testsuite/gcc.c-torture/compile/20041211-1.c new file mode 100644 index 000000000..5b9c1d069 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20041211-1.c @@ -0,0 +1,13 @@ +/* PR tree-optimization/16951 */ + +void dummy_use(const char *p); + +__inline void f(const char *const p) { + const char q; + dummy_use(p); + f(&q); +} + +void crash() { + f(0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050105-1.c b/gcc/testsuite/gcc.c-torture/compile/20050105-1.c new file mode 100644 index 000000000..16d18f306 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050105-1.c @@ -0,0 +1,5 @@ +void bar (struct S *); +void foo (void *x) +{ + bar ((struct S *) x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050113-1.c b/gcc/testsuite/gcc.c-torture/compile/20050113-1.c new file mode 100644 index 000000000..6e36ed6fd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050113-1.c @@ -0,0 +1,16 @@ +/* PR c/17297 */ + +typedef float V2SF __attribute__ ((vector_size (8))); + +int test0 (V2SF, V2SF); + +int +main (void) +{ + V2SF a = (V2SF) {1.0f/0.0f - 1.0f/0.0f, 1.0f/0.0f - 1.0f/0.0f}; + V2SF b = (V2SF) {567.345, 1984.0}; + int i; + + i = test0 (a, b); + return i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050119-1.c b/gcc/testsuite/gcc.c-torture/compile/20050119-1.c new file mode 100644 index 000000000..4f14ea434 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050119-1.c @@ -0,0 +1,25 @@ +void write_char(char); +int len(char*); +void f(char *a) +{ + int col = 0; + int i; + void wchar(char c) + { + if (c == '\t') + { + do { + wchar(' '); + } while ((col%8)!=0); + } + else + { + write_char (c); + col++; + } + } + for(i =0;i 0) + { + #define TEN(x) x x x x x x x x x x + TEN (TEN (a += b; b -= a;)) + TEN (TEN (a += b; b -= a;)) + } + return a + b; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050510-1.c b/gcc/testsuite/gcc.c-torture/compile/20050510-1.c new file mode 100644 index 000000000..3570f4f35 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050510-1.c @@ -0,0 +1,12 @@ +void bar (int k) +{ + void *label = (k) ? &&x : &&y; + if (k) + goto *label; + +x: + if (k) + dont_remove (); +y: + return; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050516-1.c b/gcc/testsuite/gcc.c-torture/compile/20050516-1.c new file mode 100644 index 000000000..2cdf69608 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050516-1.c @@ -0,0 +1,12 @@ +/* PR tree-optimization/21610 */ + +struct S { char s; }; +struct T { struct S t; }; + +struct S *const p = &((struct T * const) (0x4000))->t; + +void +foo (void) +{ + p->s = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050520-1.c b/gcc/testsuite/gcc.c-torture/compile/20050520-1.c new file mode 100644 index 000000000..9e2f6c8c7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050520-1.c @@ -0,0 +1,13 @@ +struct s { int x[4]; }; +struct s gs; + +void +bar (void) +{ + struct s *s; + int i; + + s = &gs; + for (i = 0; i < 4; i++) + ((char*) (&s->x[i]))[0] = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050622-1.c b/gcc/testsuite/gcc.c-torture/compile/20050622-1.c new file mode 100644 index 000000000..db183909f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050622-1.c @@ -0,0 +1,16 @@ +#if __SCHAR_MAX__ == 127 && __INT_MAX__ >= 2147483647 +struct S { char buf[72*1024*1024]; }; +#else +struct S { char buf[64]; }; +#endif + +extern void bar (struct S); + +struct S s; + +int +foo (void) +{ + bar (s); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050721-1.c b/gcc/testsuite/gcc.c-torture/compile/20050721-1.c new file mode 100644 index 000000000..25a781ddd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050721-1.c @@ -0,0 +1,57 @@ +/* Test for PR target/20191. */ + +struct S1; + +struct S1 { + struct S1 *next; + float x; +}; + +struct S2 { + float y; +}; + +extern int func_ex1 (float); + +extern int f; +extern float n; +extern struct S1 *bp1; +extern struct S2 *bp2; + +inline float +func1 (int f, struct S2 *p2) +{ + float a; + + if (f) + a = n >= p2->y ? n : p2->y; + else + a = n; + return a; +} + +inline float +func2 (struct S1 *p1, struct S2 *p2) +{ + float a, b; + + if(n <= 1.0) + b = func1 (f, p2); + else + { + a = n <= p1->x ? 0.0 : p1->x; + b = a >= p2->y ? a : p2->y; + } + return(b); +} + +void +func3 (struct S1 *p) +{ + float a = 0.0; + + if (f) + a = func2 (bp1, bp2); + if (func_ex1 (a)) + bp1 = p; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050801-1.c b/gcc/testsuite/gcc.c-torture/compile/20050801-1.c new file mode 100644 index 000000000..7e32166a7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050801-1.c @@ -0,0 +1,8 @@ +__inline void libc_name_p (void) +{ + enum { A = 1 }; +} +void nothrow_libfn_p (void) +{ + libc_name_p (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20050801-2.c b/gcc/testsuite/gcc.c-torture/compile/20050801-2.c new file mode 100644 index 000000000..45bd2a037 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050801-2.c @@ -0,0 +1,12 @@ +__inline int f(int i) +{ + struct { + int t[i]; + } t; + return sizeof(t.t[i--]); +} + +int g(int i) +{ + return f(i); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20051207-1.c b/gcc/testsuite/gcc.c-torture/compile/20051207-1.c new file mode 100644 index 000000000..9baa63b94 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20051207-1.c @@ -0,0 +1,7 @@ +/* PR target/25268 */ + +long long +foo (long long x, int y) +{ + return x << ((y + 1) & 63); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20051216-1.c b/gcc/testsuite/gcc.c-torture/compile/20051216-1.c new file mode 100644 index 000000000..ed6ac7230 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20051216-1.c @@ -0,0 +1,131 @@ +/* PR rtl-optimization/25432 */ + +void *malloc (__SIZE_TYPE__); +void *realloc (void *, __SIZE_TYPE__); + +struct A { double x, y; }; +struct B { double x0, y0, x1, y1; }; +struct C { int n_points; int dir; struct B bbox; struct A *points; }; +struct D { int n_segs; struct C segs[1]; }; + +void foo (int, int, int *, int, int *, struct A **, int *, int *, + struct D *, int *, struct D **, int *, int **); +int baz (struct A, struct A, struct A, struct A); + +static void +bar (struct D *svp, int *n_points_max, + struct A p, int *seg_map, int *active_segs, int i) +{ + int asi, n_points; + struct C *seg; + + asi = seg_map[active_segs[i]]; + seg = &svp->segs[asi]; + n_points = seg->n_points; + seg->points = ((struct A *) + realloc (seg->points, (n_points_max[asi] <<= 1) * sizeof (struct A))); + seg->points[n_points] = p; + seg->bbox.y1 = p.y; + seg->n_points++; +} + +struct D * +test (struct D *vp) +{ + int *active_segs, n_active_segs, *cursor, seg_idx; + double y, share_x; + int tmp1, tmp2, asi, i, j, *n_ips, *n_ips_max, n_segs_max; + struct A **ips, p_curs, *pts; + struct D *new_vp; + int *n_points_max, *seg_map, first_share; + + n_segs_max = 16; + new_vp = (struct D *) malloc (sizeof (struct D) + + (n_segs_max - 1) * sizeof (struct C)); + new_vp->n_segs = 0; + + if (vp->n_segs == 0) + return new_vp; + + active_segs = ((int *) malloc ((vp->n_segs) * sizeof (int))); + cursor = ((int *) malloc ((vp->n_segs) * sizeof (int))); + + seg_map = ((int *) malloc ((vp->n_segs) * sizeof (int))); + n_ips = ((int *) malloc ((vp->n_segs) * sizeof (int))); + n_ips_max = ((int *) malloc ((vp->n_segs) * sizeof (int))); + ips = ((struct A * *) malloc ((vp->n_segs) * sizeof (struct A *))); + + n_points_max = ((int *) malloc ((n_segs_max) * sizeof (int))); + + n_active_segs = 0; + seg_idx = 0; + y = vp->segs[0].points[0].y; + while (seg_idx < vp->n_segs || n_active_segs > 0) + { + for (i = 0; i < n_active_segs; i++) + { + asi = active_segs[i]; + if (vp->segs[asi].n_points - 1 == cursor[asi] && + vp->segs[asi].points[cursor[asi]].y == y) + i--; + } + + while (seg_idx < vp->n_segs && y == vp->segs[seg_idx].points[0].y) + { + cursor[seg_idx] = 0; + n_ips[seg_idx] = 1; + n_ips_max[seg_idx] = 2; + ips[seg_idx] = + ((struct A *) malloc ((n_ips_max[seg_idx]) * sizeof (struct A))); + ips[seg_idx][0] = vp->segs[seg_idx].points[0]; + pts = ((struct A *) malloc ((16) * sizeof (struct A))); + pts[0] = vp->segs[seg_idx].points[0]; + tmp1 = seg_idx; + for (j = i; j < n_active_segs; j++) + { + tmp2 = active_segs[j]; + active_segs[j] = tmp1; + tmp1 = tmp2; + } + active_segs[n_active_segs] = tmp1; + n_active_segs++; + seg_idx++; + } + first_share = -1; + share_x = 0; + + for (i = 0; i < n_active_segs; i++) + { + asi = active_segs[i]; + p_curs = ips[asi][1]; + if (p_curs.y == y) + { + bar (new_vp, n_points_max, + p_curs, seg_map, active_segs, i); + + n_ips[asi]--; + for (j = 0; j < n_ips[asi]; j++) + ips[asi][j] = ips[asi][j + 1]; + + if (first_share < 0 || p_curs.x != share_x) + { + foo (first_share, i, + active_segs, n_active_segs, + cursor, ips, n_ips, n_ips_max, vp, seg_map, + &new_vp, &n_segs_max, &n_points_max); + first_share = i; + share_x = p_curs.x; + } + } + else + { + foo (first_share, i, + active_segs, n_active_segs, + cursor, ips, n_ips, n_ips_max, vp, seg_map, + &new_vp, &n_segs_max, &n_points_max); + first_share = -1; + } + } + } + return new_vp; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20051228-1.c b/gcc/testsuite/gcc.c-torture/compile/20051228-1.c new file mode 100644 index 000000000..e997ae394 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20051228-1.c @@ -0,0 +1,10 @@ +/* PR target/25554 */ +/* Bitwise shift with negative shift count has undefined behavior, + but we shouldn't ICE on it. */ + +void +foo (long x) +{ + if (((x >> -2) & 1) != 0) + bar (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20060109-1.c b/gcc/testsuite/gcc.c-torture/compile/20060109-1.c new file mode 100644 index 000000000..9ef9c2fdd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060109-1.c @@ -0,0 +1,36 @@ +/* This test exposed a bug in combine where it was improperly changing + the mode of a register. The bug appeared to be latent until web + was moved after combine. This is the reduced test that fails + by crashing in reload. */ + + +typedef struct cpp_reader cpp_reader; +typedef struct cpp_string cpp_string; +struct cpp_string +{ + unsigned int len; + const unsigned char *text; +}; +struct cpp_callbacks +{ + void (*ident) (cpp_reader *, unsigned int, const cpp_string *); +}; +static void cb_ident (cpp_reader *, unsigned int, const cpp_string *); +init_c_lex (void) +{ + struct cpp_callbacks *cb; + cb->ident = cb_ident; +} +cb_ident (cpp_reader * pfile __attribute__ ((__unused__)), unsigned int +line + __attribute__ ((__unused__)), const cpp_string * str + __attribute__ ((__unused__))) +{ + { + cpp_string cstr = { + }; + if (cpp_interpret_string (pfile, str, 1, &cstr, 0)) + { + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20060202-1.c b/gcc/testsuite/gcc.c-torture/compile/20060202-1.c new file mode 100644 index 000000000..d16e7b7c5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060202-1.c @@ -0,0 +1,54 @@ +typedef __SIZE_TYPE__ size_t; +typedef const struct objc_selector +{ + void *sel_id; +} + *SEL; +typedef struct objc_object +{ +} + *id; +typedef struct objc_class *Class; +struct objc_class +{ + struct sarray *dtable; +}; +typedef size_t sidx; +struct soffset +{ + unsigned int boffset:(sizeof (size_t) * 8) / 2; + unsigned int eoffset:(sizeof (size_t) * 8) / 2; +}; +union sofftype +{ + struct soffset off; + sidx idx; +}; +struct sarray +{ + size_t capacity; +}; +static __inline__ unsigned int +soffset_decode (sidx indx) +{ + union sofftype x; + x.idx = indx; + return x.off.eoffset + (x.off.boffset * (1 << 5)); +} +static __inline__ void * +sarray_get_safe (struct sarray *array, sidx indx) +{ + if (soffset_decode (indx) < array->capacity) + return (void *)sarray_get (array, indx); +} +void * +get_imp (Class class, SEL sel) +{ + void *res = sarray_get_safe (class->dtable, (size_t) sel->sel_id); + if (res == 0) + { + { + res = get_imp (class, sel); + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20060208-1.c b/gcc/testsuite/gcc.c-torture/compile/20060208-1.c new file mode 100644 index 000000000..01e471a7b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060208-1.c @@ -0,0 +1,10 @@ +/* PR middle-end/26092 */ +typedef __SIZE_TYPE__ size_t; +extern void *malloc (size_t); + +void *(*const foo) (size_t) = malloc; + +void *test (void) +{ + return (*foo) (3); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20060215-1.c b/gcc/testsuite/gcc.c-torture/compile/20060215-1.c new file mode 100644 index 000000000..7979561a3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060215-1.c @@ -0,0 +1,42 @@ +/* PR middle-end/26300 */ + +struct S +{ + char c; + struct S *d; + struct S *e; +}; +extern struct S *u, *v; +extern void fn1 (struct S *) __attribute__ ((noreturn)); +void fn2 (struct S *); + +static inline struct S * +fn3 (struct S *x) +{ + if (x->c != 6) + fn1 (0); + return (struct S *) x; +} + +static inline int +fn4 (struct S *x) +{ + if (x != u) + return 3; + fn2 (x); + return 0; +} + +int +test (struct S *x) +{ + struct S *r; + int m = 0; + + for (r = x; r != v; r = (fn3 (r)->d)) + if (r->c != 6) + fn1 (x); + else + m |= 1 << (fn4 (fn3 (r)->e) - 1); + return m; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20060217-1.c b/gcc/testsuite/gcc.c-torture/compile/20060217-1.c new file mode 100644 index 000000000..c447142bc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060217-1.c @@ -0,0 +1,25 @@ +/* PR middle-end/26334 */ + +struct U +{ + unsigned int u[256]; +}; + +struct S +{ + int u, v, w, x; + int s[255]; +}; + +int +foo (struct U *x, struct S *y) +{ + register int i; + for (i = 0; i < 255; i++) + { + unsigned int v; + __asm__ ("" : "=r" (v) : "0" (x->u[i + 1]) : "cc"); + y->s[i] = v; + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20060309-1.c b/gcc/testsuite/gcc.c-torture/compile/20060309-1.c new file mode 100644 index 000000000..4aff45b62 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060309-1.c @@ -0,0 +1,3 @@ +/* Test to make sure that indirect jumps compile. */ +extern void bar(void); +void foo() { bar(); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20060419-1.c b/gcc/testsuite/gcc.c-torture/compile/20060419-1.c new file mode 100644 index 000000000..dc346ae02 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060419-1.c @@ -0,0 +1,21 @@ +/* This failed because if conversion didn't handle insv patterns properly. */ + +union y +{ + int a; + unsigned short b; +}; + +extern void bar (unsigned short u, union y v); + +void +foo (int check) +{ + union y x; + + if (check != 0) + x.b = 1; + else + x.b = 2; + bar (x.b, x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20060421-1.c b/gcc/testsuite/gcc.c-torture/compile/20060421-1.c new file mode 100644 index 000000000..1bd4079b4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060421-1.c @@ -0,0 +1,9 @@ +/* This test used to ICE on ARM with -mcpu=iwmmxt. */ +void +foo (void) +{ + long long int a; + unsigned long b[249]; /* >= 249 causes failure */ + register unsigned int c; + b[c] = (a & (1ULL << c)) ? 1 : 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20060609-1.c b/gcc/testsuite/gcc.c-torture/compile/20060609-1.c new file mode 100644 index 000000000..a8152c8a5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060609-1.c @@ -0,0 +1,7 @@ +/* This test used to ICE on IA64. */ +int __strspn_c2 (__const char *__s, int __accept1, int __accept2) +{ + register long unsigned int __result = 0; + while (__s[__result] == __accept1 || __s[__result] == __accept2) + return __result; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20060625-1.c b/gcc/testsuite/gcc.c-torture/compile/20060625-1.c new file mode 100644 index 000000000..37efb9da6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060625-1.c @@ -0,0 +1,10 @@ +/* PR middle-end/28151 */ +/* Testcase by Steven Bosscher */ + +_Complex float b; + +void foo (void) +{ + _Complex float a = __FLT_MAX__; + b = __FLT_MAX__ + a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20060823-1.c b/gcc/testsuite/gcc.c-torture/compile/20060823-1.c new file mode 100644 index 000000000..fbce7fe94 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060823-1.c @@ -0,0 +1,18 @@ +/* PR middle-end/28683 */ + +extern void foo (int *); + +struct A +{ + int f; +}; + +struct A * +test (struct A *r) +{ + int *f = &r->f; + static int i = 0; + if (!i && !((void *) f == (void *) r)) + foo (&i); + return r; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20060826-1.c b/gcc/testsuite/gcc.c-torture/compile/20060826-1.c new file mode 100644 index 000000000..06fb4ebad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060826-1.c @@ -0,0 +1,7 @@ +typedef _Complex double S; +S bar (void); +void quux (S, S); +void foo (void) +{ + quux (bar(), bar()); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20060904-1.c b/gcc/testsuite/gcc.c-torture/compile/20060904-1.c new file mode 100644 index 000000000..f9f768664 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20060904-1.c @@ -0,0 +1,27 @@ +/* PR rtl-optimization/27616 */ +/* Reported by Lee Ji Hwan */ +/* Testcase by Andrew Pinski */ + +struct chunk_s +{ + unsigned int size; + int offset_next; +}; + +typedef struct chunk_s chunk_t; + +void foo(chunk_t *first) +{ + chunk_t *cur; + char *first0; + + do { + first0 = (char *) first; + cur = (chunk_t *) (first0 + first->offset_next); + if ((chunk_t *) (first0 + cur->offset_next) != first) + return ; + + first->offset_next = 0; + + } while (cur->size != 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20061005-1.c b/gcc/testsuite/gcc.c-torture/compile/20061005-1.c new file mode 100644 index 000000000..a433509ae --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20061005-1.c @@ -0,0 +1,23 @@ +/* PR target/28924 */ + +char c; + +void +testc (void) +{ + (void) __sync_fetch_and_add (&c, -1); +} + +short s; + +void +tests (void) +{ + (void) __sync_fetch_and_add (&s, -1); +} + +void +testc2 (void) +{ + (void) __sync_val_compare_and_swap (&c, -1, -3); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20061214-1.c b/gcc/testsuite/gcc.c-torture/compile/20061214-1.c new file mode 100644 index 000000000..1e65a2a6e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20061214-1.c @@ -0,0 +1,7 @@ +typedef unsigned long long ull; +ull bar (void); +void foo (ull *x) +{ + ull y = bar (); + *x += y >> 32; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070121.c b/gcc/testsuite/gcc.c-torture/compile/20070121.c new file mode 100644 index 000000000..88af8bf62 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070121.c @@ -0,0 +1,18 @@ +/* PR rtl-optimization/29329 */ +/* Origin: Debian GCC Maintainers */ +/* Testcase by: Andrew Pinski */ + +struct node234_Tag +{ + int t1; + int kids[4]; + void *elems[3]; +}; + +void *add234_internal(struct node234_Tag *n, int ei) +{ + int j; + for (j = ei; j < 2 && n->elems[j+1];) + j++; + n->kids[j+1] = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070129.c b/gcc/testsuite/gcc.c-torture/compile/20070129.c new file mode 100644 index 000000000..3204d9658 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070129.c @@ -0,0 +1,94 @@ +/* This testcase would cause a hang in PTA solving due to a complex copy + constraint and marking the wrong variable as changed. */ + +typedef struct RExC_state_t +{ + char *end; + char *parse; +} RExC_state_t; + +struct regnode_string +{ + unsigned char str_len; + char string[1]; +}; + +static void *regatom (RExC_state_t * pRExC_state, int *flagp); + +static void * +regpiece (RExC_state_t * pRExC_state, int *flagp) +{ + return regatom (0, 0); +} + +static void * +regbranch (RExC_state_t * pRExC_state, int *flagp, int first) +{ + return regpiece (0, 0); +} + +static void * +reg (RExC_state_t * pRExC_state, int paren, int *flagp) +{ + return regbranch (0, 0, 1); +} + +void * +Perl_pregcomp (char *exp, char *xend, void *pm) +{ + return reg (0, 0, 0); +} + +static void * +regatom (RExC_state_t * pRExC_state, int *flagp) +{ + register void *ret = 0; + int flags; + +tryagain: + switch (*(pRExC_state->parse)) + { + case '(': + ret = reg (pRExC_state, 1, &flags); + if (flags & 0x8) + { + goto tryagain; + } + break; + default: + { + register unsigned long len; + register unsigned ender; + register char *p; + char *oldp, *s; + unsigned long numlen; + unsigned long foldlen; + unsigned char tmpbuf[6 + 1], *foldbuf; + + defchar: + s = (((struct regnode_string *) ret)->string); + for (len = 0, p = (pRExC_state->parse) - 1; + len < 127 && p < (pRExC_state->end); len++) + { + if (((*p) == '*' || (*p) == '+' || (*p) == '?' + || ((*p) == '{' && regcurly (p)))) + { + unsigned long unilen; + for (foldbuf = tmpbuf; foldlen; foldlen -= numlen) + { + reguni (pRExC_state, ender, s, &unilen); + s += unilen; + } + break; + } + unsigned long unilen; + + reguni (pRExC_state, ender, s, &unilen); + s += unilen; + } + + }; + break; + } + return (ret); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070419-1.c b/gcc/testsuite/gcc.c-torture/compile/20070419-1.c new file mode 100644 index 000000000..ea23bf8bd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070419-1.c @@ -0,0 +1,17 @@ +/* PR tree-optimization/31632 */ + +struct S +{ + long int l; + void *m; +}; + +int +foo (struct S *x) +{ + unsigned long a; + a = x->l; + if (a <= ((void *) 0)) + x->m = 0; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070501-1.c b/gcc/testsuite/gcc.c-torture/compile/20070501-1.c new file mode 100644 index 000000000..39acd49de --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070501-1.c @@ -0,0 +1,16 @@ + typedef signed int signed16 __attribute__ ((__mode__ (__HI__))); + typedef unsigned int unsigned16 __attribute__ ((__mode__ (__HI__))); + typedef signed16 HI; + typedef unsigned16 UHI; +unsigned short f(int y) +{ + HI tmp_b4; + tmp_b4 = y; + UHI opval; + if (tmp_b4 == -32768) + opval = 32767; + else + opval = -tmp_b4; + return opval; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20070520-1.c b/gcc/testsuite/gcc.c-torture/compile/20070520-1.c new file mode 100644 index 000000000..fe9db9747 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070520-1.c @@ -0,0 +1,35 @@ +typedef unsigned char uint8_t; +extern uint8_t ff_cropTbl[256 + 2 * 1024]; + +void ff_pred8x8_plane_c(uint8_t *src, int stride){ + int j, k; + int a; + uint8_t *cm = ff_cropTbl + 1024; + const uint8_t * const src0 = src+3-stride; + const uint8_t *src1 = src+4*stride-1; + const uint8_t *src2 = src1-2*stride; + int H = src0[1] - src0[-1]; + int V = src1[0] - src2[ 0]; + for(k=2; k<=4; ++k) { + src1 += stride; src2 -= stride; + H += k*(src0[k] - src0[-k]); + V += k*(src1[0] - src2[ 0]); + } + H = ( 17*H+16 ) >> 5; + V = ( 17*V+16 ) >> 5; + + a = 16*(src1[0] + src2[8]+1) - 3*(V+H); + for(j=8; j>0; --j) { + int b = a; + a += V; + src[0] = cm[ (b ) >> 5 ]; + src[1] = cm[ (b+ H) >> 5 ]; + src[2] = cm[ (b+2*H) >> 5 ]; + src[3] = cm[ (b+3*H) >> 5 ]; + src[4] = cm[ (b+4*H) >> 5 ]; + src[5] = cm[ (b+5*H) >> 5 ]; + src[6] = cm[ (b+6*H) >> 5 ]; + src[7] = cm[ (b+7*H) >> 5 ]; + src += stride; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070522-1.c b/gcc/testsuite/gcc.c-torture/compile/20070522-1.c new file mode 100644 index 000000000..1e1e8020d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070522-1.c @@ -0,0 +1,13 @@ +/* { dg-options "-Wno-psabi" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ + +/* This was PR 31606, we were trying to use TImode to expand the + struct copy in SRA but TImode is not support on ia32. */ + +struct Collision { + int edge; + int triangle; + float _M_instance[3] __attribute__((__aligned__)); +}; +void get_collisions(struct Collision a) { + struct Collision b = a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070529-1.c b/gcc/testsuite/gcc.c-torture/compile/20070529-1.c new file mode 100644 index 000000000..f34add2b6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070529-1.c @@ -0,0 +1,16 @@ +/* ICE in chrec_fold_plus_poly_poly. */ + +typedef unsigned short __u16; +typedef unsigned int u32; +typedef __u16 __be16; +struct hfs_extent { + __be16 count; +}; +int hfs_free_fork( int type) +{ + u32 total_blocks, blocks, start; + struct hfs_extent *extent; + int res, i; + for (i = 0; i < 3; extent++, i++) + blocks += __fswab16((( __u16)(__be16)(extent[i].count))); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070529-2.c b/gcc/testsuite/gcc.c-torture/compile/20070529-2.c new file mode 100644 index 000000000..cb38d2061 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070529-2.c @@ -0,0 +1,11 @@ +void xfs_dir2_grow_inode(void) +{ + int map; + int *mapp; + int nmap; + mapp = ↦ + if (nmap == 0 ) + mapp = ((void *)0); + if (mapp != &map) + kmem_free(mapp); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070531-1.c b/gcc/testsuite/gcc.c-torture/compile/20070531-1.c new file mode 100644 index 000000000..90ecbb88d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070531-1.c @@ -0,0 +1,11 @@ +/* MIN_EXPR/MAX_EXPR caused an ICE in VRP. */ +int *f(int *a, int *b) +{ + *a = 1; + *b = 2; + int *c = a < b ? a : b; + if (c) + return c; + else + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070531-2.c b/gcc/testsuite/gcc.c-torture/compile/20070531-2.c new file mode 100644 index 000000000..967180e0d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070531-2.c @@ -0,0 +1,6 @@ +int f(void) +{ + int *a = 0; + for(a = 0; a < (int*)32767;a++) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070603-1.c b/gcc/testsuite/gcc.c-torture/compile/20070603-1.c new file mode 100644 index 000000000..94e2baf13 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070603-1.c @@ -0,0 +1,9 @@ + +int f(_Complex double *a, unsigned int n) +{ + unsigned int i; + for(i = 0; i< n; i++) + { + a[i] = __real__ a[i+1] + __real__ a[i]; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070603-2.c b/gcc/testsuite/gcc.c-torture/compile/20070603-2.c new file mode 100644 index 000000000..7aaa8c2ae --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070603-2.c @@ -0,0 +1,9 @@ +typedef _Complex double ar[]; +int f(ar *a, unsigned int n) +{ + unsigned int i; + for(i = 0; i< n; i++) + { + (*a)[i*4] = __real__ (*a)[(i+1)*4] + __real__ (*a)[i*4]; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070605-1.c b/gcc/testsuite/gcc.c-torture/compile/20070605-1.c new file mode 100644 index 000000000..8bf53253c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070605-1.c @@ -0,0 +1,10 @@ +quantize_fs_dither (unsigned width, short *errorptr, int dir) +{ + short bpreverr; + unsigned col; + for (col = width; col > 0; col--) + errorptr += dir; + errorptr[0] = (short) bpreverr; +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/20070827-1.c b/gcc/testsuite/gcc.c-torture/compile/20070827-1.c new file mode 100644 index 000000000..5dd009974 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070827-1.c @@ -0,0 +1,20 @@ +/* PR rtl-optimization/33148 */ + +int +foo (unsigned int *p, int *q, unsigned int w, unsigned int b) +{ + unsigned int i; + int mask; + + if (q[0] < q[1]) + mask = 0xff; + else + mask = 0; + + for (i = 0; 8 * i < w; i++) + { + b ^= mask; + *p++ = b; + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070905-1.c b/gcc/testsuite/gcc.c-torture/compile/20070905-1.c new file mode 100644 index 000000000..5953275b1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070905-1.c @@ -0,0 +1,34 @@ +/* PR tree-optimization/32772 */ + +struct S +{ + unsigned long bits[1]; +}; + +void f1 (int, unsigned long *); +int f2 (void); +int f3 (int, unsigned long *); +int f4 (int, unsigned long *); + +static inline __attribute__ ((always_inline)) +void baz (int x, volatile struct S *y) +{ + f1 (x, y->bits); +} + +static int +bar (int x, struct S *y) +{ + int n; + if (__builtin_constant_p (x) ? f3 (x, y->bits) : f4 (x, y->bits)) + baz (x, y); + for (n = f2 (); n < 8; n = f2 ()) + f3 (n, y->bits); +} + +void +foo (int x, int y) +{ + struct S m; + while ((y = bar (x, &m)) >= 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070906-1.c b/gcc/testsuite/gcc.c-torture/compile/20070906-1.c new file mode 100644 index 000000000..bec983f24 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070906-1.c @@ -0,0 +1,8 @@ +struct Bar { + int i[8]; +}; +struct Bar foo(struct Bar **p) +{ + return foo((struct Bar**)*p); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20070915-1.c b/gcc/testsuite/gcc.c-torture/compile/20070915-1.c new file mode 100644 index 000000000..1cd64e5ca --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070915-1.c @@ -0,0 +1,20 @@ +/* PR middle-end/33423 */ + +static struct +{ + char buf[15]; +} u2; + +void +test6 (void) +{ + int len; + char *p; + + for (len = 0; len < 2; len++) + { + p = __builtin___memset_chk (u2.buf, '\0', len, 15); + if (p != u2.buf) + return; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20070919-1.c b/gcc/testsuite/gcc.c-torture/compile/20070919-1.c new file mode 100644 index 000000000..91c444926 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070919-1.c @@ -0,0 +1,31 @@ +typedef short int int16_t; +typedef unsigned char uint8_t; +typedef struct { + int16_t LARc[8]; + int16_t Nc[4]; + int16_t bc[4]; + int16_t Mc[4]; + int16_t xmaxc[4]; + int16_t xMc[4][13]; +} gsm0610_frame_t; +int gsm0610_unpack_voip(gsm0610_frame_t * s, const uint8_t c[33]) +{ + int i; + for (i = 0; i < 4; i++) { + s->Nc[i] = (*c >> 1) & 0x7F; + s->bc[i] = (*c++ & 0x1) << 1; + s->bc[i] |= (*c >> 7) & 0x1; + s->Mc[i] = (*c >> 5) & 0x3; + s->xmaxc[i] = (*c++ & 0x1F) << 1; + s->xmaxc[i] |= (*c >> 7) & 0x1; + s->xMc[i][0] = (*c >> 4) & 0x7; + s->xMc[i][1] = (*c >> 1) & 0x7; + s->xMc[i][2] = (*c++ & 0x1) << 2; + s->xMc[i][2] |= (*c >> 6) & 0x3; + s->xMc[i][3] = (*c >> 3) & 0x7; + s->xMc[i][4] = *c++ & 0x7; + s->xMc[i][10] |= (*c >> 6) & 0x3; + s->xMc[i][11] = (*c >> 3) & 0x7; + s->xMc[i][12] = *c++ & 0x7; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20071027-1.c b/gcc/testsuite/gcc.c-torture/compile/20071027-1.c new file mode 100644 index 000000000..c55040621 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071027-1.c @@ -0,0 +1,25 @@ +/* PR tree-optimization/33856 */ +/* Testcase by Martin Michlmayr */ + +typedef struct z_key +{ + int key; + int mask; +} z_key; +typedef struct picture_size +{ + z_key key; +} picture_size; + +void picture_size_new (picture_size *ps) +{ + z_key key; + ps->key = key; +} + +void picture_sizes_load_default (picture_size *ps) +{ + int i; + for (i = 0; i < 5; ++i) + picture_size_new (ps); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20071102-1.c b/gcc/testsuite/gcc.c-torture/compile/20071102-1.c new file mode 100644 index 000000000..03b015628 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071102-1.c @@ -0,0 +1,32 @@ +/* PR rtl-optimization/28062 */ +/* Original testcase by Martin Michlmayr */ +/* C testcase by Andrew Pinski */ + +struct _NSPoint +{ + float x; + float y; +}; + +typedef struct _NSPoint NSPoint; + +static inline NSPoint +NSMakePoint (float x, float y) +{ + NSPoint point; + point.x = x; + point.y = y; + return point; +} + +static inline NSPoint +RelativePoint (NSPoint point, NSPoint refPoint) +{ + return NSMakePoint (refPoint.x + point.x, refPoint.y + point.y); +} + +NSPoint g(NSPoint refPoint) +{ + float pointA, pointB; + return RelativePoint (NSMakePoint (0, pointA), refPoint); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20071105-1.c b/gcc/testsuite/gcc.c-torture/compile/20071105-1.c new file mode 100644 index 000000000..952b1bd69 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071105-1.c @@ -0,0 +1,11 @@ +/* PR tree-optimization/33993 */ +/* Testcase by Martin Michlmayr */ + +void +init_full (char *array, int ny) +{ + int j; + char acc = 128; + for (j = 0; j < ny; j++) + *array++ = acc++; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20071107-1.c b/gcc/testsuite/gcc.c-torture/compile/20071107-1.c new file mode 100644 index 000000000..627b705d5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071107-1.c @@ -0,0 +1,332 @@ +/* PR rtl-optimization/33737 */ +/* Testcase by Richard Guenther */ + +enum { PROP_0, PROP_DOUBLE_CLICK_TIME, PROP_DOUBLE_CLICK_DISTANCE, PROP_CURSOR_BLINK, PROP_CURSOR_BLINK_TIME, PROP_CURSOR_BLINK_TIMEOUT, PROP_SPLIT_CURSOR, PROP_THEME_NAME, PROP_ICON_THEME_NAME, PROP_FALLBACK_ICON_THEME, PROP_KEY_THEME_NAME, PROP_MENU_BAR_ACCEL, PROP_DND_DRAG_THRESHOLD, PROP_FONT_NAME, PROP_ICON_SIZES, PROP_MODULES, PROP_XFT_ANTIALIAS, PROP_XFT_HINTING, PROP_XFT_HINTSTYLE, PROP_XFT_RGBA, PROP_XFT_DPI, PROP_CURSOR_THEME_NAME, PROP_CURSOR_THEME_SIZE, PROP_ALTERNATIVE_BUTTON_ORDER, PROP_ALTERNATIVE_SORT_ARROWS, PROP_SHOW_INPUT_METHOD_MENU, PROP_SHOW_UNICODE_MENU, PROP_TIMEOUT_INITIAL, PROP_TIMEOUT_REPEAT, PROP_TIMEOUT_EXPAND, PROP_COLOR_SCHEME, PROP_ENABLE_ANIMATIONS, PROP_TOUCHSCREEN_MODE, PROP_TOOLTIP_TIMEOUT, PROP_TOOLTIP_BROWSE_TIMEOUT, PROP_TOOLTIP_BROWSE_MODE_TIMEOUT, PROP_KEYNAV_CURSOR_ONLY, PROP_KEYNAV_WRAP_AROUND, PROP_ERROR_BELL, PROP_COLOR_HASH, PROP_FILE_CHOOSER_BACKEND, PROP_PRINT_BACKENDS, PROP_PRINT_PREVIEW_COMMAND, PROP_ENABLE_MNEMONICS, PROP_ENABLE_ACCELS, PROP_RECENT_FILES_LIMIT }; +void g_assert_warning (void) __attribute__((__noreturn__)); +void gtk_settings_class_init (void) +{ + unsigned int result; + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_DOUBLE_CLICK_TIME) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_DOUBLE_CLICK_DISTANCE) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_CURSOR_BLINK) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_CURSOR_BLINK_TIME) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_CURSOR_BLINK_TIMEOUT) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_SPLIT_CURSOR) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_THEME_NAME) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_ICON_THEME_NAME) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_FALLBACK_ICON_THEME) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_KEY_THEME_NAME) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_MENU_BAR_ACCEL) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_DND_DRAG_THRESHOLD) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_FONT_NAME) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_ICON_SIZES) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_MODULES) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_XFT_ANTIALIAS) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_XFT_HINTING) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_XFT_HINTSTYLE) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_XFT_RGBA) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_XFT_DPI) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_CURSOR_THEME_NAME) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_CURSOR_THEME_SIZE) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_ALTERNATIVE_BUTTON_ORDER) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_ALTERNATIVE_SORT_ARROWS) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_SHOW_INPUT_METHOD_MENU) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_SHOW_UNICODE_MENU) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_TOOLTIP_BROWSE_TIMEOUT) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_TOOLTIP_BROWSE_MODE_TIMEOUT) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_KEYNAV_CURSOR_ONLY) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_KEYNAV_WRAP_AROUND) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_ERROR_BELL) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_FILE_CHOOSER_BACKEND) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_PRINT_PREVIEW_COMMAND) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_ENABLE_MNEMONICS) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + result = settings_install_property_parser(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_ENABLE_ACCELS) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); + if (__builtin_expect (__extension__ ({ + int _g_boolean_var_; + if (result == PROP_RECENT_FILES_LIMIT) _g_boolean_var_ = 1; + else _g_boolean_var_ = 0; + _g_boolean_var_; + }), 1)) { + } + else g_assert_warning(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20071108-1.c b/gcc/testsuite/gcc.c-torture/compile/20071108-1.c new file mode 100644 index 000000000..b9a36ef65 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071108-1.c @@ -0,0 +1,13 @@ +/* PR tree-optimization/33680 */ + +int +f (int dim, int *b, int *c) +{ + int newcentroid[3][dim]; + int *a = newcentroid[2]; + int i, dist = 0; + __builtin_memcpy (newcentroid, c, sizeof (newcentroid)); + for (i = 0; i < dim; i++) + dist += (a[i] - b[i]) * (a[i] - b[i]); + return dist; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20071114-1.c b/gcc/testsuite/gcc.c-torture/compile/20071114-1.c new file mode 100644 index 000000000..ddfbfefff --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071114-1.c @@ -0,0 +1,113 @@ +/* PR tree-optimization/34046 */ +/* Origin: dcb */ + +typedef unsigned char bool8; +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; + +struct SIAPU +{ + uint8 *PC; + uint8 *RAM; + uint8 Bit; + uint32 Address; + uint8 *WaitAddress1; + uint8 *WaitAddress2; + uint8 _Carry; +}; + +struct SAPU +{ + bool8 ShowROM; + uint8 OutPorts [4]; + uint8 ExtraRAM [64]; + uint16 TimerTarget [3]; +}; + +struct SAPU APU; +struct SIAPU IAPU; + +void S9xSetAPUControl (uint8 byte); +void S9xSetAPUDSP (uint8 byte); +uint8 S9xGetAPUDSP (); + +uint8 S9xAPUGetByte (uint32 Address) +{ + Address &= 0xffff; + + if (Address <= 0xff && Address >= 0xf0) + { + if (Address >= 0xf4 && Address <= 0xf7) + { + IAPU.WaitAddress2 = IAPU.WaitAddress1; + IAPU.WaitAddress1 = IAPU.PC; + return (IAPU.RAM [Address]); + } + else if (Address == 0xf3) + return (S9xGetAPUDSP ()); + + if (Address >= 0xfd) + { + IAPU.WaitAddress2 = IAPU.WaitAddress1; + IAPU.WaitAddress1 = IAPU.PC; + uint8 t = IAPU.RAM [Address]; + IAPU.RAM [Address] = 0; + return (t); + } + + return (IAPU.RAM [Address]); + } + else + return (IAPU.RAM [Address]); +} + +void S9xAPUSetByte (uint8 byte, uint32 Address) +{ + Address &= 0xffff; + + if (Address <= 0xff && Address >= 0xf0) + { + if (Address == 0xf3) + S9xSetAPUDSP (byte); + else if (Address >= 0xf4 && Address <= 0xf7) + APU.OutPorts [Address - 0xf4] = byte; + else if (Address == 0xf1) + S9xSetAPUControl (byte); + else if (Address < 0xfd) + { + IAPU.RAM [Address] = byte; + if (Address >= 0xfa) + { + if (byte == 0) + APU.TimerTarget [Address - 0xfa] = 0x100; + else + APU.TimerTarget [Address - 0xfa] = byte; + } + } + } + else + { + if (Address < 0xffc0) + IAPU.RAM [Address] = byte; + else + { + APU.ExtraRAM [Address - 0xffc0] = byte; + if (!APU.ShowROM) + IAPU.RAM [Address] = byte; + } + } +} + +void ApuCA () +{ + IAPU.Address = *(uint16 *) (IAPU.PC + 1); + IAPU.Bit = (uint8)(IAPU.Address >> 13); + if ((IAPU._Carry)) + S9xAPUSetByte (S9xAPUGetByte (IAPU.Address) | (1 << IAPU.Bit), IAPU.Address); + else + S9xAPUSetByte (S9xAPUGetByte (IAPU.Address) & ~(1 << IAPU.Bit), IAPU.Address); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20071117-1.c b/gcc/testsuite/gcc.c-torture/compile/20071117-1.c new file mode 100644 index 000000000..efcd51269 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071117-1.c @@ -0,0 +1,13 @@ +/* PR middle-end/34134 */ + +extern void bar (void *, int); + +int foo (int i) +{ + char *p = __builtin_stack_save (); + void *q = __builtin_alloca (i); + bar (q, i); + __builtin_stack_restore (p); + bar ("", 0); + return 6; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20071118-1.c b/gcc/testsuite/gcc.c-torture/compile/20071118-1.c new file mode 100644 index 000000000..d093d3fd8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071118-1.c @@ -0,0 +1,17 @@ +/* PR rtl-optimization/34132 */ +/* Testcase by Martin Michlmayr */ + +static char *m = "%s%u.msg"; +extern void bar (int, const char *); +void foo (short x, int y, int z) +{ + if (x == 0) + { + bar (y, m); + z = 1; + } + else if (x == 1) + z = 0; + bar (y, m); + bar (z, "%d"); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20071128-1.c b/gcc/testsuite/gcc.c-torture/compile/20071128-1.c new file mode 100644 index 000000000..14b3f9398 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071128-1.c @@ -0,0 +1,24 @@ +/* PR tree-optimization/34140 */ +/* Testcase by Martin Michlmayr */ + +struct S +{ + unsigned int s; +}; +struct T +{ + struct S t[2]; + unsigned int u : 1; +}; + +void +foo (int x, int y, int z) +{ + int i; + struct T t; + + t.u = t.u; + for (i = 0; i < x; i++) + if (z != 1) + t.t[i].s = y || t.u; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20071203-1.c b/gcc/testsuite/gcc.c-torture/compile/20071203-1.c new file mode 100644 index 000000000..154b28bc9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071203-1.c @@ -0,0 +1,12 @@ +/* Testcase by Martin Michlmayr */ + +struct User { char username[10]; }; + +void +auth_set_username (struct User *user) +{ + char *d; + char ch; + d = user->username + (user->username[0] == '~'); + while ((ch = *d++) != '\0') /* do nothing */ ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20071207-1.c b/gcc/testsuite/gcc.c-torture/compile/20071207-1.c new file mode 100644 index 000000000..27b871616 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071207-1.c @@ -0,0 +1,14 @@ +/* PR tree-optimization/34371 */ +/* Testcase by Martin Michlmayr */ + +void centerln (int width, int ch, char *s) +{ + unsigned int sidebar; + int i; + char linet1[1000]; + char linet2[100]; + sidebar = (width - __builtin_strlen (s)) / 2; + for (i = 0; i < sidebar; i++) + linet2[i] = ch; + __builtin_strcpy (linet1, linet2); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20071214-1.c b/gcc/testsuite/gcc.c-torture/compile/20071214-1.c new file mode 100644 index 000000000..f30af9306 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071214-1.c @@ -0,0 +1,15 @@ +typedef __builtin_va_list va_list; +void gftp_config_parse_args (int numargs, char **first, ...) +{ + char **dest = first; + va_list argp; + __builtin_va_start (argp, first); + while (numargs-- > 0) + { + *dest = __builtin_malloc (1); + dest = __builtin_va_arg(argp, char **); + *dest = ((void *)0); + } + __builtin_va_end(argp); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20080114-1.c b/gcc/testsuite/gcc.c-torture/compile/20080114-1.c new file mode 100644 index 000000000..f251c22b9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080114-1.c @@ -0,0 +1,14 @@ +/* PR rtl-optimization/31944 */ +/* Origin: Aurelien Jarno */ + +int type; + +void stuck(int res) +{ + if (type == 1) { + if (res == 0) asm volatile(""); + } + else if (type == 0) { + if (res == 0) asm volatile("" : : "i" (0)); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080124-1.c b/gcc/testsuite/gcc.c-torture/compile/20080124-1.c new file mode 100644 index 000000000..a20937c29 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080124-1.c @@ -0,0 +1,52 @@ +/* PR middle-end/34934 */ + +#include + +typedef struct +{ + int e[1024]; + int f; +} S; + +void foo (long *, va_list); + +void +bar (long *x, S *y, int z, ...) +{ + int i, j; + va_list ap; + va_start (ap, z); + for (j = y->e[i = 1]; i <= y->f; j = y->e[++i]) + { + switch (z) + { + case 1: + if (!(*x & 0x00000020)) + continue; + case 3: + if (!(*x & 0x00000080)) + continue; + case 9: + if (!(*x & 0x04000000)) + continue; + case 4: + if (!(*x & 0x00000200)) + continue; + case 8: + if (!(*x & 0x00100000)) + continue; + case 6: + if (!(*x & 0x00000100)) + continue; + case 7: + if (!(*x & 0x00040000)) + continue; + case 10: + if (!(*x & 0x00000020) + && ((*x & 0x00008000) || (*x & 0x08000000))) + continue; + } + foo (x, ap); + } + va_end (ap); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080419-1.c b/gcc/testsuite/gcc.c-torture/compile/20080419-1.c new file mode 100644 index 000000000..b257fea74 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080419-1.c @@ -0,0 +1,6 @@ +extern void *f(); +void dmi_scan_machine(void) { + char *p = f(), *q; + for (q = p; q < p + 10; q++) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080613-1.c b/gcc/testsuite/gcc.c-torture/compile/20080613-1.c new file mode 100644 index 000000000..20e387842 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080613-1.c @@ -0,0 +1,40 @@ +/* PR middle-end/36520 */ +/* Testcase by Richard Guenther */ + +typedef __SIZE_TYPE__ size_t; +typedef unsigned short int sa_family_t; +struct cmsghdr { + size_t cmsg_len; + __extension__ unsigned char __cmsg_data []; +}; +typedef unsigned int uint32_t; +struct in6_addr { + union { + uint32_t u6_addr32[4]; + } in6_u; +}; +struct sockaddr_in { + sa_family_t sin_family; +}; +struct in6_pktinfo { + struct in6_addr ipi6_addr; +}; +typedef union { + struct sockaddr_in sin; +} sockaddr_any; +static sockaddr_any src_addr; + +inline struct cmsghdr * cmsg_put(struct cmsghdr *cm, int type, void *data, size_t len) +{ + memcpy(((cm)->__cmsg_data), data, len); +} + +int hop_sendmsg(int fd) { + struct cmsghdr *cm; + if (src_addr.sin.sin_family) { + if (src_addr.sin.sin_family == 2) { + struct in6_pktinfo info; + cm = cmsg_put(cm, 50, &info, sizeof(info)); + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080625-1.c b/gcc/testsuite/gcc.c-torture/compile/20080625-1.c new file mode 100644 index 000000000..16def2c8a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080625-1.c @@ -0,0 +1,17 @@ +/* { dg-skip-if "too much data" { "avr-*-*" "m32c-*-*" "pdp11-*-*" } { "*" } { "" } } */ +struct peakbufStruct { + unsigned int lnum [5000]; + int lscan [5000][4000]; + double lmz [5000][4000]; + double lint [5000][4000]; + int PeaksInBuf; + unsigned char freelists [350000]; + unsigned char freelistl [5000]; + unsigned int LastFreeL; +} peakbuf; +void foo(int); +void findmzROI(int i, int *p_scan) +{ + foo(peakbuf.PeaksInBuf); + __builtin_memmove(p_scan, peakbuf.lscan[i], peakbuf.lnum[i]*sizeof(int)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080628-1.c b/gcc/testsuite/gcc.c-torture/compile/20080628-1.c new file mode 100644 index 000000000..aca4ff827 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080628-1.c @@ -0,0 +1,15 @@ +void f (long double, long double); + +struct s { + char c; + struct s *p; +} *p; + +void +g (void) +{ + long double ld; + p->p->c = 1; + ld = p->p->c; + f (ld, 1.0L); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080704-1.c b/gcc/testsuite/gcc.c-torture/compile/20080704-1.c new file mode 100644 index 000000000..b5e38b4ba --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080704-1.c @@ -0,0 +1,43 @@ +/* This code used to crash fold_convert due to PRE + wanting to fold_convert from a REAL_TYPE to an INTEGER_TYPE. */ +typedef unsigned int uint32_t; +union double_union +{ + double d; + uint32_t i[2]; +}; +struct _Jv_reent +{ + int _errno; +}; +_Jv_strtod_r (struct _Jv_reent *ptr, char **se) +{ + int bb2, sign; + double aadj, aadj1, adj; + unsigned long y, z; + union double_union rv, *bs = ((void *) 0), *delta = ((void *) 0); + { + ovfl:ptr->_errno = 34; + { + (((uint32_t) 0xfffffL) | ((uint32_t) 0x100000L) * (1024 + 1023 - 1)); + } + if ((aadj = _Jv_ratio (delta, bs)) <= 2.) + { + { + if (aadj < 2. / 2) + aadj = 1. / 2; + aadj1 = -aadj; + } + } + { + (rv.i[1]) -= 53 * ((uint32_t) 0x100000L); + adj = aadj1 * _Jv_ulp (rv.d); + rv.d += adj; + if (((rv.i[1]) & ((uint32_t) 0x7ff00000L)) >= + ((uint32_t) 0x100000L) * (1024 + 1023 - 53)) + { + goto ovfl; + } + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080721-1.c b/gcc/testsuite/gcc.c-torture/compile/20080721-1.c new file mode 100644 index 000000000..35ef352bc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080721-1.c @@ -0,0 +1,15 @@ +void foo(void); +void bar(void); + +int test(int b) +{ + void *p, **q; + if (b) + p = (void *)foo; + else + p = (void *)bar; + q = (void **)p; + if (*q == (void *)0) + return 1; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080806-1.c b/gcc/testsuite/gcc.c-torture/compile/20080806-1.c new file mode 100644 index 000000000..c54e7397f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080806-1.c @@ -0,0 +1,41 @@ +/* This used to ICE on s390x due to a reload bug. */ + +#if defined(STACK_SIZE) && (STACK_SIZE < 65536) + #define BYTES 64 +#else + #define BYTES 65400 +#endif + +int gl2; +typedef __SIZE_TYPE__ size_t; + +extern void *memcpy (void *dest, const void *src, size_t n); + +void +f1 () +{ + int i2; + unsigned char bf[BYTES]; + + for (i2 = 0; i2 < 3; i2++) + { + unsigned char *p2 = bf; + unsigned char *p3 = ((void *) 0); + unsigned short ctf2; + + p2 += sizeof (short); + + for (ctf2 = 0; ctf2 < 3; ctf2++) + { + if (ctf2 == 1) + { + unsigned short of = p2 - bf - 6; + unsigned short *ofp = (unsigned short *) &of; + memcpy (p3, ofp, sizeof (short)); + } + + if (gl2 == 1) + p2 += 3; + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080812-1.c b/gcc/testsuite/gcc.c-torture/compile/20080812-1.c new file mode 100644 index 000000000..2e4c13a70 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080812-1.c @@ -0,0 +1,21 @@ +/* PR middle-end/37014 */ + +void bar (signed char *); + +void +foo (int x, int y) +{ + int i; + signed char a[123], b[123], c; + for (i = 0; i < 123; i++) + { + int e = y - x; + int d = e < 0 ? -e : e; + c = d < 75; + a[y] = c; + b[y] = c; + y--; + } + bar (b); + bar (a); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080820-1.c b/gcc/testsuite/gcc.c-torture/compile/20080820-1.c new file mode 100644 index 000000000..a4d4375ad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080820-1.c @@ -0,0 +1,5 @@ +extern unsigned long volatile jiffies; +void do_timer(void) +{ + (*(unsigned long *)&jiffies)++; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080903-1.c b/gcc/testsuite/gcc.c-torture/compile/20080903-1.c new file mode 100644 index 000000000..180b926bf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080903-1.c @@ -0,0 +1,12 @@ +struct bar { unsigned short length; }; + +int +dummy(void) +{ + char c[4096]; + struct bar *a; + struct bar *b; + + a->length = ((char *) b - c); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080910-1.c b/gcc/testsuite/gcc.c-torture/compile/20080910-1.c new file mode 100644 index 000000000..bf32775d4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080910-1.c @@ -0,0 +1,56 @@ +/* This used to crash IRA with -O3 -fPIC. + See PR 37333. */ +struct yy_buffer_state { + int yy_is_interactive; +}; +static struct yy_buffer_state * * yy_buffer_stack = 0; +static int yy_n_chars; +int orafce_sql_yyleng; +unsigned char *yy_c_buf_p = 0; +extern char *orafce_sql_yytext; +static const int yy_ec[256] = { }; +short yy_accept[155], yy_base[193] = { }, yy_def[193] = { }; +short yy_chk[738] = { }; +unsigned char *yy_last_accepting_cpos; +int orafce_sql_yylex (int a) +{ + register int yy_current_state; + unsigned char *yy_cp, *yy_bp; + register int yy_act; + while ( 1 ) { + do { + char yy_c = yy_ec[*yy_cp]; + if ( yy_accept[yy_current_state] ) + yy_last_accepting_cpos = yy_cp; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + yy_current_state = yy_def[yy_current_state]; + } while ( yy_current_state != 154 ); +yy_find_action: + yy_act = yy_accept[yy_current_state]; + *yy_cp = '\0'; + switch ( yy_act ) { + case 2: + *yy_cp = 1; + return 265; + case 24: + case 25: + addlit(orafce_sql_yytext, orafce_sql_yyleng); + case 26: + addlit(orafce_sql_yytext, orafce_sql_yyleng); + case 53: + yy_fatal_error( "flex scanner jammed" ); + break; + case 54: + yy_cp = ++(yy_c_buf_p); + unsigned long n = 0; + if ( yy_buffer_stack[0]->yy_is_interactive ) + for ( ; _IO_getc () != (-1) ; ++n ) + yy_n_chars = n; + if (a == 0) + { + yy_current_state = yy_get_previous_state( ); + goto yy_find_action; + } + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080922-1.c b/gcc/testsuite/gcc.c-torture/compile/20080922-1.c new file mode 100644 index 000000000..853ec4f25 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080922-1.c @@ -0,0 +1,29 @@ +typedef struct rtx_def *rtx; +typedef struct rtvec_def *rtvec; +enum rtx_code { PARALLEL, SET }; +union rtunion_def { + rtx rt_rtx; + rtvec rt_rtvec; +}; +typedef union rtunion_def rtunion; +struct rtx_def { + rtunion fld; +}; +struct rtvec_def { + int num_elem; +}; +extern rtx operand; + +rtx peephole2_insns (rtx x0, enum rtx_code code) +{ + switch (code) + { + case SET: + operand = (((x0)->fld).rt_rtx); + return operand; + case PARALLEL: + if ((((((x0)->fld).rt_rtvec))->num_elem) == 2) + return 0; + break; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080929-1.c b/gcc/testsuite/gcc.c-torture/compile/20080929-1.c new file mode 100644 index 000000000..1aa868ca2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080929-1.c @@ -0,0 +1,39 @@ +struct option { + const char *name; + int has_arg; + int *flag; + int val; +}; +enum { + UBI_DYNAMIC_VOLUME = 3, UBI_STATIC_VOLUME = 4, }; +typedef void * libubi_t; +struct ubi_dev_info { + int leb_size; +}; +struct args { + int vol_id; + int vol_type; + long long bytes; + int lebs; + int alignment; + const char *node; + int maxavs; + int devn; +}; +static struct args args = { + .vol_type = UBI_DYNAMIC_VOLUME, .bytes = -1, .lebs = -1, .alignment = 1, .vol_id = (-1), .devn = -1, }; +extern libubi_t libubi_open (int); +extern int ubi_get_dev_info (libubi_t, const char *, struct ubi_dev_info *); +int main(int argc, char * const argv[]) { + int err; + libubi_t libubi; + struct ubi_dev_info dev_info; + libubi = libubi_open(1); + if (!libubi) + return 0; + err = ubi_get_dev_info(libubi, args.node, &dev_info); + if (args.maxavs) { + args.bytes = dev_info.leb_size; + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20081101-1.c b/gcc/testsuite/gcc.c-torture/compile/20081101-1.c new file mode 100644 index 000000000..0e484d062 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20081101-1.c @@ -0,0 +1,12 @@ +int foo (int i, int b) +{ + int mask; + int result; + if (b) + mask = -1; + else + mask = 0; + result = i + 1; + result = result & mask; + return result; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20081108-1.c b/gcc/testsuite/gcc.c-torture/compile/20081108-1.c new file mode 100644 index 000000000..3209a90c8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20081108-1.c @@ -0,0 +1,11 @@ +/* Test function call with function designator involving VLA + side-effects does not lead to an ICE. */ + +void f (void); +void g (void); + +void +h (int a, void *b) +{ + ((void *)(int (*)[++a])b ? f : g) (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20081108-2.c b/gcc/testsuite/gcc.c-torture/compile/20081108-2.c new file mode 100644 index 000000000..2f5a7f64b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20081108-2.c @@ -0,0 +1,4 @@ +/* Test boolean conversion as part of returning unsigned value does + not lead to an ICE. */ + +_Bool f(unsigned a) { return a & 1; } diff --git a/gcc/testsuite/gcc.c-torture/compile/20081108-3.c b/gcc/testsuite/gcc.c-torture/compile/20081108-3.c new file mode 100644 index 000000000..12c58ba98 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20081108-3.c @@ -0,0 +1,4 @@ +/* Test boolean conversion of an overflowing integer return value does + not lead to an ICE. */ + +_Bool f(void) { return __INT_MAX__ + 1; } diff --git a/gcc/testsuite/gcc.c-torture/compile/20081119-1.c b/gcc/testsuite/gcc.c-torture/compile/20081119-1.c new file mode 100644 index 000000000..7402f549b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20081119-1.c @@ -0,0 +1,5 @@ +unsigned long long +f (__builtin_va_list ap) +{ + return __builtin_va_arg (ap, unsigned long long); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20081203-1.c b/gcc/testsuite/gcc.c-torture/compile/20081203-1.c new file mode 100644 index 000000000..713235ff5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20081203-1.c @@ -0,0 +1,24 @@ +/* PR rtl-optimization/38281 */ +/* Reporter: John Regehr */ +/* Testcase by Jakub Jelinek */ + +inline unsigned short +foo (unsigned short x, unsigned short y) +{ + if (y == 0) + return x; + return x / y; +} + +unsigned short a, b, c; + +extern int baz (int, int); + +void +bar (void) +{ + int d = 0x3D75D162; + a = foo (b > d, baz (0, 1)); + for (c = 0; c; c = 1) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20090107-1.c b/gcc/testsuite/gcc.c-torture/compile/20090107-1.c new file mode 100644 index 000000000..b5d4c1a44 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090107-1.c @@ -0,0 +1,25 @@ +/* Verify that we don't ICE by forming invalid addresses for unaligned + doubleword loads (originally for PPC64). */ + +struct a +{ + unsigned int x; + unsigned short y; +} __attribute__((packed)); + +struct b { + struct a rep; + unsigned long long seq; +} __attribute__((packed)); + +struct c { + int x; + struct a a[5460]; + struct b b; +}; + +extern void use_ull(unsigned long long); +extern void f(struct c *i) { + use_ull(i->b.seq); + return; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20090114-1.c b/gcc/testsuite/gcc.c-torture/compile/20090114-1.c new file mode 100644 index 000000000..692c96f76 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090114-1.c @@ -0,0 +1,44 @@ +typedef struct { + int MbInterlace; + int channel_type; +} InputParameters; +typedef struct { + int type; + int NumberofCodedPFrame; + int NumberofGOP; + int NumberofPPicture; + int FieldControl; + int Frame_Total_Number_MB; + int NumberofCodedMacroBlocks; + int BasicUnit; +} ImageParameters; +extern InputParameters *input; +extern ImageParameters *img; +long T; +void rc_init_pict(int fieldpic) +{ + if(input->MbInterlace) + T = img->Frame_Total_Number_MB; + img->NumberofCodedMacroBlocks=0; + if(input->channel_type==1 + && img->NumberofCodedPFrame==58) + T = 4; + if(fieldpic) + { + switch (img->type) + { + case 0: + if(img->NumberofCodedPFrame>0 + && img->FieldControl==1) + T = 3; + if(img->NumberofPPicture==1) + T = 2; + } + if(img->type==0 + && img->NumberofCodedPFrame>0) + T = 0; + } + if(img->type==0 + && img->FieldControl==1) + T = 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20090209-1.c b/gcc/testsuite/gcc.c-torture/compile/20090209-1.c new file mode 100644 index 000000000..781a5e8fd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090209-1.c @@ -0,0 +1,61 @@ +/* PR middle-end/38981 */ +/* Reporter: Kamaraju Kusumanchi */ + +struct d_info +{ + int **subs; +}; + +static int * +d_substitution (struct d_info *di, int prefix) +{ + char c; + + c='_'; + + if (c == '_') + { + unsigned int id; + + if (c != '_') + { + do + { + unsigned int new_id; + + if (new_id < id) + return 0; + id = new_id; + } + while (c != '_'); + } + + + + return di->subs[id]; + } + else + { + int verbose; + int code; + int simple_len; + + code=0; + simple_len=0; + verbose=0; + if (! code && prefix) + { + char peek; + peek='A'; + + if (peek == 'C' || peek == 'D') + verbose = 1; + } + + if (verbose) + { + code = simple_len; + } + + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20090303-1.c b/gcc/testsuite/gcc.c-torture/compile/20090303-1.c new file mode 100644 index 000000000..18a3d91fd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090303-1.c @@ -0,0 +1,20 @@ +/* The array offset became 0x1ffffffffffffffe via a conversion from + signed to unsigned HOST_WIDE_INT, causing an ICE compiling for + Thumb. */ + +int r (unsigned short *); +void s (unsigned short *, unsigned short *); + +int +f (int x) +{ + unsigned short a[1], c[1]; + + if (r (a)) + return x; + + if (c[-1]) + s (a, c); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20090303-2.c b/gcc/testsuite/gcc.c-torture/compile/20090303-2.c new file mode 100644 index 000000000..69cee36e0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090303-2.c @@ -0,0 +1,20 @@ +/* The array offset became 0x1ffffffffffffffe via a conversion from + signed to unsigned HOST_WIDE_INT, causing an ICE compiling for + Thumb. */ + +int r (unsigned short *); +void s (unsigned short *, unsigned short *); + +int +f (int x) +{ + unsigned short a[1], c[1]; + + if (r (a)) + return x; + + if (c[0x7fffffff]) + s (a, c); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20090328-1.c b/gcc/testsuite/gcc.c-torture/compile/20090328-1.c new file mode 100644 index 000000000..10328ad41 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090328-1.c @@ -0,0 +1,17 @@ +union loc { unsigned reg; signed offset; }; +void __frame_state_for (volatile char *state_in, int x) +{ + /* We should move all the loads out of this loop. Right now, we only + move one. It takes two insertions because we insert a cast. */ + union loc fs; + int reg; + for (;;) { + switch (x) { + case 0: + *state_in = fs.reg; + case 1: + *state_in = fs.offset; + } + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20090331-1.c b/gcc/testsuite/gcc.c-torture/compile/20090331-1.c new file mode 100644 index 000000000..2db2ee72e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090331-1.c @@ -0,0 +1,26 @@ +struct re_pattern_buffer { + unsigned char *buffer; + unsigned long int allocated; +}; +void byte_regex_compile (struct re_pattern_buffer *bufp, + unsigned char *begalt, unsigned char *b) +{ + unsigned char *pfrom; + unsigned char *pto; + + while ((unsigned long) (b - bufp->buffer + 3) > bufp->allocated) + { + unsigned char *old_buffer = bufp->buffer; + bufp->allocated <<= 1; + if (old_buffer != bufp->buffer) + { + int incr = bufp->buffer - old_buffer; + b += incr; + } + } + pfrom = b; + pto = b + 3; + while (pfrom != begalt) + *--pto = *--pfrom; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20090401-1.c b/gcc/testsuite/gcc.c-torture/compile/20090401-1.c new file mode 100644 index 000000000..a0058feb2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090401-1.c @@ -0,0 +1,11 @@ +/* PR rtl-optimization/39588 */ +/* Testcase by Olivier ROUSSEL */ + +#define lit_from_int(in) ((in<0)?(((-in)<<1)|1):(in<<1)) + +void init_clause(int *literals, int size, int *lits) +{ + int i; + for(i=0; i < size; i++) + lits[i] = lit_from_int(literals[i]); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20090518-1.c b/gcc/testsuite/gcc.c-torture/compile/20090518-1.c new file mode 100644 index 000000000..709504c40 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090518-1.c @@ -0,0 +1,6 @@ +float +foo(int i) +{ + int j = i == 42; + return *(float *)&j; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20090519-1.c b/gcc/testsuite/gcc.c-torture/compile/20090519-1.c new file mode 100644 index 000000000..54add6b2e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090519-1.c @@ -0,0 +1,11 @@ +typedef struct { int licensed; } __pmPDUInfo; +void __pmDecodeXtendError (int *); +void do_handshake(void) +{ + __pmPDUInfo *pduinfo; + int challenge; + __pmDecodeXtendError(&challenge); + pduinfo = (__pmPDUInfo *)&challenge; + *pduinfo = *pduinfo; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20090721-1.c b/gcc/testsuite/gcc.c-torture/compile/20090721-1.c new file mode 100644 index 000000000..2122b3405 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090721-1.c @@ -0,0 +1,3 @@ +/* { dg-options "-fno-tree-sra" } */ +union u {double d;long long ll;}; +f(double x, int n){union u v;v.d=x;if(n>=0){v.ll<<=63;}else{v.ll-=1<<-n;v.ll>>=-n;}return v.ll;} diff --git a/gcc/testsuite/gcc.c-torture/compile/20090907-1.c b/gcc/testsuite/gcc.c-torture/compile/20090907-1.c new file mode 100644 index 000000000..907574c42 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090907-1.c @@ -0,0 +1,84 @@ +struct platform_device; +typedef unsigned long __kernel_size_t; +typedef unsigned short __u16; +typedef unsigned int __u32; +typedef unsigned char u8; +typedef unsigned short u16; +typedef __kernel_size_t size_t; +typedef __u32 uint32_t; +static inline __attribute__ ((always_inline)) +uint32_t __attribute__ ((pure)) bfin_dspid (void) +{ + return ( { + uint32_t __v; __v;} + ); +} +struct list_head { + struct list_head *next, *prev; +}; +struct page { + union { + }; + struct list_head lru; +}; +struct device_driver { + const char *name; + struct module *owner; +}; +struct fb_info { + struct device *dev; +}; +struct platform_driver { + int (*probe) (struct platform_device *); + int (*remove) (struct platform_device *); + struct device_driver driver; +}; +struct firmware { + size_t size; + const u8 *data; +}; +struct metronomefb_par { + struct fb_info *info; +}; +struct waveform_hdr { + u8 trc; +}; +static u8 calc_cksum (int start, int end, u8 * mem) +{ + u8 tmp = 0; + int i; + for (i = start; i < end; i++) + tmp += mem[i]; + return tmp; +} +extern struct waveform_hdr *wfm_hdr; +extern int wmta; + +static int +load_waveform (u8 * mem, size_t size, int m, int t, struct metronomefb_par *par) +{ + int tta; + int trn = 0; + int i; + u8 cksum; + int cksum_idx; + struct device *dev = par->info->dev; + for (i = 0; i <= sizeof (*wfm_hdr) + wfm_hdr->trc; i++) { + if (mem[i] > t) { + trn = i - sizeof (*wfm_hdr) - 1; + } + } + tta = * (mem + wmta + m * 4) & 0x00FFFFFF; + cksum_idx = tta + trn * 4 + 3; + cksum = calc_cksum (cksum_idx - 3, cksum_idx, mem); + if (cksum != mem[cksum_idx]) { + abort(); + } +} +extern struct firmware *fw_entry; +extern struct metronomefb_par *par; + +int metronomefb_probe (struct platform_device *dev) +{ + return load_waveform ((u8 *) fw_entry->data, fw_entry->size, 3, 31, par); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20090917-1.c b/gcc/testsuite/gcc.c-torture/compile/20090917-1.c new file mode 100644 index 000000000..2b8c37148 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090917-1.c @@ -0,0 +1,55 @@ +typedef int *loop_p; +typedef struct VEC_loop_p_base +{ + unsigned num; + loop_p vec[1]; +} +VEC_loop_p_base; + +__inline__ int +VEC_loop_p_base_iterate (const VEC_loop_p_base * vec_, unsigned ix_, + loop_p * ptr) +{ + if (vec_ && ix_ < vec_->num) + { + *ptr = vec_->vec[ix_]; + return 1; + } + else + { + return 0; + } +} + +typedef struct VEC_loop_p_heap +{ + VEC_loop_p_base base; +} +VEC_loop_p_heap; + + +static __inline__ int +am_vector_index_for_loop (VEC_loop_p_heap * loop_nest, int loop_num) +{ + int i; + loop_p l; + + for (i = 0; + VEC_loop_p_base_iterate ((loop_nest) ? &(loop_nest)->base : 0, i, + &(l)); i++) + if (l == loop_num) + return i; + + __builtin_unreachable (); +} + +unsigned char +build_access_matrix (unsigned max) +{ + unsigned i; + for (i = 0; i < max; i++) + { + if (am_vector_index_for_loop (foo (), 0)) + return 0; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20091215-1.c b/gcc/testsuite/gcc.c-torture/compile/20091215-1.c new file mode 100644 index 000000000..7862e2fb0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20091215-1.c @@ -0,0 +1,15 @@ +void bar (); + +void +foo (void *x, short y) +{ + bar (x, y + 1); +} + +void +bar (x, y) + void *x; + char *y; +{ + baz (y); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20100609-1.c b/gcc/testsuite/gcc.c-torture/compile/20100609-1.c new file mode 100644 index 000000000..8e1175faa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20100609-1.c @@ -0,0 +1,8 @@ +extern unsigned long int strtoul (__const char *__restrict __nptr, char **__restrict __endptr, int __base); +int find_reloads (int i, char *p) +{ + int c; + while ((c = *p++)) + return strtoul (p - 1, &p, 10); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20100907.c b/gcc/testsuite/gcc.c-torture/compile/20100907.c new file mode 100644 index 000000000..2e6cfb9ff --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20100907.c @@ -0,0 +1,9 @@ +struct a {int a,b;}; +const static struct a a[1]={{1,2}}; +struct a b,c; +t() +{ + int idx = 0; + b=a[idx]; + c=a[idx]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20100915-1.c b/gcc/testsuite/gcc.c-torture/compile/20100915-1.c new file mode 100644 index 000000000..04f6ab0fd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20100915-1.c @@ -0,0 +1,82 @@ +/* PR rtl-optimization/45593 */ +/* Testcase by Arnaud Lacombe */ + +typedef unsigned int __u32; +typedef __u32 __be32; +static inline __attribute__((always_inline)) int __attribute__((__cold__)) printk(const char *s, ...) { return 0; } +typedef struct journal_s journal_t; +typedef struct journal_header_s +{ + __be32 h_magic; + __be32 h_blocktype; + __be32 h_sequence; +} journal_header_t; +typedef struct journal_superblock_s +{ + journal_header_t s_header; + __be32 s_blocksize; + __be32 s_maxlen; +} journal_superblock_t; +struct journal_s +{ + struct buffer_head *j_sb_buffer; + journal_superblock_t *j_superblock; + int j_format_version; + int j_blocksize; + unsigned int j_maxlen; +}; +static void journal_fail_superblock (journal_t *journal) +{ + journal->j_sb_buffer = ((void *)0); +} +static int journal_get_superblock(journal_t *journal) +{ + struct buffer_head *bh; + journal_superblock_t *sb; + int err = -100; + bh = journal->j_sb_buffer; + if (!buffer_uptodate(bh)) { + if (!buffer_uptodate(bh)) { + printk ("JBD: IO error reading journal superblock\n"); + goto out; + } + } + err = -101; + if (sb->s_header.h_magic != (( __be32)(__u32)(0)) || + sb->s_blocksize != (( __be32)(__u32)(journal->j_blocksize))) { + printk("JBD: no valid journal superblock found\n"); + goto out; + } + switch((( __u32)(__be32)(sb->s_header.h_blocktype))) { + case 0: + case 1: + break; + default: + goto out; + } + if ((( __u32)(__be32)(sb->s_maxlen)) < journal->j_maxlen) + journal->j_maxlen = (( __u32)(__be32)(sb->s_maxlen)); + else if ((( __u32)(__be32)(sb->s_maxlen)) > journal->j_maxlen) { + printk ("JBD: journal file too short\n"); + goto out; + } + return 0; +out: + journal_fail_superblock(journal); + return err; +} +static int load_superblock(journal_t *journal) +{ + journal_get_superblock(journal); + return 0; +} +int jbd2_journal_update_format (journal_t *journal) +{ + journal_get_superblock(journal); + return 0; +} +int jbd2_journal_wipe(journal_t *journal, int write) +{ + load_superblock(journal); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20101217-1.c b/gcc/testsuite/gcc.c-torture/compile/20101217-1.c new file mode 100644 index 000000000..c4eef0ed4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20101217-1.c @@ -0,0 +1,36 @@ +/* Testcase provided by HUAWEI. */ +#include +int main() +{ + int cur_k; + int cur_j=0; + int cur_i=28; + unsigned char temp_data[8]; + unsigned int Data_Size=20; + + for (cur_k=0;cur_j<7;cur_j++,cur_i++) { + if (cur_j%2==0) { + temp_data[cur_k++]=0; + } + if (cur_k==7) { + for (;cur_k>0;cur_k--) { + if (cur_k>2) { + if ((temp_data[7-cur_k]=='n' || temp_data[7-cur_k]=='N' ) && (temp_data[7-cur_k+1]=='a' || temp_data[7-cur_k+1]=='A' )) { + break; + } + } + if (cur_k==1) { + if (temp_data[7-cur_k]=='n' || temp_data[7-cur_k]=='N' ) { + break; + } + } + } + if (cur_k==7) { + } else { + if (cur_k>0) + printf("dfjk"); + } + } + } +return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20110126-1.c b/gcc/testsuite/gcc.c-torture/compile/20110126-1.c new file mode 100644 index 000000000..c55e0c205 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20110126-1.c @@ -0,0 +1,18 @@ +/* PR rtl-optimization/44469 */ +/* Testcase by Siarhei Siamashka */ + +int a (int *t, const char *p) +{ + if (*t == 0) + { + } + else if (*t == 1) + { + p = (const char *)t; + } + else + __builtin_unreachable(); + if (p[0]) + return 0; + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20110131-1.c b/gcc/testsuite/gcc.c-torture/compile/20110131-1.c new file mode 100644 index 000000000..8ce68de4b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20110131-1.c @@ -0,0 +1,38 @@ +/* PR rtl-optimization/44031 */ +/* Testcase by John Regehr */ + +typedef unsigned char uint8_t; +typedef unsigned int uint32_t; +typedef unsigned long int uint64_t; + +static uint32_t +safe_add_func_uint32_t_u_u (uint32_t ui1, uint32_t ui2) +{ + return ui1 + ui2; +} + +static uint64_t +safe_div_func_uint64_t_u_u (uint64_t ui1, uint32_t ui2) +{ + return ui2 ? : (ui1 / ui2); +} + +uint8_t g_55; +uint8_t *g_73 = &g_55; +uint8_t **g_332 = &g_73; + +int func_38(uint8_t *,int); +int func_8(int); + +int int321 (void) +{ + uint8_t l_26[4]; + uint8_t *l_238 = &l_26[2]; + uint8_t l_400; + l_400 &= + func_38 (&l_26[3], + safe_add_func_uint32_t_u_u (safe_div_func_uint64_t_u_u + (1, **g_332), + *l_238) >= *l_238 < func_8 (0)), 1; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20110906-1.c b/gcc/testsuite/gcc.c-torture/compile/20110906-1.c new file mode 100644 index 000000000..50ea9e241 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20110906-1.c @@ -0,0 +1,22 @@ +/* PR middle-end/50266 */ +/* Testcase by */ + +struct a { + unsigned int a; + unsigned int b; +}; + +struct a *const p = (struct a *)0x4A004100; + +void foo(void) +{ + unsigned int i = 0; + unsigned int *const x[] = { + &p->a, + &p->b, + 0 + }; + + (*(volatile unsigned int *)((x[i])) + = (unsigned int)((unsigned int)((*(volatile unsigned int *)(x[i]))))); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20110913-1.c b/gcc/testsuite/gcc.c-torture/compile/20110913-1.c new file mode 100644 index 000000000..e435a14b2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20110913-1.c @@ -0,0 +1,26 @@ +struct ieee754_double { + double d; +}; +extern const float __exp_deltatable[178]; +float __ieee754_expf (float x) +{ + static const float himark = 88.72283935546875; + static const float lomark = -103.972084045410; + if (__builtin_isless(x, himark) && __builtin_isgreater(x, lomark)) + { + int tval; + double x22, t, result, dx; + float delta; + struct ieee754_double ex2_u; + dx -= t; + tval = (int) (t * 512.0); + if (t >= 0) + delta = - __exp_deltatable[tval]; + else + delta = __exp_deltatable[-tval]; + x22 = (0.5000000496709180453 * dx + 1.0000001192102037084) * dx + delta; + result = x22 * ex2_u.d + ex2_u.d; + return (float) result; + } + return x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20121107-1.c b/gcc/testsuite/gcc.c-torture/compile/20121107-1.c new file mode 100644 index 000000000..a86206702 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20121107-1.c @@ -0,0 +1,14 @@ +/* PR middle-end/55219 */ +/* Testcase by Markus Trippelsdorf */ + +int x, c, d, e, f, g, h, i; +double j; +const int k; +const enum { B } a; +void +fn1 (void) +{ + h = (g ? c : g ? f : g ? e : g ? i : g ? f : g ? e : g ? d : x) + + (a ? : a ? : a ? : a ? : a ? : a ? : a ? : a ? : a ? : a ? : a + ? j : a ? : 0 ? : a ? : a ? : a ? : a ? : a ? : a ? k : a ? : x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/900116-1.c b/gcc/testsuite/gcc.c-torture/compile/900116-1.c new file mode 100644 index 000000000..37c7eb789 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/900116-1.c @@ -0,0 +1,14 @@ +struct st {char a, b, c, d; } + +zloop (struct st *s, int *p, int *q) +{ + int i; + struct st ss; + + for (i = 0; i < 100; i++) + { + ss = s[i]; + p[i] = ss.c; + q[i] = ss.b; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/900216-1.c b/gcc/testsuite/gcc.c-torture/compile/900216-1.c new file mode 100644 index 000000000..8a4bfb74e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/900216-1.c @@ -0,0 +1,9 @@ +foo (p, a, b) + unsigned short *p; +{ + unsigned int x; + + x = p[0]; + + return (x == 134U); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/900313-1.c b/gcc/testsuite/gcc.c-torture/compile/900313-1.c new file mode 100644 index 000000000..f2bc40d72 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/900313-1.c @@ -0,0 +1,172 @@ +main () +{ + char *a; + foo (alloca (10000)); + foo (alloca (100000)); + foo (alloca ((int) &main)); +} + +many_par (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) +{ + char *x; + int aa, ba, ca, da, ea, fa, ga, ha, ia, ja, ka, la, ma, na, oa, pa; + + aa = bar (); + ba = bar (); + ca = bar (); + da = bar (); + ea = bar (); + fa = bar (); + ga = bar (); + ha = bar (); + ia = bar (); + ja = bar (); + ka = bar (); + la = bar (); + ma = bar (); + na = bar (); + oa = bar (); + pa = bar (); + foobar (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, aa, ba, ca, + da, ea, fa, ga, ha, ia, ja, ka, la, ma, na, oa, pa); + +} + +foobar (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, aa, ba, ca, + da, ea, fa, ga, ha, ia, ja, ka, la, ma, na, oa, pa) +{ + int ab, bb, cb, db, eb, fb, gb, hb, ib, jb, kb, lb, mb, nb, ob, pb; + int qb, rb, sb, tb, ub, vb, xb, yb; + + ab = bar (); + bb = bar (); + cb = bar (); + db = bar (); + eb = bar (); + fb = bar (); + gb = bar (); + hb = bar (); + ib = bar (); + jb = bar (); + kb = bar (); + lb = bar (); + mb = bar (); + nb = bar (); + ob = bar (); + pb = bar (); + qb = bar (); + rb = bar (); + sb = bar (); + tb = bar (); + ub = bar (); + vb = bar (); + xb = bar (); + yb = bar (); + + boofar (a); + boofar (b); + boofar (c); + boofar (d); + boofar (e); + boofar (f); + boofar (g); + boofar (h); + boofar (i); + boofar (j); + boofar (k); + boofar (l); + boofar (m); + boofar (n); + boofar (o); + boofar (p); + boofar (aa); + boofar (ba); + boofar (ca); + boofar (da); + boofar (ea); + boofar (fa); + boofar (ga); + boofar (ha); + boofar (ia); + boofar (ja); + boofar (ka); + boofar (la); + boofar (ma); + boofar (na); + boofar (oa); + boofar (pa); + + boofar (ab); + boofar (bb); + boofar (cb); + boofar (db); + boofar (eb); + boofar (fb); + boofar (gb); + boofar (hb); + boofar (ib); + boofar (jb); + boofar (kb); + boofar (lb); + boofar (mb); + boofar (nb); + boofar (ob); + boofar (pb); + + boofar (a); + boofar (b); + boofar (c); + boofar (d); + boofar (e); + boofar (f); + boofar (g); + boofar (h); + boofar (i); + boofar (j); + boofar (k); + boofar (l); + boofar (m); + boofar (n); + boofar (o); + boofar (p); + boofar (aa); + boofar (ba); + boofar (ca); + boofar (da); + boofar (ea); + boofar (fa); + boofar (ga); + boofar (ha); + boofar (ia); + boofar (ja); + boofar (ka); + boofar (la); + boofar (ma); + boofar (na); + boofar (oa); + boofar (pa); + + boofar (ab); + boofar (bb); + boofar (cb); + boofar (db); + boofar (eb); + boofar (fb); + boofar (gb); + boofar (hb); + boofar (ib); + boofar (jb); + boofar (kb); + boofar (lb); + boofar (mb); + boofar (nb); + boofar (ob); + boofar (pb); + +} + +test_exit_ignore_stack () +{ + foobar (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/900407-1.c b/gcc/testsuite/gcc.c-torture/compile/900407-1.c new file mode 100644 index 000000000..fdf47791c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/900407-1.c @@ -0,0 +1,10 @@ +foo (a, b, p) + int *p; +{ + int c; + p[1] = a + 0x1000; + c = b + 0xffff0000; + if ((b + 0xffff0000) == 0) + c++; + p[2] = c; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/900516-1.c b/gcc/testsuite/gcc.c-torture/compile/900516-1.c new file mode 100644 index 000000000..69e961447 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/900516-1.c @@ -0,0 +1 @@ +f(c){return!(c?2.0:1.0);} diff --git a/gcc/testsuite/gcc.c-torture/compile/920301-1.c b/gcc/testsuite/gcc.c-torture/compile/920301-1.c new file mode 100644 index 000000000..c4d663eb8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920301-1.c @@ -0,0 +1,4 @@ +#ifndef NO_LABEL_VALUES +f(){static void*t[]={&&x};x:;} +#endif +g(){static unsigned p[5];} diff --git a/gcc/testsuite/gcc.c-torture/compile/920409-1.c b/gcc/testsuite/gcc.c-torture/compile/920409-1.c new file mode 100644 index 000000000..b96ec53d5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920409-1.c @@ -0,0 +1 @@ +x(){int y;y>0.0?y:y-1;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920409-2.c b/gcc/testsuite/gcc.c-torture/compile/920409-2.c new file mode 100644 index 000000000..ef2bdb8b7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920409-2.c @@ -0,0 +1,2 @@ +double x(){int x1,x2;double v; +if(((long)(x1-x2))<1)return -1.0;v=t(v);v=y(1,v>0.0?(int)v:((int)v-1));} diff --git a/gcc/testsuite/gcc.c-torture/compile/920410-1.c b/gcc/testsuite/gcc.c-torture/compile/920410-1.c new file mode 100644 index 000000000..4bfa7a665 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920410-1.c @@ -0,0 +1,30 @@ +int alloc_float(f) + float f; +{ union + { + float f; + int i; + } + u; + u.f=f; + return u.i&~1; +} + +float c_float(int obj) +{ union + { + float f; + int i; + } u; + + u.i=obj; + return u.f; +} + +main() +{ int x=alloc_float(1.2); + int y=alloc_float(5.7); + int z=alloc_float(c_float(x)*c_float(y)); + + printf("%g\n",(double)c_float(z)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920410-2.c b/gcc/testsuite/gcc.c-torture/compile/920410-2.c new file mode 100644 index 000000000..958aae9cb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920410-2.c @@ -0,0 +1,12 @@ +joe() +{ + int j; + + while( 1 ) + { + for( j = 0; j < 4; j++ ) + ; + for( j = 0; j < 4; j++ ) + ; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920411-2.c b/gcc/testsuite/gcc.c-torture/compile/920411-2.c new file mode 100644 index 000000000..0cc13c843 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920411-2.c @@ -0,0 +1 @@ +x(){int n;double x;n=x<1?n:n+1;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920413-1.c b/gcc/testsuite/gcc.c-torture/compile/920413-1.c new file mode 100644 index 000000000..45b5fc5d0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920413-1.c @@ -0,0 +1,2 @@ +union u {double d;long long ll;}; +f(double x, int n){union u v;v.d=x;if(n>=0){v.ll<<=63;}else{v.ll+=1<<-n;v.ll>>=-n;}return v.ll;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920415-1.c b/gcc/testsuite/gcc.c-torture/compile/920415-1.c new file mode 100644 index 000000000..1636adeaf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920415-1.c @@ -0,0 +1,20 @@ +extern void abort (void); +extern void exit (int); + +#ifndef NO_LABEL_VALUES +f () +{ + __label__ l; + void *x() + { + return &&l; + } + goto *x (); + abort (); + return; + l: + exit (0); +} +#else +int x; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-1.c b/gcc/testsuite/gcc.c-torture/compile/920428-1.c new file mode 100644 index 000000000..fdc478a38 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920428-1.c @@ -0,0 +1 @@ +x(){char*q;return(long)q>>8&0xff;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-2.c b/gcc/testsuite/gcc.c-torture/compile/920428-2.c new file mode 100644 index 000000000..f313b3298 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920428-2.c @@ -0,0 +1,531 @@ +double sin(double x); +double cos(double x); +double tan(double x); +double asin(double x); +double acos(double x); +double atan(double x); +double atan2(double y, double x); +double sinh(double x); +double cosh(double x); +double tanh(double x); +double exp(double x); +double expm1(double x); +double log(double x); +double log10(double x); +double log1p(double x); +double pow(double x, double y); +double sqrt(double x); +double cbrt(double x); +double ceil(double x); +double floor(double x); +double fabs(double x); +double frexp(double value, int *eptr); +double ldexp(double value, int exp); +double modf(double value, double *iptr); +double erf(double x); +double erfc(double x); +double atof(const char *nptr); +double hypot(double x, double y); +double lgamma(double x); +double j0(double x); +double j1(double x); +double jn(int n, double x); +double y0(double x); +double y1(double x); +double yn(int n, double x); +extern struct _iobuf { + int _cnt; + char *_ptr; + char *_base; + int _bufsiz; + short _flag; + char _file; +} _iob[]; +typedef __SIZE_TYPE__ size_t; +typedef char *va_list; +struct _iobuf *fopen(const char *filename, const char *type); +struct _iobuf *freopen(const char *filename, const char *type, struct _iobuf *stream); +struct _iobuf *fdopen(int fildes, const char *type); +struct _iobuf *popen(const char *command, const char *type); +int pclose(struct _iobuf *stream); +int fflush(struct _iobuf *stream); +int fclose(struct _iobuf *stream); +int remove(const char *path); +int rename(const char *from, const char *to); +struct _iobuf *tmpfile(void); +char *tmpnam(char *s); +int setvbuf(struct _iobuf *iop, char *buf, int type, size_t size); +int setbuf(struct _iobuf *stream, char *buf); +int setbuffer(struct _iobuf *stream, char *buf, size_t size); +int setlinebuf(struct _iobuf *stream); +int fprintf(struct _iobuf *stream, const char *format, ...); +int printf(const char *format, ...); +char *sprintf(char *s, const char *format, ...); +int vfprintf(struct _iobuf *stream, const char *format, va_list arg); +int vprintf(const char *format, va_list arg); +int vsprintf(char *s, const char *format, va_list arg); +int fscanf(struct _iobuf *stream, const char *format, ...); +int scanf(const char *format, ...); +int sscanf(char *s, const char *format, ...); +int fgetc(struct _iobuf *stream); +int getw(struct _iobuf *stream); +char *fgets(char *s, int n, struct _iobuf *stream); +char *gets(char *s); +int fputc(int c, struct _iobuf *stream); +int putw(int w, struct _iobuf *stream); +int fputs(const char *s, struct _iobuf *stream); +int puts(const char *s); +int ungetc(int c, struct _iobuf *stream); +int fread(void *ptr, size_t size, size_t count, struct _iobuf *iop); +int fwrite(const void *ptr, size_t size, size_t count, struct _iobuf *iop); +int fseek(struct _iobuf *stream, long offset, int ptrname); +long ftell(struct _iobuf *stream); +void rewind(struct _iobuf *stream); +int fgetpos(struct _iobuf *stream, long *pos); +int fsetpos(struct _iobuf *stream, const long *pos); +void perror(const char *s); +typedef unsigned char byte; +typedef unsigned char uchar; +typedef unsigned short ushort; +typedef unsigned int uint; +typedef unsigned long ulong; +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; +typedef unsigned short ushort_; +typedef struct _physadr { int r[1]; } *physadr; +typedef struct label_t { + int val[11]; +} label_t; +typedef struct _quad { long val[2]; } quad; +typedef long daddr_t; +typedef char * caddr_t; +typedef u_long ino_t; +typedef long swblk_t; +typedef long time_t; +typedef short dev_t; +typedef long off_t; +typedef u_short uid_t; +typedef u_short gid_t; +typedef signed char prio_t; +typedef long fd_mask; +typedef struct fd_set { + fd_mask fds_bits[(((256 )+(( (sizeof(fd_mask) * 8 ) )-1))/( (sizeof(fd_mask) * 8 ) )) ]; +} fd_set; +typedef struct qhdr { + struct qhdr *link, *rlink; +} *queue_t; +typedef char *ptr_ord_t; +typedef double floatp; +typedef char *(*proc_alloc_t)(unsigned num_elements, unsigned element_size, const char *client_name ); +typedef void (*proc_free_t)(char *data, unsigned num_elements, unsigned element_size, const char *client_name ); +extern struct _iobuf *gs_out; +typedef struct gs_point_s { + double x, y; +} gs_point; +typedef struct gs_int_point_s { + int x, y; +} gs_int_point; +typedef struct gs_rect_s { + gs_point p, q; +} gs_rect; +typedef struct gs_int_rect_s { + gs_int_point p, q; +} gs_int_rect; +typedef struct gs_state_s gs_state; +typedef struct { + proc_alloc_t alloc; + proc_free_t free; +} gs_memory_procs; +char *gs_malloc(uint, uint, const char * ); +void gs_free(char *, uint, uint, const char * ); +extern char gs_debug[128]; +extern int gs_log_error(int, const char *, int ); +typedef long fixed; +typedef struct gs_fixed_point_s { + fixed x, y; +} gs_fixed_point; +typedef struct gs_fixed_rect_s { + gs_fixed_point p, q; +} gs_fixed_rect; +typedef struct gs_matrix_s { + long _xx; float xx; long _xy; float xy; long _yx; float yx; long _yy; float yy; long _tx; float tx; long _ty; float ty; +} gs_matrix; +void gs_make_identity(gs_matrix * ); +int gs_make_translation(floatp, floatp, gs_matrix * ), + gs_make_scaling(floatp, floatp, gs_matrix * ), + gs_make_rotation(floatp, gs_matrix * ); +int gs_matrix_multiply(const gs_matrix *, const gs_matrix *, gs_matrix * ), + gs_matrix_invert(const gs_matrix *, gs_matrix * ), + gs_matrix_rotate(const gs_matrix *, floatp, gs_matrix * ); +int gs_point_transform(floatp, floatp, const gs_matrix *, gs_point * ), + gs_point_transform_inverse(floatp, floatp, const gs_matrix *, gs_point * ), + gs_distance_transform(floatp, floatp, const gs_matrix *, gs_point * ), + gs_distance_transform_inverse(floatp, floatp, const gs_matrix *, gs_point * ), + gs_bbox_transform_inverse(gs_rect *, gs_matrix *, gs_rect * ); +typedef struct gs_matrix_fixed_s { + long _xx; float xx; long _xy; float xy; long _yx; float yx; long _yy; float yy; long _tx; float tx; long _ty; float ty; + fixed tx_fixed, ty_fixed; +} gs_matrix_fixed; +extern void gs_update_matrix_fixed(gs_matrix_fixed * ); +int gs_point_transform2fixed(gs_matrix_fixed *, floatp, floatp, gs_fixed_point * ), + gs_distance_transform2fixed(gs_matrix_fixed *, floatp, floatp, gs_fixed_point * ); +typedef struct { + long xx, xy, yx, yy; + int skewed; + int shift; + int max_bits; + fixed round; +} fixed_coeff; + +typedef enum { + gs_cap_butt = 0, + gs_cap_round = 1, + gs_cap_square = 2 +} gs_line_cap; +typedef enum { + gs_join_miter = 0, + gs_join_round = 1, + gs_join_bevel = 2 +} gs_line_join; +gs_state *gs_state_alloc(proc_alloc_t, proc_free_t ); +int gs_state_free(gs_state * ); +int gs_gsave(gs_state * ), + gs_grestore(gs_state * ), + gs_grestoreall(gs_state * ); +gs_state *gs_gstate(gs_state * ); +int gs_currentgstate(gs_state * , const gs_state * ), + gs_setgstate(gs_state * , const gs_state * ); +gs_state *gs_state_swap_saved(gs_state *, gs_state * ); +void gs_state_swap(gs_state *, gs_state * ); +int gs_initgraphics(gs_state * ); +typedef struct gx_device_s gx_device; +int gs_flushpage(gs_state * ); +int gs_copypage(gs_state * ); +int gs_output_page(gs_state *, int, int ); +int gs_copyscanlines(gx_device *, int, byte *, uint, int *, uint * ); +gx_device * gs_getdevice(int ); +int gs_copydevice(gx_device **, gx_device *, proc_alloc_t ); +int gs_makeimagedevice(gx_device **, gs_matrix *, uint, uint, byte *, int, proc_alloc_t ); +void gs_nulldevice(gs_state * ); +int gs_setdevice(gs_state *, gx_device * ); +gx_device * gs_currentdevice(gs_state * ); +const char * gs_devicename(gx_device * ); +void gs_deviceinitialmatrix(gx_device *, gs_matrix * ); +int gs_closedevice(gx_device * ); +int gs_setlinewidth(gs_state *, floatp ); +float gs_currentlinewidth(const gs_state * ); +int gs_setlinecap(gs_state *, gs_line_cap ); +gs_line_cap gs_currentlinecap(const gs_state * ); +int gs_setlinejoin(gs_state *, gs_line_join ); +gs_line_join gs_currentlinejoin(const gs_state * ); +int gs_setmiterlimit(gs_state *, floatp ); +float gs_currentmiterlimit(const gs_state * ); +int gs_setdash(gs_state *, const float *, uint, floatp ); +uint gs_currentdash_length(const gs_state * ); +int gs_currentdash_pattern(const gs_state *, float * ); +float gs_currentdash_offset(const gs_state * ); +int gs_setflat(gs_state *, floatp ); +float gs_currentflat(const gs_state * ); +int gs_setstrokeadjust(gs_state *, int ); +int gs_currentstrokeadjust(const gs_state * ); +typedef enum { + gs_color_space_DeviceGray = 0, + gs_color_space_DeviceRGB, + gs_color_space_DeviceCMYK +} gs_color_space; +typedef struct gs_color_s gs_color; +extern const uint gs_color_sizeof; +int gs_setgray(gs_state *, floatp ); +float gs_currentgray(gs_state * ); +int gs_sethsbcolor(gs_state *, floatp, floatp, floatp ), + gs_currenthsbcolor(gs_state *, float [3] ), + gs_setrgbcolor(gs_state *, floatp, floatp, floatp ), + gs_currentrgbcolor(gs_state *, float [3] ); +int gs_currentcolorspace(gs_state *, gs_color_space * ); +typedef float (*gs_transfer_proc)(gs_state *, floatp ); +int gs_settransfer(gs_state *, gs_transfer_proc ), + gs_settransfer_remap(gs_state *, gs_transfer_proc, int ); +gs_transfer_proc gs_currenttransfer(gs_state * ); +int gs_setcolortransfer(gs_state *, gs_transfer_proc , + gs_transfer_proc , gs_transfer_proc , + gs_transfer_proc ), + gs_setcolortransfer_remap(gs_state *, gs_transfer_proc , + gs_transfer_proc , gs_transfer_proc , + gs_transfer_proc , int ); +void gs_currentcolortransfer(gs_state *, gs_transfer_proc [4] ); +int gs_setscreen(gs_state *, floatp, floatp, float (*)(floatp, floatp ) ); +int gs_currentscreen(gs_state *, float *, float *, float (**)(floatp, floatp ) ); +int gs_sethalftonephase(gs_state *, int, int ); +int gs_currenthalftonephase(gs_state *, gs_int_point * ); +typedef struct gs_screen_enum_s gs_screen_enum; +extern const uint gs_screen_enum_sizeof; +int gs_screen_init(gs_screen_enum *, gs_state *, floatp, floatp ); +int gs_screen_currentpoint(gs_screen_enum *, gs_point * ); +int gs_screen_next(gs_screen_enum *, floatp ); +struct gs_state_s { + gs_state *saved; + gs_memory_procs memory_procs; + gs_matrix_fixed ctm; + gs_matrix ctm_inverse; + int inverse_valid; + struct gx_path_s *path; + struct gx_clip_path_s *clip_path; + int clip_rule; + struct line_params_s *line_params; + struct halftone_params_s *halftone; + float (*ht_proc)(floatp, floatp ); + gs_int_point ht_phase; + gs_int_point phase_mod; + struct gs_color_s *color; + struct gx_device_color_s *dev_color; + struct gx_transfer_s *transfer; + struct gs_font_s *font; + gs_matrix char_tm; + int char_tm_valid; + byte in_cachedevice; + byte in_charpath; + + + + + int level; + float flatness; + int stroke_adjust; + struct device_s *device; + int device_is_shared; + +}; +typedef unsigned long gx_bitmap_id; +typedef struct gx_bitmap_s { + byte *data; + int raster; + gs_int_point size; + gx_bitmap_id id; + ushort rep_width, rep_height; +} gx_bitmap; +typedef unsigned long gx_color_index; +typedef unsigned short gx_color_value; +typedef struct gx_device_color_info_s { + int num_components; + + int depth; + gx_color_value max_gray; + gx_color_value max_rgb; + + gx_color_value dither_gray; + gx_color_value dither_rgb; + +} gx_device_color_info; +typedef struct gx_device_procs_s gx_device_procs; +struct gx_device_s { + int params_size; gx_device_procs *procs; const char *dname; int width; int height; float x_pixels_per_inch; float y_pixels_per_inch; float l_margin, b_margin, r_margin, t_margin; gx_device_color_info color_info; int is_open; +}; +typedef struct gs_prop_item_s gs_prop_item; +struct gx_device_procs_s { + int (*open_device)(gx_device *dev ); + void (*get_initial_matrix)(gx_device *dev, gs_matrix *pmat ); + int (*sync_output)(gx_device *dev ); + int (*output_page)(gx_device *dev, int num_copies, int flush ); + int (*close_device)(gx_device *dev ); + gx_color_index (*map_rgb_color)(gx_device *dev, gx_color_value red, gx_color_value green, gx_color_value blue ); + int (*map_color_rgb)(gx_device *dev, gx_color_index color, gx_color_value rgb[3] ); + int (*fill_rectangle)(gx_device *dev, int x, int y, int width, int height, gx_color_index color ); + int (*tile_rectangle)(gx_device *dev, gx_bitmap *tile, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1, int phase_x, int phase_y ); + int (*copy_mono)(gx_device *dev, unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1 ); + int (*copy_color)(gx_device *dev, unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height ); + int (*draw_line)(gx_device *dev, int x0, int y0, int x1, int y1, gx_color_index color ); + int (*get_bits)(gx_device *dev, int y, unsigned char *data, unsigned int size, int pad_to_word ); + int (*get_props)(gx_device *dev, gs_prop_item *plist ); + + int (*put_props)(gx_device *dev, gs_prop_item *plist, int count ); + +}; +extern unsigned int gx_device_bytes_per_scan_line(gx_device *dev, int pad_to_word ); +int gx_default_open_device(gx_device *dev ); +void gx_default_get_initial_matrix(gx_device *dev, gs_matrix *pmat ); +int gx_default_sync_output(gx_device *dev ); +int gx_default_output_page(gx_device *dev, int num_copies, int flush ); +int gx_default_close_device(gx_device *dev ); +gx_color_index gx_default_map_rgb_color(gx_device *dev, gx_color_value red, gx_color_value green, gx_color_value blue ); +int gx_default_map_color_rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3] ); +int gx_default_tile_rectangle(gx_device *dev, gx_bitmap *tile, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1, int phase_x, int phase_y ); +int gx_default_copy_color(gx_device *dev, unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height ); +int gx_default_draw_line(gx_device *dev, int x0, int y0, int x1, int y1, gx_color_index color ); +int gx_default_get_bits(gx_device *dev, int y, unsigned char *data, unsigned int size, int pad_to_word ); +int gx_default_get_props(gx_device *dev, gs_prop_item *plist ); +int gx_default_put_props(gx_device *dev, gs_prop_item *plist, int count ); +typedef struct device_s { + gx_device *info; + int is_band_device; + gx_color_index white, black; +} device; +int gs_initmatrix(gs_state * ), + gs_defaultmatrix(const gs_state *, gs_matrix * ), + gs_currentmatrix(const gs_state *, gs_matrix * ), + gs_setmatrix(gs_state *, const gs_matrix * ), + gs_translate(gs_state *, floatp, floatp ), + gs_scale(gs_state *, floatp, floatp ), + gs_rotate(gs_state *, floatp ), + gs_concat(gs_state *, const gs_matrix * ); +int gs_transform(gs_state *, floatp, floatp, gs_point * ), + gs_dtransform(gs_state *, floatp, floatp, gs_point * ), + gs_itransform(gs_state *, floatp, floatp, gs_point * ), + gs_idtransform(gs_state *, floatp, floatp, gs_point * ); +static int +ctm_set_inverse(gs_state *pgs) +{ int code = gs_matrix_invert(&*(gs_matrix *)&(pgs)->ctm , &pgs->ctm_inverse); + 0; + if ( code < 0 ) return code; + pgs->inverse_valid = 1; + return 0; +} +void +gs_update_matrix_fixed(gs_matrix_fixed *pmat) +{ (*pmat). tx = ((float)(((*pmat). tx_fixed = ((fixed)(((*pmat). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (*pmat). ty = ((float)(((*pmat). ty_fixed = ((fixed)(((*pmat). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))); +} +int +gs_initmatrix(gs_state *pgs) +{ gx_device *dev = pgs->device->info; + (*dev->procs->get_initial_matrix)(dev, &*(gs_matrix *)&(pgs)->ctm ); + (pgs->ctm). tx = ((float)(((pgs->ctm). tx_fixed = ((fixed)(((pgs->ctm). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (pgs->ctm). ty = ((float)(((pgs->ctm). ty_fixed = ((fixed)(((pgs->ctm). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , pgs->inverse_valid = 0, pgs->char_tm_valid = 0; + return 0; +} +int +gs_defaultmatrix(const gs_state *pgs, gs_matrix *pmat) +{ gx_device *dev = pgs->device->info; + (*dev->procs->get_initial_matrix)(dev, pmat); + return 0; +} +int +gs_currentmatrix(const gs_state *pgs, gs_matrix *pmat) +{ *pmat = *(gs_matrix *)&(pgs)->ctm; + return 0; +} +int +gs_setmatrix(gs_state *pgs, const gs_matrix *pmat) +{ *(gs_matrix *)&(pgs)->ctm = *pmat; + (pgs->ctm). tx = ((float)(((pgs->ctm). tx_fixed = ((fixed)(((pgs->ctm). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (pgs->ctm). ty = ((float)(((pgs->ctm). ty_fixed = ((fixed)(((pgs->ctm). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , pgs->inverse_valid = 0, pgs->char_tm_valid = 0; + return 0; +} +int +gs_translate(gs_state *pgs, floatp dx, floatp dy) +{ gs_point pt; + int code; + if ( (code = gs_distance_transform(dx, dy, &*(gs_matrix *)&(pgs)->ctm , &pt)) < 0 ) + return code; + pgs->ctm.tx += pt.x; + pgs->ctm.ty += pt.y; + (pgs->ctm). tx = ((float)(((pgs->ctm). tx_fixed = ((fixed)(((pgs->ctm). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (pgs->ctm). ty = ((float)(((pgs->ctm). ty_fixed = ((fixed)(((pgs->ctm). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , pgs->inverse_valid = 0, pgs->char_tm_valid = 0; + return 0; +} +int +gs_scale(gs_state *pgs, floatp sx, floatp sy) +{ pgs->ctm.xx *= sx; + pgs->ctm.xy *= sx; + pgs->ctm.yx *= sy; + pgs->ctm.yy *= sy; + pgs->inverse_valid = 0, pgs->char_tm_valid = 0; + return 0; +} +int +gs_rotate(gs_state *pgs, floatp ang) +{ int code = gs_matrix_rotate(&*(gs_matrix *)&(pgs)->ctm , ang, &*(gs_matrix *)&(pgs)->ctm ); + pgs->inverse_valid = 0, pgs->char_tm_valid = 0; + return code; +} +int +gs_concat(gs_state *pgs, const gs_matrix *pmat) +{ int code = gs_matrix_multiply(pmat, &*(gs_matrix *)&(pgs)->ctm , &*(gs_matrix *)&(pgs)->ctm ); + (pgs->ctm). tx = ((float)(((pgs->ctm). tx_fixed = ((fixed)(((pgs->ctm). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (pgs->ctm). ty = ((float)(((pgs->ctm). ty_fixed = ((fixed)(((pgs->ctm). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , pgs->inverse_valid = 0, pgs->char_tm_valid = 0; + return code; +} +int +gs_transform(gs_state *pgs, floatp x, floatp y, gs_point *pt) +{ return gs_point_transform(x, y, &*(gs_matrix *)&(pgs)->ctm , pt); +} +int +gs_dtransform(gs_state *pgs, floatp dx, floatp dy, gs_point *pt) +{ return gs_distance_transform(dx, dy, &*(gs_matrix *)&(pgs)->ctm , pt); +} +int +gs_itransform(gs_state *pgs, floatp x, floatp y, gs_point *pt) +{ + + if ( !!(((*(long *)(&((&pgs->ctm)->xy)) | *(long *)(&( (&pgs->ctm)->yx)) ) << 1) == 0) ) + { return gs_point_transform_inverse(x, y, &*(gs_matrix *)&(pgs)->ctm , pt); + } + else + { if ( !pgs->inverse_valid ) { int code = ctm_set_inverse(pgs); if ( code < 0 ) return code; }; + return gs_point_transform(x, y, &pgs->ctm_inverse, pt); + } +} +int +gs_idtransform(gs_state *pgs, floatp dx, floatp dy, gs_point *pt) +{ + + if ( !!(((*(long *)(&((&pgs->ctm)->xy)) | *(long *)(&( (&pgs->ctm)->yx)) ) << 1) == 0) ) + { return gs_distance_transform_inverse(dx, dy, + &*(gs_matrix *)&(pgs)->ctm , pt); + } + else + { if ( !pgs->inverse_valid ) { int code = ctm_set_inverse(pgs); if ( code < 0 ) return code; }; + return gs_distance_transform(dx, dy, &pgs->ctm_inverse, pt); + } +} +int +gs_translate_to_fixed(register gs_state *pgs, fixed px, fixed py) +{ pgs->ctm.tx = ((float)((pgs->ctm.tx_fixed = px)*(1.0/(1<<12 ) ))); + pgs->ctm.ty = ((float)((pgs->ctm.ty_fixed = py)*(1.0/(1<<12 ) ))); + pgs->inverse_valid = 0; + pgs->char_tm_valid = 1; + return 0; +} +int +gx_matrix_to_fixed_coeff(const gs_matrix *pmat, register fixed_coeff *pfc, + int max_bits) +{ gs_matrix ctm; + int scale = -10000; + int expt, shift; + ctm = *pmat; + pfc->skewed = 0; + if ( !((*(long *)(&(ctm.xx)) << 1) == 0) ) + { (void)frexp(ctm.xx, &scale); + } + if ( !((*(long *)(&(ctm.xy)) << 1) == 0) ) + { (void)frexp(ctm.xy, &expt); + if ( expt > scale ) scale = expt; + pfc->skewed = 1; + } + if ( !((*(long *)(&(ctm.yx)) << 1) == 0) ) + { (void)frexp(ctm.yx, &expt); + if ( expt > scale ) scale = expt; + pfc->skewed = 1; + } + if ( !((*(long *)(&(ctm.yy)) << 1) == 0) ) + { (void)frexp(ctm.yy, &expt); + if ( expt > scale ) scale = expt; + } + scale = sizeof(long) * 8 - 1 - max_bits - scale; + shift = scale - 12; + if ( shift > 0 ) + { pfc->shift = shift; + pfc->round = (fixed)1 << (shift - 1); + } + else + { pfc->shift = 0; + pfc->round = 0; + scale -= shift; + } + pfc->xx = (((*(long *)(&(ctm.xx)) << 1) == 0) ? 0 : (long)ldexp(ctm.xx, scale)); + pfc->yy = (((*(long *)(&(ctm.yy)) << 1) == 0) ? 0 : (long)ldexp(ctm.yy, scale)); + if ( pfc->skewed ) + { pfc->xy = (((*(long *)(&(ctm.xy)) << 1) == 0) ? 0 : (long)ldexp(ctm.xy, scale)); + pfc->yx = (((*(long *)(&(ctm.yx)) << 1) == 0) ? 0 : (long)ldexp(ctm.yx, scale)); + } + else + pfc->xy = pfc->yx = 0; + pfc->max_bits = max_bits; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-3.c b/gcc/testsuite/gcc.c-torture/compile/920428-3.c new file mode 100644 index 000000000..13640c98a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920428-3.c @@ -0,0 +1,5 @@ +#ifndef NO_LABEL_VALUES +x(a){static void*j[]={&&l1,&&l2};goto*j[a];l1:return 0;l2:return 1;} +#else +main(){ exit (0); } +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-4.c b/gcc/testsuite/gcc.c-torture/compile/920428-4.c new file mode 100644 index 000000000..cc5e30c2a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920428-4.c @@ -0,0 +1 @@ +x(a){struct{int p[a],i;}l;l.i;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-5.c b/gcc/testsuite/gcc.c-torture/compile/920428-5.c new file mode 100644 index 000000000..ff3137992 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920428-5.c @@ -0,0 +1 @@ +typedef struct{unsigned b0:1;}*t;x(a,b)t a,b;{b->b0=a->b0;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-6.c b/gcc/testsuite/gcc.c-torture/compile/920428-6.c new file mode 100644 index 000000000..e43af7ed3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920428-6.c @@ -0,0 +1,22 @@ +typedef struct x +{ + struct x *type; + struct x *chain; + struct x *value; +} *tree; + +int +func (new, old) + register tree new, old; +{ + if (old->type == 0 || new->type == 0) + { + register tree t = old->type; + if (t == 0) + t = new->type; + for (; t; t = t->chain ) + if (t->value) + return 1; + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-7.c b/gcc/testsuite/gcc.c-torture/compile/920428-7.c new file mode 100644 index 000000000..69b1d979a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920428-7.c @@ -0,0 +1 @@ +x(float*x){int a[4],i=0,j;for(j=0;j<2;j++){f(a[i++]);f(a[i++]);}} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-1.c b/gcc/testsuite/gcc.c-torture/compile/920501-1.c new file mode 100644 index 000000000..29e197341 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-1.c @@ -0,0 +1,5 @@ +#ifndef NO_LABEL_VALUES +a(){int**b[]={&&c};c:;} +#else +int x; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-10.c b/gcc/testsuite/gcc.c-torture/compile/920501-10.c new file mode 100644 index 000000000..ecb5bb415 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-10.c @@ -0,0 +1 @@ +x(y){return 8193*y;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-11.c b/gcc/testsuite/gcc.c-torture/compile/920501-11.c new file mode 100644 index 000000000..d636357e8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-11.c @@ -0,0 +1 @@ +typedef struct{int s;}S;foo(){int i=(int)&(S){(void*)((int)&(S){1})};} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-12.c b/gcc/testsuite/gcc.c-torture/compile/920501-12.c new file mode 100644 index 000000000..7eac97246 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-12.c @@ -0,0 +1,10 @@ +/* This test fails on HC11/HC12 when it is compiled without -mshort because + the stack arrays are too large. Force to use 16-bit ints for it. */ +/* { dg-do assemble } */ +/* { dg-xfail-if "" { m6811-*-* m6812-*-* } { "*" } { "-mshort" } } */ + +x(x){ return 3 + x;} +a(x){int y[994]; return 3 + x;} +b(x){int y[999]; return 2*(x + 3);} +A(x){int y[9999];return 2*(x + 3);} +B(x){int y[9949];return 3 + x;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-13.c b/gcc/testsuite/gcc.c-torture/compile/920501-13.c new file mode 100644 index 000000000..b5a6798ec --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-13.c @@ -0,0 +1 @@ +typedef struct{int i;}t;inline y(t u){}x(){t u;y(u);} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-15.c b/gcc/testsuite/gcc.c-torture/compile/920501-15.c new file mode 100644 index 000000000..81fd66401 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-15.c @@ -0,0 +1 @@ +x(a)double a;{int i;return i>a?i:i+1;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-16.c b/gcc/testsuite/gcc.c-torture/compile/920501-16.c new file mode 100644 index 000000000..f82b7524b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-16.c @@ -0,0 +1 @@ +f(n){struct z{int a,b[n],c[n];};} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-17.c b/gcc/testsuite/gcc.c-torture/compile/920501-17.c new file mode 100644 index 000000000..05a4d408d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-17.c @@ -0,0 +1 @@ +x(){static const char x[]="x";char y[2];y[0]=x[1];} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-18.c b/gcc/testsuite/gcc.c-torture/compile/920501-18.c new file mode 100644 index 000000000..70f7c0af5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-18.c @@ -0,0 +1,2 @@ +union u{int i;float f;}; +x(p)int p;{union u x;for(x.i=0;x.i(float)3.0)break;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-19.c b/gcc/testsuite/gcc.c-torture/compile/920501-19.c new file mode 100644 index 000000000..1671cc37e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-19.c @@ -0,0 +1 @@ +long long x=0;y(){x=0;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-2.c b/gcc/testsuite/gcc.c-torture/compile/920501-2.c new file mode 100644 index 000000000..905f5ddb6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-2.c @@ -0,0 +1,11 @@ +extern short distdata[64][64], taxidata[64][64]; +extern short PieceList[2][64]; + +int +ScoreKBNK (short int winner, short int king1, short int king2) +{ + register short s; + + s = taxidata[king1][king2] + distdata[PieceList[winner][1]][king2]; + return s; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-20.c b/gcc/testsuite/gcc.c-torture/compile/920501-20.c new file mode 100644 index 000000000..170d05017 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-20.c @@ -0,0 +1 @@ +int*f(x)int*x;{if(x[4]){int h[1];if(setjmp(h))return x;}} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-21.c b/gcc/testsuite/gcc.c-torture/compile/920501-21.c new file mode 100644 index 000000000..4a9f05a1b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-21.c @@ -0,0 +1,3 @@ +typedef unsigned short t; +struct foo{t d;}; +int bar(d)t d;{struct foo u;u.d=d;return(int)(&u);} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-22.c b/gcc/testsuite/gcc.c-torture/compile/920501-22.c new file mode 100644 index 000000000..b15d7984b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-22.c @@ -0,0 +1 @@ +x(){int y[]={};} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-23.c b/gcc/testsuite/gcc.c-torture/compile/920501-23.c new file mode 100644 index 000000000..291d93e6c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-23.c @@ -0,0 +1,16 @@ +typedef unsigned char qi; +typedef unsigned short hi; +typedef unsigned long si; +typedef unsigned long long di; +subi(a){return 100-a;} +add(a,b){return a+b;} +mul(a){return 85*a;} +memshift(p)unsigned*p;{unsigned x;for(;;){x=*p++>>16;if(x)return x;}} +ldw(xp)si*xp;{return xp[4];} +ldws_m(xp)si*xp;{si x;do{x=xp[3];xp+=3;}while(x);} +postinc_si(p)si*p;{si x;for(;;){x=*p++;if(x)return x;}} +preinc_si(p)si*p;{si x;for(;;){x=*++p;if(x)return x;}} +postinc_di(p)di*p;{di x;for(;;){x=*p++;if(x)return x;}} +preinc_di(p)di*p;{di x;for(;;){x=*++p;if(x)return x;}} +inc_overlap(p,a)di*p;{do{p=*(di**)p;p=(di*)((int)p+4);}while(*p);} +di move_di(p,p2)di*p,*p2;{di x=p;p2=((di*)x)[1];return p2[1];} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-3.c b/gcc/testsuite/gcc.c-torture/compile/920501-3.c new file mode 100644 index 000000000..41ef87fbf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-3.c @@ -0,0 +1,2 @@ +struct{long long x:24,y:40;}v; +x(){v.y=0;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-4.c b/gcc/testsuite/gcc.c-torture/compile/920501-4.c new file mode 100644 index 000000000..3481deefe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-4.c @@ -0,0 +1,54 @@ +/* This test fails on HC11/HC12 when it is compiled without -mshort because + the 'r0' array is too large. Force to use 16-bit ints for it. */ +/* { dg-do assemble } */ +/* { dg-xfail-if "" { m6811-*-* m6812-*-* } { "*" } { "-mshort" } } */ + +foo () +{ + int r0[8186 ]; + int r1[2 ]; + int r2[2 ]; + int bitm0[2 ]; + int bitm1[2 ]; + int bitm2[2 ]; + + int i,j,k,m,n,m_max; + int f; + double fm,ft; + + while (1) { + + if (m%4 == 2) + ++m; + + if (m_max != 0 && m > m_max) + break; + + fm=m; + + r0[k=1]=0; + bitm0[0] = 0; + + while ( n%f == 0 ) { + while ( (ft != 0) && (ft < fm )) { + bitm1[i] = 0; + r1[i]=0; + } + + while ( r0[i] != 0 && r1[i] != 0 ) { + if ( r0[i] < r1[i] ) { + bitm2[k] = bitm0[i]; + r2[k++]=0; + } + else if ( r0[i] > r1[j] ) { + bitm2[k] = bitm1[j]; + r2[k++]=r1[j++]; + } + else { + bitm1[k] = bitm0[i]; + r2[k++]=r0[i++]; + } + } + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-6.c b/gcc/testsuite/gcc.c-torture/compile/920501-6.c new file mode 100644 index 000000000..d0a406381 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-6.c @@ -0,0 +1 @@ +x(y,z)float*y;{*y=z;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-7.c b/gcc/testsuite/gcc.c-torture/compile/920501-7.c new file mode 100644 index 000000000..aed88045e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-7.c @@ -0,0 +1,5 @@ +#ifndef NO_LABEL_VALUES +x(){if(&&e-&&b<0)x();b:goto*&&b;e:;} +#else +int x; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-8.c b/gcc/testsuite/gcc.c-torture/compile/920501-8.c new file mode 100644 index 000000000..68e33934d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-8.c @@ -0,0 +1 @@ +x(int*p){int x=p;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-9.c b/gcc/testsuite/gcc.c-torture/compile/920501-9.c new file mode 100644 index 000000000..98a06000b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-9.c @@ -0,0 +1 @@ +short x(a)unsigned a;{a=32987799;return a;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920502-1.c b/gcc/testsuite/gcc.c-torture/compile/920502-1.c new file mode 100644 index 000000000..b576c6c99 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920502-1.c @@ -0,0 +1 @@ +extern void*t[];x(i){goto*t[i];} diff --git a/gcc/testsuite/gcc.c-torture/compile/920502-2.c b/gcc/testsuite/gcc.c-torture/compile/920502-2.c new file mode 100644 index 000000000..d3aa1e26d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920502-2.c @@ -0,0 +1 @@ +x(c){1LL<= 0; j = j - 1) + { + acc = (acc << 16) | a[j]; + acc = acc % *b; + } + + return; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920608-1.c b/gcc/testsuite/gcc.c-torture/compile/920608-1.c new file mode 100644 index 000000000..cae1978e6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920608-1.c @@ -0,0 +1,25 @@ +foo (p) + int *p; +{ + int x; + int a; + + a = p[0]; + x = a + 5; + a = -1; + p[0] = x - 5; + return a; +} + +bar (p) +{ + short x; + int a; + + x = ((short *) p)[1]; +#if INHIBIT_COMBINE + ((short *) p)[0] = x; +#endif + + return (x < 45); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920611-2.c b/gcc/testsuite/gcc.c-torture/compile/920611-2.c new file mode 100644 index 000000000..e54b1cda5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920611-2.c @@ -0,0 +1,53 @@ +typedef unsigned char uchar; +typedef unsigned short ushort; +typedef unsigned int uint; +typedef unsigned long ulong; + +static unsigned long S[1][1]={0x00820200}; + +static int body(out0,out1,ks,Eswap0,Eswap1) +ulong *out0,*out1; +int *ks; +ulong Eswap0,Eswap1; +{ + register unsigned long l,r,t,u,v; + register unsigned long *s; + register int i,j; + register unsigned long E0,E1; + + l=0; + r=0; + + s=(ulong *)ks; + E0=Eswap0; + E1=Eswap1; + + for (i=0; i<(16 *2); i+=4) + { + v=(r^(r>>16)); + u=(v&E0); + v=(v&E1); + u=(u^(u<<16))^r^s[ i ]; + t=(v^(v<<16))^r^s[ i+1]; + t=(t>>4)|(t<<28); + l^=S[1][(t)&0x3f]| S[3][(t>> 8)&0x3f]| S[5][(t>>16)&0x3f]| S[7][(t>>24)&0x3f]| S[0][(u)&0x3f]| S[2][(u>> 8)&0x3f]| S[4][(u>>16)&0x3f]| S[6][(u>>24)&0x3f]; + v=(l^(l>>16)); + u=(v&E0); + v=(v&E1); + u=(u^(u<<16))^l^s[ i+2 ]; + t=(v^(v<<16))^l^s[ i+2+1]; + t=(t>>4)|(t<<28); + r^= S[1][(t )&0x3f]; + } + t=l; + l=r; + r=t; + + t=r; + r=(l>>1)|(l<<31); + l=(t>>1)|(t<<31); + + *out0=l; + *out1=r; + return(0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920615-1.c b/gcc/testsuite/gcc.c-torture/compile/920615-1.c new file mode 100644 index 000000000..9b1c6acee --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920615-1.c @@ -0,0 +1,4 @@ +f() +{ + int x[20] = {[0] = 5, [10] = 12}; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920617-1.c b/gcc/testsuite/gcc.c-torture/compile/920617-1.c new file mode 100644 index 000000000..2d84e8d84 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920617-1.c @@ -0,0 +1 @@ +f(){double*xp,y;*xp++=sqrt(y);} diff --git a/gcc/testsuite/gcc.c-torture/compile/920617-2.c b/gcc/testsuite/gcc.c-torture/compile/920617-2.c new file mode 100644 index 000000000..3a5450982 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920617-2.c @@ -0,0 +1 @@ +f(a,b,c,d)float a[],d;int b[],c;{} diff --git a/gcc/testsuite/gcc.c-torture/compile/920623-1.c b/gcc/testsuite/gcc.c-torture/compile/920623-1.c new file mode 100644 index 000000000..9b6ad51e1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920623-1.c @@ -0,0 +1,2 @@ +int f(int c){return f(c--);} +g(){} diff --git a/gcc/testsuite/gcc.c-torture/compile/920624-1.c b/gcc/testsuite/gcc.c-torture/compile/920624-1.c new file mode 100644 index 000000000..8b4d2979d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920624-1.c @@ -0,0 +1,2 @@ +int B[],Q[]; +f(){int s;for(s=0;s<=1;s++)switch(s){case 2:case 3:++B[s];case 4:case 5:++Q[s];}} diff --git a/gcc/testsuite/gcc.c-torture/compile/920625-1.c b/gcc/testsuite/gcc.c-torture/compile/920625-1.c new file mode 100644 index 000000000..720d43fd4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920625-1.c @@ -0,0 +1,279 @@ +typedef unsigned long int unsigned_word; +typedef signed long int signed_word; +typedef unsigned_word word; + +typedef enum { ADD, ADD_CI, ADD_CO, ADD_CIO, SUB, SUB_CI, SUB_CO, +SUB_CIO, ADC_CI, ADC_CO, ADC_CIO, AND, IOR, XOR, ANDC, IORC, EQV, +NAND, NOR, AND_RC, IOR_RC, XOR_RC, ANDC_RC, IORC_RC, EQV_RC, NAND_RC, +NOR_RC, AND_CC, IOR_CC, XOR_CC, ANDC_CC, IORC_CC, EQV_CC, NAND_CC, +NOR_CC, LSHIFTR, ASHIFTR, SHIFTL, LSHIFTR_CO, ASHIFTR_CO, SHIFTL_CO, +ROTATEL, ROTATEL_CO, ROTATEXL_CIO, ASHIFTR_CON, EXTS1, EXTS2, EXTU1, +EXTU2, CLZ, CTZ, FF1, FF0, ABSVAL, NABSVAL, CMP, CPEQ, CPGE, CPGEU, +CPGT, CPGTU, CPLE, CPLEU, CPLT, CPLTU, CPNEQ, CMPPAR, DOZ, COPY, +EXCHANGE, COMCY, } opcode_t; + +typedef struct +{ + opcode_t opcode:8; + unsigned int s1:8; + unsigned int s2:8; + unsigned int d:8; +} insn_t; + +enum prune_flags +{ + NO_PRUNE = 0, + CY_0 = 1, + CY_1 = 2, + CY_JUST_SET = 4, +}; + +int flag_use_carry = 1; + +inline +recurse(opcode_t opcode, + int d, + int s1, + int s2, + word v, + int cost, + insn_t *sequence, + int n_insns, + word *values, + int n_values, + const word goal_value, + int allowed_cost, + int cy, + int prune_flags) +{ + insn_t insn; + + allowed_cost -= cost; + + if (allowed_cost > 0) + { + word old_d; + + old_d = values[d]; + values[d] = v; + + insn.opcode = opcode; + insn.s1 = s1; + insn.s2 = s2; + insn.d = d; + sequence[n_insns] = insn; + + synth(sequence, n_insns + 1, values, n_values, + goal_value, allowed_cost, cy, prune_flags); + + values[d] = old_d; + } + else if (goal_value == v) + { + insn.opcode = opcode; + insn.s1 = s1; + insn.s2 = s2; + insn.d = d; + sequence[n_insns] = insn; + test_sequence(sequence, n_insns + 1); + } +} + +synth(insn_t *sequence, + int n_insns, + word *values, + int n_values, + word goal_value, + int allowed_cost, + int ci, + int prune_hint) +{ + int s1, s2; + word v, r1, r2; + int co; + int last_dest; + + if (n_insns > 0) + last_dest = sequence[n_insns - 1].d; + else + last_dest = -1; + if (ci >= 0 && flag_use_carry) + { + for (s1 = n_values - 1; s1 >= 0; s1--) + { + r1 = values[s1]; + for (s2 = s1 - 1; s2 >= 0; s2--) + { + r2 = values[s2]; + + if (allowed_cost <= 1 && (prune_hint & CY_JUST_SET) == 0) + { + if (last_dest >= 0 && s1 != last_dest && s2 != last_dest) + continue; + } + do { word __d = ( r1) + ( r2) + (( ci)); ( co) = ( ci) ? __d <= ( r1) : __d < ( r1); (v) = __d; } while (0); + recurse(ADD_CIO, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + do { word __d = ( r1) + ( r2) + (( ci)); ( co) = ( ci); (v) = __d; } while (0); + recurse(ADD_CI, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + do { word __d = ( r1) - ( r2) - (( ci)); ( co) = ( ci) ? __d >= ( r1) : __d > ( r1); (v) = __d; } while (0); + recurse(SUB_CIO, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + do { word __d = ( r2) - ( r1) - (( ci)); ( co) = ( ci) ? __d >= ( r2) : __d > ( r2); (v) = __d; } while (0); + recurse(SUB_CIO, n_values, s2, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + + do { word __d = ( r1) - ( r2) - (( ci)); ( co) = ( ci); (v) = __d; } while (0); + recurse(SUB_CI, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + do { word __d = ( r2) - ( r1) - (( ci)); ( co) = ( ci); (v) = __d; } while (0); + recurse(SUB_CI, n_values, s2, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + } + } + } + for (s1 = n_values - 1; s1 >= 0; s1--) + { + r1 = values[s1]; + for (s2 = s1 - 1; s2 >= 0; s2--) + { + r2 = values[s2]; + + if (allowed_cost <= 1) + { + if (last_dest >= 0 && s1 != last_dest && s2 != last_dest) + continue; + } + + do { word __d = ( r1) + ( r2); ( co) = __d < ( r1); (v) = __d; } while (0); + recurse(ADD_CO, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + + ((v) = ( r1) + ( r2), ( co) = ( ci)); + recurse(ADD, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + do { word __d = ( r1) - ( r2); ( co) = __d > ( r1); (v) = __d; } while (0); + recurse(SUB_CO, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + do { word __d = ( r2) - ( r1); ( co) = __d > ( r2); (v) = __d; } while (0); + recurse(SUB_CO, n_values, s2, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + ((v) = ( r1) - ( r2), ( co) = ( ci)); + recurse(SUB, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ( r2) - ( r1), ( co) = ( ci)); + recurse(SUB, n_values, s2, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + ((v) = ( r1) & ( r2), ( co) = ( ci)); + recurse(AND, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + ((v) = ( r1) | ( r2), ( co) = ( ci)); + recurse(IOR, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + ((v) = ( r1) ^ ( r2), ( co) = ( ci)); + recurse(XOR, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + ((v) = ( r1) & ~( r2), ( co) = ( ci)); + recurse(ANDC, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ( r2) & ~( r1), ( co) = ( ci)); + recurse(ANDC, n_values, s2, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ( r1) | ~( r2), ( co) = ( ci)); + recurse(IORC, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ( r2) | ~( r1), ( co) = ( ci)); + recurse(IORC, n_values, s2, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ( r1) ^ ~( r2), ( co) = ( ci)); + recurse(EQV, n_values, s1, s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + } + } + if (ci >= 0 && flag_use_carry) + { + for (s1 = n_values - 1; s1 >= 0; s1--) + { + r1 = values[s1]; + + if (allowed_cost <= 1 && (prune_hint & CY_JUST_SET) == 0) + { + + if (last_dest >= 0 && s1 != last_dest) + continue; + } + + do { word __d = ( r1) + ( r1) + (( ci)); ( co) = ( ci) ? __d <= ( r1) : __d < ( r1); (v) = __d; } while (0); + recurse(ADD_CIO, n_values, s1, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + + do { word __d = ( r1) + ( r1) + (( ci)); ( co) = ( ci); (v) = __d; } while (0); + recurse(ADD_CI, n_values, s1, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + do { word __d = ( r1) + ( -1 ) + (( ci)); ( co) = ( ci) ? __d <= ( r1) : __d < ( r1); (v) = __d; } while (0); + recurse(ADD_CIO, n_values, s1, (0x20 + -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + + do { word __d = ( r1) + ( 0 ) + (( ci)); ( co) = ( ci) ? __d <= ( r1) : __d < ( r1); (v) = __d; } while (0); + recurse(ADD_CIO, n_values, s1, (0x20 + 0) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + do { word __d = ( 0 ) - ( r1) - (( ci)); ( co) = ( ci) ? __d >= ( 0 ) : __d > ( 0 ); (v) = __d; } while (0); + recurse(SUB_CIO, n_values, (0x20 + 0) , s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + + } + } + for (s1 = n_values - 1; s1 >= 0; s1--) + { + r1 = values[s1]; + + if (allowed_cost <= 1) + { + if (last_dest >= 0 && s1 != last_dest) + continue; + } + do { word __d = ( r1) + ( r1); ( co) = __d < ( r1); (v) = __d; } while (0); + recurse(ADD_CO, n_values, s1, s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + + ((v) = ( r1) & ( 1 ), ( co) = ( ci)); + recurse(AND, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + ((v) = ( r1) ^ ( 1 ), ( co) = ( ci)); + recurse(XOR, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + ((v) = ( -1 ) - ( r1), ( co) = ( ci)); + recurse(SUB, n_values, (0x20 + -1) , s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + do { word __d = ( r1) + ( 1 ); ( co) = __d < ( r1); (v) = __d; } while (0); + recurse(ADD_CO, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + ((v) = ( r1) + ( 1 ), ( co) = ( ci)); + recurse(ADD, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + do { word __d = ( r1) + ( -1 ); ( co) = __d < ( r1); (v) = __d; } while (0); + recurse(ADD_CO, n_values, s1, (0x20 + -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + do { word __d = ( r1) - ( 1 ); ( co) = __d > ( r1); (v) = __d; } while (0); + recurse(SUB_CO, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + do { word __d = ( 0 ) - ( r1); ( co) = __d > ( 0 ); (v) = __d; } while (0); + recurse(SUB_CO, n_values, (0x20 + 0) , s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET); + ((v) = ( 0 ) - ( r1), ( co) = ( ci)); + recurse(SUB, n_values, (0x20 + 0) , s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ((unsigned_word) ( r1) >> (( 1 ) & (32 - 1)) ), ( co) = ( ci)); + recurse(LSHIFTR, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ((signed_word) ( r1) >> (( 1 ) & (32 - 1)) ), ( co) = ( ci)); + recurse(ASHIFTR, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ((signed_word) ( r1) << (( 1 ) & (32 - 1)) ), ( co) = ( ci)); + recurse(SHIFTL, n_values, s1, (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ((unsigned_word) ( r1) >> (( 32 -1 ) & (32 - 1)) ), ( co) = ( ci)); + recurse(LSHIFTR, n_values, s1, (0x20 + 32 -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + ((v) = ((signed_word) ( r1) >> (( 32 -1 ) & (32 - 1)) ), ( co) = ( ci)); + recurse(ASHIFTR, n_values, s1, (0x20 + 32 -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + } + if (ci >= 0 && flag_use_carry + && (allowed_cost <= 1 ? ((prune_hint & CY_JUST_SET) != 0) : 1)) + { + do { word __d = ( 0 ) + ( 0 ) + (( ci)); ( co) = ( ci) ? __d <= ( 0 ) : __d < ( 0 ); (v) = __d; } while (0); + recurse(ADD_CIO, n_values, (0x20 + 0) , (0x20 + 0) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET | CY_0); + do { word __d = ( 0 ) - ( 0 ) - (( ci)); ( co) = ( ci) ? __d >= ( 0 ) : __d > ( 0 ); (v) = __d; } while (0); + recurse(SUB_CIO, n_values, (0x20 + 0) , (0x20 + 0) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + do { word __d = ( 0 ) - ( -1 ) - (( ci)); ( co) = ( ci) ? __d >= ( 0 ) : __d > ( 0 ); (v) = __d; } while (0); + recurse(SUB_CIO, n_values, (0x20 + 0) , (0x20 + -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, CY_JUST_SET | CY_1); + do { word __d = ( 0 ) + ( -1 ) + (( ci)); ( co) = ( ci) ? __d <= ( 0 ) : __d < ( 0 ); (v) = __d; } while (0); + recurse(ADD_CIO, n_values, (0x20 + 0) , (0x20 + -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + } + + if (allowed_cost > 1) + { + ((v) = ( 0x80000000 ), ( co) = ( ci)); + recurse(COPY, n_values, (0x20 - 2) , 0, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + ((v) = ( -1 ), ( co) = ( ci)); + recurse(COPY, n_values, (0x20 + -1) , 0, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + + ((v) = ( 1 ), ( co) = ( ci)); + recurse(COPY, n_values, (0x20 + 1) , 0, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co, prune_hint & ~CY_JUST_SET); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920625-2.c b/gcc/testsuite/gcc.c-torture/compile/920625-2.c new file mode 100644 index 000000000..291e80d02 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920625-2.c @@ -0,0 +1,103 @@ +typedef char * caddr_t; +typedef unsigned Cursor; +typedef char *String; +typedef struct _WidgetRec *Widget; +typedef char Boolean; +typedef unsigned int Cardinal; +typedef struct _XedwListReturnStruct { + String string; + int xedwList_index; + struct _XedwListReturnStruct *next; +} XedwListReturnStruct; +static XedwListReturnStruct *return_list; +static String srcdir, dstdir; +char *strcpy(); + extern void setCursor(Cursor); + extern void query_dialog(String, Boolean); + extern Boolean directoryManagerNewDirectory(String); +trashQueryResult(Widget w, Boolean delete, caddr_t call_data) +{ + int execute(String, String, String, Boolean); + extern void destroy_button_dialog(void); + extern void changestate(Boolean); + + extern Cursor busy, left_ptr; + extern String cwd; + extern void freeReturnStruct(void); + String rmstring; + int status; + XedwListReturnStruct *tmp; + setCursor(busy); + destroy_button_dialog(); + if (delete == 1) { + rmstring = (("rm -fr") != ((void *)0) ? (strcpy((char*)XtMalloc((unsigned)strlen("rm -fr") + 1), "rm -fr")) : ((void *)0)); + tmp = return_list; + while (tmp != ((void *)0)) { + rmstring = (String) XtRealloc (rmstring, sizeof(char) * + (strlen(rmstring) + + strlen(tmp->string) + 5)); + sprintf(rmstring, "%s '%s'", rmstring, tmp->string); + tmp = tmp->next; + } + if ((status = execute(((void *)0), "rm", rmstring, 1)) != 0) { + XBell(XtDisplay(w), 100); + query_dialog("Can't remove file", 0); + } + XtFree(rmstring); + + directoryManagerNewDirectory(cwd); + } else { + changestate(1); + } + setCursor(left_ptr); + freeReturnStruct(); +} + +copyQueryResult(Widget w, Boolean copy, caddr_t call_data) +{ + extern void destroy_button_dialog(); + extern void changestate(Boolean); + extern Cursor busy, left_ptr; + extern void freeReturnStruct(void); + int execute(String, String, String, Boolean); + extern String cwd; + String copystring; + int status; + Cardinal srclen, dstlen; + XedwListReturnStruct *tmp; + destroy_button_dialog(); + setCursor(busy); + if (copy == 1) { + srclen = strlen(srcdir); + dstlen = strlen(dstdir); + copystring = (("cp -r") != ((void *)0) ? (strcpy((char*)XtMalloc((unsigned)strlen("cp -r") + 1), "cp -r")) : ((void *)0)); + tmp = return_list; + while (tmp != ((void *)0)) { + copystring = (String) XtRealloc (copystring, sizeof(char) * + (strlen(copystring) + + strlen(tmp->string) + + srclen + 6)); + sprintf(copystring, "%s '%s/%s'", copystring, srcdir, tmp->string); + tmp = tmp->next; + } + copystring = (String) XtRealloc (copystring, sizeof(char) * + (strlen(copystring) + + dstlen + 5)); + sprintf(copystring, "%s '%s'", copystring, dstdir); + if ((status = execute(((void *)0), "cp", copystring, 1)) != 0) { + XBell(XtDisplay(w), 100); + query_dialog("Can't copy file!", 0); + } + XtFree(copystring); + + directoryManagerNewDirectory(cwd); + } else { + changestate(1); + } + XtFree(srcdir); + XtFree(dstdir); + setCursor(left_ptr); + freeReturnStruct(); +} + +freeReturnStruct(){} diff --git a/gcc/testsuite/gcc.c-torture/compile/920626-1.c b/gcc/testsuite/gcc.c-torture/compile/920626-1.c new file mode 100644 index 000000000..54419866a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920626-1.c @@ -0,0 +1 @@ +f(x)unsigned x;{return x>>-5;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920701-1.c b/gcc/testsuite/gcc.c-torture/compile/920701-1.c new file mode 100644 index 000000000..4302f9ea3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920701-1.c @@ -0,0 +1 @@ +f(char*c){extern char a[],b[];return a+(b-c);} diff --git a/gcc/testsuite/gcc.c-torture/compile/920702-1.c b/gcc/testsuite/gcc.c-torture/compile/920702-1.c new file mode 100644 index 000000000..23a5395b0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920702-1.c @@ -0,0 +1,10 @@ +int somevar; +void +yylex () +{ + register int result = 0; + int num_bits = -1; + + if (((result >> -1) & 1)) + somevar = 99; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920706-1.c b/gcc/testsuite/gcc.c-torture/compile/920706-1.c new file mode 100644 index 000000000..13b0ff1e0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920706-1.c @@ -0,0 +1 @@ +f(){float i[2],o[1];g(o);return*o;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920710-2.c b/gcc/testsuite/gcc.c-torture/compile/920710-2.c new file mode 100644 index 000000000..dcaf1bea3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920710-2.c @@ -0,0 +1,36 @@ +union u +{ + struct {unsigned h, l;} i; + double d; +}; + +foo (union u x) +{ + while (x.i.h++) + { + while (x.i.l-- > 0) + ; + while (x.d++ > 0) + ; + } +} + +union n +{ + long long unsigned i; + double d; +}; + +bar (union n x) +{ + int i; + for (i = 0; i < 100; i++) + { + while (--x.i > 0) + ; + while (++x.d > 0) + ; + } + return x.i; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/920711-1.c b/gcc/testsuite/gcc.c-torture/compile/920711-1.c new file mode 100644 index 000000000..a5aa7df11 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920711-1.c @@ -0,0 +1 @@ +f(a){a=(1,1)/2;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920721-1.c b/gcc/testsuite/gcc.c-torture/compile/920721-1.c new file mode 100644 index 000000000..7ced611eb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920721-1.c @@ -0,0 +1,11 @@ +typedef struct{short ttype;float s;}T; +short t[8][8]; + +T f(T t2,T t1) +{ + T x; + if (t1.ttype == 1) + x.ttype = t[t2.ttype][t1.ttype], + x.s = 1; + return x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920723-1.c b/gcc/testsuite/gcc.c-torture/compile/920723-1.c new file mode 100644 index 000000000..d8734a679 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920723-1.c @@ -0,0 +1,31 @@ +#if defined(STACK_SIZE) && STACK_SIZE < 65536 +# define GITT_SIZE 75 +#endif + +#ifndef GITT_SIZE +# define GITT_SIZE 150 +#endif + +typedef struct { + double x, y; +} vector_t; +double sqrt(); +f(int count,vector_t*pos,double r,double *rho) +{ + int i, j, miny, maxy, hy; + float help, d; + int gitt[GITT_SIZE][GITT_SIZE]; + int *data = (int *)malloc(count*sizeof(int)); + for (i = 0; i < count; i++) + rho[i] = 0; + for (i = 1; i < count; i++) + for (hy = miny; hy<= maxy; hy++) + while(j >=0) { + d = pos[i].y - pos[j].y; + if ( d <= r) { + d = sqrt(d); + rho[i] += help; + } + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/920729-1.c b/gcc/testsuite/gcc.c-torture/compile/920729-1.c new file mode 100644 index 000000000..de00be5af --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920729-1.c @@ -0,0 +1,2 @@ +extern volatile int i; +f(){int j;for(;;)j = i;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920806-1.c b/gcc/testsuite/gcc.c-torture/compile/920806-1.c new file mode 100644 index 000000000..0928fe8a7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920806-1.c @@ -0,0 +1 @@ +f(){short x=32000;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920808-1.c b/gcc/testsuite/gcc.c-torture/compile/920808-1.c new file mode 100644 index 000000000..17510a968 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920808-1.c @@ -0,0 +1 @@ +f(i){for(i=1;i<=2;({;}),i++){({;}),g();}} diff --git a/gcc/testsuite/gcc.c-torture/compile/920809-1.c b/gcc/testsuite/gcc.c-torture/compile/920809-1.c new file mode 100644 index 000000000..ad35e1210 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920809-1.c @@ -0,0 +1 @@ +f(x,y){memcpy (&x,&y,8192);} diff --git a/gcc/testsuite/gcc.c-torture/compile/920817-1.c b/gcc/testsuite/gcc.c-torture/compile/920817-1.c new file mode 100644 index 000000000..31a57339e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920817-1.c @@ -0,0 +1 @@ +int v;static inline f(){return 0;}g(){return f();}void h(){return v++;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920820-1.c b/gcc/testsuite/gcc.c-torture/compile/920820-1.c new file mode 100644 index 000000000..2bc0dbea0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920820-1.c @@ -0,0 +1 @@ +long long f(double y){return y;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920821-1.c b/gcc/testsuite/gcc.c-torture/compile/920821-1.c new file mode 100644 index 000000000..40a8c178f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920821-1.c @@ -0,0 +1 @@ +/* empty */ diff --git a/gcc/testsuite/gcc.c-torture/compile/920821-2.c b/gcc/testsuite/gcc.c-torture/compile/920821-2.c new file mode 100644 index 000000000..a69c0a901 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920821-2.c @@ -0,0 +1,4 @@ +typedef struct{int p[25];}t1; +struct{t1 x,y;}y; +t1 x[1]; +f(){y.x=*x;y.y=*x;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920825-1.c b/gcc/testsuite/gcc.c-torture/compile/920825-1.c new file mode 100644 index 000000000..514d63f97 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920825-1.c @@ -0,0 +1,3 @@ +#pragma pack(1) +struct{unsigned short f1:5;unsigned short f2:6;}x; +f(){x.f2=1;} diff --git a/gcc/testsuite/gcc.c-torture/compile/920825-2.c b/gcc/testsuite/gcc.c-torture/compile/920825-2.c new file mode 100644 index 000000000..9834aac17 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920825-2.c @@ -0,0 +1,3 @@ +f(double*a,int m){int j;for(j=0;ji->d+(fx+w+x)/8+(fy+h+y)*p->i->b)&(1<<((fx+w+x)%8)))?1:0)); + q2=((int)((*(p->i->d+(fx+w+y)/8+(fy+h-s-x)*p->i->b)&(1<<((fx+w+y)%8)))?1:0)); + q3=((int)((*(p->i->d+(fx+w-s-x)/8+(fy+h-s-y)*p->i->b)&(1<<((fx+w-s-x)%8)))?1:0)); + q4=((int)((*(p->i->d+(fx+w-s-y)/8+(fy+h+x)*p->i->b)&(1<<((fx+w-s-y)%8)))?1:0)); + if(q4!=q1) + ff(p,fx+w-s-y,fy+h+x); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920928-3.c b/gcc/testsuite/gcc.c-torture/compile/920928-3.c new file mode 100644 index 000000000..583dc69b7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920928-3.c @@ -0,0 +1,19 @@ +f (int phaseone) +{ + typedef struct + { + unsigned char *p; + } + FILE; + FILE b[2]; + static unsigned char xchr[2]; + int j; + int for_end; + if (phaseone) + { + if (j <= for_end) + do + *(b[1].p) = xchr[j]; + while (j++ < 10); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/920928-4.c b/gcc/testsuite/gcc.c-torture/compile/920928-4.c new file mode 100644 index 000000000..348de654f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920928-4.c @@ -0,0 +1,113 @@ +typedef unsigned char unsigned8; +typedef unsigned short int unsigned16; +typedef unsigned long int unsigned32; +typedef char signed8; +typedef short int signed16; +typedef long int signed32; +typedef unsigned32 boolean32; +typedef unsigned long int error_status_t; +typedef struct { + unsigned32 time_low; + unsigned16 time_mid; + unsigned16 time_hi_and_version; + unsigned8 clock_seq_hi_and_reserved; + unsigned8 clock_seq_low; + unsigned char node[6]; +} uuid_t; + +typedef unsigned32 bitset; +typedef signed32 sec_timeval_sec_t; +typedef struct { + signed32 sec; + signed32 usec; +} sec_timeval_t; +typedef signed32 sec_timeval_period_t; +typedef signed32 sec_rgy_acct_key_t; + +typedef struct { + uuid_t source; + signed32 handle; + boolean32 valid; +} sec_rgy_cursor_t; +typedef unsigned char sec_rgy_pname_t[257]; +typedef unsigned char sec_rgy_name_t[1025]; + +typedef signed32 sec_rgy_override_t; +typedef signed32 sec_rgy_mode_resolve_t; +typedef unsigned char sec_rgy_unix_gecos_t[292]; +typedef unsigned char sec_rgy_unix_login_name_t[1025]; +typedef unsigned char sec_rgy_member_t[1025]; +typedef unsigned char sec_rgy_unix_passwd_buf_t[16]; +typedef struct sec_rgy_sid_t { + uuid_t person; + uuid_t group; + uuid_t org; +} sec_rgy_sid_t; +typedef struct { + signed32 person; + signed32 group; + signed32 org; +} sec_rgy_unix_sid_t; +typedef struct { + sec_rgy_unix_login_name_t name; + sec_rgy_unix_passwd_buf_t passwd; + signed32 uid; + signed32 gid; + signed32 oid; + sec_rgy_unix_gecos_t gecos; + sec_rgy_pname_t homedir; + sec_rgy_pname_t shell; +} sec_rgy_unix_passwd_t; +typedef unsigned char sec_rgy_member_buf_t[10250]; +typedef struct { + sec_rgy_name_t name; + signed32 gid; + sec_rgy_member_buf_t members; +} sec_rgy_unix_group_t; + +typedef struct { + uuid_t site_id; + sec_timeval_sec_t person_dtm; + sec_timeval_sec_t group_dtm; + sec_timeval_sec_t org_dtm; +} rs_cache_data_t; + +typedef enum { + rs_unix_query_name, + rs_unix_query_unix_num, + rs_unix_query_none +} rs_unix_query_t; + +typedef struct { + rs_unix_query_t query; + union { + struct { + long int name_len; + sec_rgy_name_t name; + } name; + long int unix_num; + } tagged_union; +} rs_unix_query_key_t; + +static unsigned long int IDL_offset_vec[] = +{ + 0, + sizeof(sec_rgy_unix_group_t), + (unsigned long int) ((unsigned char *) &((sec_rgy_unix_group_t *) 0)->name - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((sec_rgy_unix_group_t *) 0)->gid - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((sec_rgy_unix_group_t *) 0)->members - (unsigned char *) 0), + sizeof(rs_cache_data_t), + (unsigned long int) ((unsigned char *) &((rs_cache_data_t *) 0)->site_id.time_low - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((rs_cache_data_t *) 0)->site_id.time_mid - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((rs_cache_data_t *) 0)->site_id.time_hi_and_version - (unsigned char *) 0), + sizeof(sec_rgy_unix_passwd_t), + (unsigned long int) ((unsigned char *) &((sec_rgy_cursor_t *) 0)->source.clock_seq_hi_and_reserved - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((sec_rgy_cursor_t *) 0)->source.clock_seq_low - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((sec_rgy_cursor_t *) 0)->source.node - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((sec_rgy_cursor_t *) 0)->handle - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((sec_rgy_cursor_t *) 0)->valid - (unsigned char *) 0), + sizeof(struct {long int name_len; sec_rgy_name_t name;}), + (unsigned long int) ((unsigned char *) &((struct {long int name_len; sec_rgy_name_t name;} *)0)->name_len + - (unsigned char *) 0), + (unsigned long int) ((unsigned char *) &((struct {long int name_len; sec_rgy_name_t name;} *)0)->name - (unsigned char *) 0), +}; diff --git a/gcc/testsuite/gcc.c-torture/compile/920928-5.c b/gcc/testsuite/gcc.c-torture/compile/920928-5.c new file mode 100644 index 000000000..8c975f0c0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920928-5.c @@ -0,0 +1,7 @@ +/* REPRODUCED:CC1:SIGNAL MACHINE:m68k OPTIONS:-fpcc-struct-return */ +struct b{}; +f(struct b(*f)()) +{ +struct b d=f(); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/920928-6.c b/gcc/testsuite/gcc.c-torture/compile/920928-6.c new file mode 100644 index 000000000..692191b12 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920928-6.c @@ -0,0 +1,2 @@ +struct{int c;}v; +static short i=((char*)&(v.c)-(char*)&v); diff --git a/gcc/testsuite/gcc.c-torture/compile/921004-1.c b/gcc/testsuite/gcc.c-torture/compile/921004-1.c new file mode 100644 index 000000000..a94722908 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921004-1.c @@ -0,0 +1,6 @@ +/* REPRODUCED:CC1:SIGNAL MACHINE:i386 OPTIONS: */ +long long f() +{ +long long*g,*s; +return*g+*s; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921011-1.c b/gcc/testsuite/gcc.c-torture/compile/921011-1.c new file mode 100644 index 000000000..6cc707dc7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921011-1.c @@ -0,0 +1,27 @@ +void +fun (nb) + int nb; +{ + int th, h, em, nlwm, nlwS, nlw, sy; + + while (nb--) + while (h--) + { + nlw = nlwm; + while (nlw) + { + if (nlwS == 1) + { + } + else + if (nlwS == 1) + { + } + nlwS--; nlw--; + } + if (em) + nlwS--; + if (++sy == th) + sy = 0; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921011-2.c b/gcc/testsuite/gcc.c-torture/compile/921011-2.c new file mode 100644 index 000000000..bf11dad97 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921011-2.c @@ -0,0 +1,65 @@ +extern int foobar1 (); + +typedef struct + { + unsigned long colormap; + unsigned long red_max; + unsigned long red_mult; + unsigned long green_max; + unsigned long green_mult; + unsigned long blue_max; + unsigned long blue_mult; + unsigned long base_pixel; + unsigned long visualid; + unsigned long killid; + } +frotz; + +int +foobar (stdcmap, count) + frotz **stdcmap; + int *count; +{ + register int i; + frotz *data = ((void *) 0); + + unsigned long nitems; + int ncmaps; + int old_style = 0; + unsigned long def_visual = 0L; + frotz *cmaps; + + + if ( foobar1 (&data) != 0) + return 0; + if (nitems < 10) + { + ncmaps = 1; + if (nitems < 9) + { + } + } + else + ncmaps = (nitems / 10); + + { + register frotz *map; + register frotz *prop; + + for (i = ncmaps, map = cmaps, prop = data; i > 0; i--, map++, prop++) + { + map->colormap = prop->colormap; + map->red_max = prop->red_max; + map->red_mult = prop->red_mult; + map->green_max = prop->green_max; + map->green_mult = prop->green_mult; + map->blue_max = prop->blue_max; + map->blue_mult = prop->blue_mult; + map->base_pixel = prop->base_pixel; + map->visualid = (def_visual ? def_visual : prop->visualid); + map->killid = (old_style ? 0L : prop->killid); + } + } + *stdcmap = cmaps; + *count = ncmaps; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921012-1.c b/gcc/testsuite/gcc.c-torture/compile/921012-1.c new file mode 100644 index 000000000..7b5cb6b9f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921012-1.c @@ -0,0 +1,4 @@ +f() +{ +g(({int x;0;})); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921012-2.c b/gcc/testsuite/gcc.c-torture/compile/921012-2.c new file mode 100644 index 000000000..6f4de7795 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921012-2.c @@ -0,0 +1,7 @@ +struct foo { +int a,b,c; +}; +f(struct foo*a,struct foo*b) +{ +*a=*b; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921013-1.c b/gcc/testsuite/gcc.c-torture/compile/921013-1.c new file mode 100644 index 000000000..0d14cbc6b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921013-1.c @@ -0,0 +1,4 @@ +f(int x,short y) +{ +long z=y<0?x>0?x:0:y; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921019-1.c b/gcc/testsuite/gcc.c-torture/compile/921019-1.c new file mode 100644 index 000000000..227bdc276 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921019-1.c @@ -0,0 +1,9 @@ +struct +{ +int n:1,c:1; +}p; + +f() +{ +p.c=p.n=0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921021-1.c b/gcc/testsuite/gcc.c-torture/compile/921021-1.c new file mode 100644 index 000000000..18dffeb9d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921021-1.c @@ -0,0 +1,12 @@ +void g(); + +f() +{ +int x=1; +while(x) +{ +x=h(); +if(x) +g(); +} +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921024-1.c b/gcc/testsuite/gcc.c-torture/compile/921024-1.c new file mode 100644 index 000000000..e723246d6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921024-1.c @@ -0,0 +1,9 @@ +long long f(s,r) +{ + return *(long long*)(s+r); +} + +g(s,r) +{ + *(long long*)(s+r)=0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921026-1.c b/gcc/testsuite/gcc.c-torture/compile/921026-1.c new file mode 100644 index 000000000..18238de83 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921026-1.c @@ -0,0 +1,4 @@ +f(unsigned short*a) +{ +a[0]=65535; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921103-1.c b/gcc/testsuite/gcc.c-torture/compile/921103-1.c new file mode 100644 index 000000000..578e91aaf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921103-1.c @@ -0,0 +1,12 @@ +struct { + unsigned int f1, f2; +} s; + +f() +{ + unsigned x, y; + x = y = 0; + while (y % 4) + y++; + g(&s.f2, s.f1 + x, 4); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921109-1.c b/gcc/testsuite/gcc.c-torture/compile/921109-1.c new file mode 100644 index 000000000..eda43451f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921109-1.c @@ -0,0 +1,28 @@ +typedef struct { double x, y; } p; +typedef struct { int s; float r; } t; +t *e, i; +int i1; + +f(t *op) +{ +int i2 = e->r; +p pt; +int c = g(); +t p; + +if (c) +{ +i = *e; +e -= 3; +return 8; +} +if (op > e) +return 1; +op->r = pt.x; +op->r = pt.y; +p = *e; +++e; +e->r = i1, e->s = i1; +*++e = p; +return 3; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921111-1.c b/gcc/testsuite/gcc.c-torture/compile/921111-1.c new file mode 100644 index 000000000..11b467460 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921111-1.c @@ -0,0 +1,40 @@ +int ps; +struct vp { + int wa; +}; +typedef struct vp *vpt; +typedef struct vc { + int o; + vpt py[8]; +} *vct; +struct n { + int a; +}; +struct nh { + int x; +}; +typedef struct np *npt; +struct np { + vct d; + int di; +}; +struct nh xhp; +struct n np[3]; + +f(dp) + npt dp; +{ + vpt *py; + int a, l, o = 0; + a = dp->d->o; + if (dp->di < 0) + l = ps; + + if ((int)o & 3) + g(); + + xhp.x = a; + py = &dp->d->py[dp->di]; + if (o + l > ps) + np[2].a = (int)(py[1])->wa; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921116-2.c b/gcc/testsuite/gcc.c-torture/compile/921116-2.c new file mode 100644 index 000000000..9eac91cb5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921116-2.c @@ -0,0 +1,9 @@ +typedef struct { + long l[5]; +} t; + +f(size) +{ + t event; + g(&(event.l[2 + size]), (3 - size) * 4); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921118-1.c b/gcc/testsuite/gcc.c-torture/compile/921118-1.c new file mode 100644 index 000000000..857c74e74 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921118-1.c @@ -0,0 +1,8 @@ +inline f(i) +{ + h((long long) i * 2); +} +g() +{ + f(9); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921126-1.c b/gcc/testsuite/gcc.c-torture/compile/921126-1.c new file mode 100644 index 000000000..a7b908b2e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921126-1.c @@ -0,0 +1,11 @@ +f() +{ + long long a0, a1, a0s, val; + int width; + float d; + if (d) + ; + if (a0s & (1LL << width)) + ; + return a0 / a1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921202-1.c b/gcc/testsuite/gcc.c-torture/compile/921202-1.c new file mode 100644 index 000000000..1287edc57 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921202-1.c @@ -0,0 +1,22 @@ +f () +{ + long dx[2055]; + long dy[2055]; + long s1[2055]; + int x, y; + int i; + long s; + + for (;;) + { + s = 2055; + g (s1, s); + for (i = 0; i < 1; i++); + dy[s] = 0x12345; + for (i = 0; i < 1; i++); + if (x != y || h (dx, dy, s) || dx[s] != 0x12345) + { + j (y);k (dy); + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921202-2.c b/gcc/testsuite/gcc.c-torture/compile/921202-2.c new file mode 100644 index 000000000..97d482b63 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921202-2.c @@ -0,0 +1,8 @@ +f(x, c) +{ + for (;;) + { + if (x << c) break; + x++; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921203-1.c b/gcc/testsuite/gcc.c-torture/compile/921203-1.c new file mode 100644 index 000000000..50fe3eb0b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921203-1.c @@ -0,0 +1,5 @@ +char dispstr[]; +f() +{ + strcpy(dispstr,"xxxxxxxxxxx"); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921203-2.c b/gcc/testsuite/gcc.c-torture/compile/921203-2.c new file mode 100644 index 000000000..929afb1bd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921203-2.c @@ -0,0 +1,13 @@ +typedef struct +{ + char x; +} s1; + +s1 f (int arg0,...) +{ + int args; + s1 back; + va_start (args, arg0); + va_end (args); + return back; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921206-1.c b/gcc/testsuite/gcc.c-torture/compile/921206-1.c new file mode 100644 index 000000000..10fa5ea64 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921206-1.c @@ -0,0 +1,28 @@ +double sqrt(double),fabs(double),sin(double); +int sxs; +int sys; +f() +{ + int l; + int sm = -52, sx = 52; + char *smap; + for (l = 0; l < 9; l++) + { + double g; + int cx, cy, gx, gy, x, y; + gx = 2 > g / 3 ? 2 : g / 3; + gy = 2 > g / 3 ? 2 : g / 3; + for (y = 0 > cy - gy ? 0 : cy - gy; y <= (sys - 1 < cy + gy ? sys : cy + gy); y++) + { + int sx = 0 > cx - gx ? 0 : cx - gx; + short *ax = (short *) (y * sxs + sx); + + for (x = sx; x <= (sxs - 1 < cx + gx ? sxs - 1 : cx + gx); x++) + { + double c=2.25, z=sqrt(fabs(1-c)), cz=(c>1?0.0:-10)>z?c>1?0:1:z; + } + } + } + for (l = sm; l <= sx; l++) + smap[l] = l > 0 ? 1 + foo(sin(.1 * l / sx)) : 1 - foo(sin(.1 * l / sm)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/921227-1.c b/gcc/testsuite/gcc.c-torture/compile/921227-1.c new file mode 100644 index 000000000..a49750c81 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/921227-1.c @@ -0,0 +1,5 @@ +#define k(a) #a +char *s = k(k(1,2)); +char *t = k(#) k(#undef k) k(x); + +f(){} diff --git a/gcc/testsuite/gcc.c-torture/compile/930109-1.c b/gcc/testsuite/gcc.c-torture/compile/930109-1.c new file mode 100644 index 000000000..dbd15a1bd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930109-1.c @@ -0,0 +1,12 @@ +f(x) + unsigned x; +{ + static short c; + return x>>c; +} +g(x) + unsigned x; +{ + static char c; + return x>>c; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930109-2.c b/gcc/testsuite/gcc.c-torture/compile/930109-2.c new file mode 100644 index 000000000..61e3a4df9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930109-2.c @@ -0,0 +1,11 @@ +f(r) +{ + int i; + for (i = 0; i < 2; i++) + { + r+= (4 >> i*2); + r+= (2 >> i*2); + r+= (1 >> i*2); + } + return r; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930111-1.c b/gcc/testsuite/gcc.c-torture/compile/930111-1.c new file mode 100644 index 000000000..28574191d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930111-1.c @@ -0,0 +1,10 @@ +/* 2.3.3 crashes on 386 with -traditional */ +f(a) + char *a; +{ + int d = strcmp(a,"-"); + + while (vfork() < 0) + ; + return d; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930117-1.c b/gcc/testsuite/gcc.c-torture/compile/930117-1.c new file mode 100644 index 000000000..83317cdd0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930117-1.c @@ -0,0 +1,4 @@ +f(x) +{ + (*(void (*)())&x)(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930118-1.c b/gcc/testsuite/gcc.c-torture/compile/930118-1.c new file mode 100644 index 000000000..b29543c52 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930118-1.c @@ -0,0 +1,6 @@ +f() +{ +__label__ l; +l:p(); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/930120-1.c b/gcc/testsuite/gcc.c-torture/compile/930120-1.c new file mode 100644 index 000000000..95ac43c07 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930120-1.c @@ -0,0 +1,138 @@ +union { + short I[2]; + long int L; + char C[4]; +} itolws; +char *errflg; +long int dot; +short dotinc; +long int expvf; + +char * +f(fcount,ifp,itype,ptype) + short fcount; + char *ifp; +{ + unsigned w; + long int savdot, wx; + char *fp; + char c, modifier, longpr; + union { + double dval; + struct { + int i1; + int i2; + } ival; + } dw; + union { + float fval; + int ival; + } fw; + int gotdot = 0; + while (fcount > 0) { + fp = ifp; + c = *fp; + longpr = ((c >= 'A') & (c <= 'Z') | (c == 'f') | (c == '4') | (c == 'p') | (c == 'i')); + if ((itype == 0) || (*fp == 'a')) { + wx = dot; + w = dot; + } else { + gotdot = 1; + wx = get((int)dot, itype); + if (!longpr) { + w = (itolws.L=(wx), itolws.I[((dot)&3)>>1]); + } + } + if (c == 'F') { + dw.ival.i1 = wx; + if (itype == 0) { + dw.ival.i2 = expvf; + } + } + + modifier = *fp++; + switch(modifier) { + case ' ' : + case '\t' : + break; + case 't': + case 'T': + printf("%T",fcount); + return(fp); + case 'r': + case 'R': + printf("%M",fcount); + return(fp); + case 'k': + printf("%k",w); + break; + case 'K': + printf("%K",wx); + break; + case 'a': + psymoff(dot,ptype,":%16t"); + dotinc = 0; + break; + case 'p': + psymoff(0,ptype,"%16t"); + break; + case 'u': + printf("%-8u",w); + break; + case 'U': + printf("%-16U",wx); break; + case 'c': + case 'C': + if (modifier == 'C') { + printesc((int)(itolws.L=(wx), itolws.C[(dot)&3])); + } else { + printc((char)(itolws.L=(wx), itolws.C[(dot)&3])); + } + dotinc = 1; + break; + case 'b': + printf("%-8x", (itolws.L=(wx), itolws.C[(dot)&3])); + dotinc = 1; + break; + case 'B': + printf("%-8o", (itolws.L=(wx), itolws.C[(dot)&3])); + dotinc = 1; + break; + case 's': + case 'S': + savdot = dot; + dotinc = 1; + while ((c = (itolws.L=(wx), itolws.C[(dot)&3])) && (errflg == 0)) { + dot = inkdot(1); + if (modifier == 'S') { + printesc(c); + } else { + printc(c); + } + endline(); + if (!(dot & 3)) + wx = get((int)dot, itype); + } + dotinc = dot - savdot + 1; + dot = savdot; + break; + case 'i': + if (gotdot) { + wx = get((int)(dot & ~3), itype); + } + iDasm((int)(wx), (unsigned int)0, (unsigned int)(dot&~3)); + printc('\n'); + break; + case 'f': + fw.ival = wx; + printf("%-16.9f", fw.fval); + dotinc = 4; + break; + case 'F': + printf("%-32.18F", dw.dval); + dotinc = 8; + break; + } + } + return(fp); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930126-1.c b/gcc/testsuite/gcc.c-torture/compile/930126-1.c new file mode 100644 index 000000000..8313c5c45 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930126-1.c @@ -0,0 +1,74 @@ +typedef unsigned T; +typedef char Tchar; +T mt (long, char *); +T ms (long, char *); +T mv (long, T, char); +T cons (T, T); +T decl (T * (*) (T *), char *); + +T*L92(T*),*L15(T*),*L14(T*),*L13(T*),*L12(T*),*L11(T*),*L10(T*),*L9(T*),*L8(T*),*L7(T*),*L6(T*),*L5(T*),*L4(T*),*L3(T*),*L2(T*),*L1(T*); + +static T * +Ldata (T * my_pc) +{ +int cc = (((* ((T *) (my_pc))) >> 16) & 0xFF); +T B92, B91, B90, B15, B14, B13, B12, B11, B10, B9, B8, B7, B6, B5, B4, B3, B2, B1, tO7, tO6, tO5, tO4, tO3, tO2, tO1, tO0; +T object = mv (168, 0, ((Tchar) 1)); +T * cb = (T *) (((T) (object & 0x3FF)) | 0x400); +tO0 = mv (92, 0, ((Tchar) 1)); +B92 = decl (L92, ""); +B15 = decl (L15, ""); +B14 = decl (L14, ""); +B13 = decl (L13, ""); +B12 = decl (L12, ""); +B11 = decl (L11, ""); +B10 = decl (L10, ""); +B9 = decl (L9, ""); +B8 = decl (L8, ""); +B7 = decl (L7, ""); +B6 = decl (L6, ""); +B5 = decl (L5, ""); +B4 = decl (L4, ""); +B3 = decl (L3, ""); +B2 = decl (L2, ""); +B1 = decl (L1, ""); +cb[19] = ((((cc) & 0xFF) << 16) | (9 & 0xFF)); +cb[21] = ((((cc) & 0xFF) << 16) | ((10) & 0xFF)); +cb[23] = ((((cc) & 0xFF) << 16) | (11 & 0xFF)); +cb[25] = ((((cc) & 0xFF) << 16) | (12 & 0xFF)); +cb[27] = ((((cc) & 0xFF) << 16) | (13 & 0xFF)); +cb[29] = ((((cc) & 0xFF) << 16) | (14 & 0xFF)); +cb[31] = ((((cc) & 0xFF) << 16) | (15 & 0xFF)); +cb[35] = ((((cc) & 0xFF) << 16) | (17 & 0xFF)); +cb[36] = ((0x1A) << 26) | (((0x39) << 26) | 1) & 0x3FF; +cb[39] = ms (24, ((char *) "")); +cb[41] = ((0x1A) << 26) | (((0x39) << 26) | 1) & 0x3FF; +cb[44] = 3; +cb[46] = 2; +cb[48] = 3; +cb[50] = 6; +cb[52] = 4; +cb[146] = tO0; +((T *) (((tO0 & 0x3FF)) | 0x400))[92] = B1; +((T *) (((tO0 & 0x3FF)) | 0x400))[91] = B2; +((T *) (((tO0 & 0x3FF)) | 0x400))[2] = B90; +((T *) (((tO0 & 0x3FF)) | 0x400))[2] = B91; +((T *) (((tO0 & 0x3FF)) | 0x400))[1] = B92; +cb[58] = 0x2800 | (T) ((T *) ((B6 & 0x3FF) | 0x400) + 3); +cb[57] = 0x2800 | (T) ((T *) ((B7 & 0x3FF) | 0x400) + 3) & ~0xC00; +cb[56] = 0x2800 | (T) ((T *) ((B8 & 0x3FF) | 0x400) + 3) & ~0xC00; +cb[55] = 0x2800 | (T) ((T *) ((B9 & 0x3FF) | 0x400) + 3) & ~0xC00; +tO7 = mv (8, 0, ((Tchar) 1)); +tO4 = ms (9, ((char *) "")); +tO3 = mv (58, 0, ((Tchar) 1)); +tO6 = ms (4, ((char *) "")); +tO2 = mv (4, 0, ((Tchar) 1)); +tO5 = ms (4, ((char *) "")); +tO1 = mv (28, 0, ((Tchar) 1)); +cb[165] = tO1; +cb[163] = cons (((ms (10, ((char *) "")))), (cons (tO5, 0))); +cb[162] = cons (1, (cons (2, 0))); +cb[150] = cons (1, (cons (2, (cons (3, (cons (4, (cons (5, (cons (6, 0))))))))))); +cb[148] = tO7; +return cb; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930210-1.c b/gcc/testsuite/gcc.c-torture/compile/930210-1.c new file mode 100644 index 000000000..47d2da2ac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930210-1.c @@ -0,0 +1,11 @@ +f() +{ + char c1, c2; + char *p1, *p2; + + do { + c1 = c2 = *p1++; + while (c1--) + *p2++ = *p1++; + } while (c2); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930217-1.c b/gcc/testsuite/gcc.c-torture/compile/930217-1.c new file mode 100644 index 000000000..0f64a0407 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930217-1.c @@ -0,0 +1,20 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int a; +#else +double g (); +typedef union { + struct { + unsigned s:1, e:8, f:23; + } u; + float f; +} s; + +f(x, n) + float x; +{ + ((s *)&x)->u.e -= n; + x = g((double)x, -n); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/930222-1.c b/gcc/testsuite/gcc.c-torture/compile/930222-1.c new file mode 100644 index 000000000..c6d6aa3b4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930222-1.c @@ -0,0 +1,16 @@ +typedef struct + { + long i; + double f; + } T; + +f (T *n1, T *n2) +{ + if (g (n2)) + return n1->i - n2->i; + else + { + double f = n1->f - n2->i; + return f == 0.0 ? 0 : (f > 0.0 ? 1 : -1); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930325-1.c b/gcc/testsuite/gcc.c-torture/compile/930325-1.c new file mode 100644 index 000000000..24cea5027 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930325-1.c @@ -0,0 +1,23 @@ +typedef unsigned uint; + +inline +g (uint *s, uint *d, uint c) +{ + while (c != 0) + { + *--d = *--s; + c--; + } +} + +f (uint *p1, uint c, uint *p2) +{ + while (c > 0 && *p1 == 0) + { + p1++; + c--; + } + if (c == 0) + return 1; + g (p2, p1, c); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930326-1.c b/gcc/testsuite/gcc.c-torture/compile/930326-1.c new file mode 100644 index 000000000..97313d86a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930326-1.c @@ -0,0 +1,6 @@ +struct +{ + char a, b, f[3]; +} s; + +long i = s.f-&s.b; diff --git a/gcc/testsuite/gcc.c-torture/compile/930411-1.c b/gcc/testsuite/gcc.c-torture/compile/930411-1.c new file mode 100644 index 000000000..bb03c13fa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930411-1.c @@ -0,0 +1,36 @@ +int heap; + +g(){} + +f(int i1, int i2) +{ + i1 = *(int*)(i1 + 4); + if (i1 == 0) + goto L4; + else + goto L9; + L3: + i2 = heap - 8; + *(int*)i2 = 3; + *(int*)(i2 + 4) = i1; + heap -= 8; + return i2; + L4: + i1 = g(i2); + goto L5; + L5: + i1 = *(int*)(i1 + 4); + if (i1 == 0) + goto L7; + else + goto L8; + L7: + i1 = 0; + goto L3; + L8: + i1 = 1; + goto L3; + L9: + i1 = 1; + goto L3; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930421-1.c b/gcc/testsuite/gcc.c-torture/compile/930421-1.c new file mode 100644 index 000000000..01b465f7f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930421-1.c @@ -0,0 +1,19 @@ +double q(double); + +f (int **x, int *r, int *s, int a, int b, int c, int d) +{ + int i, j, k, m, e, f, g, z[1024], y[2]; + + e = g = 0; + for (i = 0; i < a; i++) + for (j = 0; j < b; j++) + if (x[i][j]) + for (k = 0; k < c; k++) + { + f = q(1.5) + q(2.5); + if (g < y[f]) + g = e; + } + for (m = 0; m < 1; m++) + z[0] = m*2*d/3.0 - d; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930427-2.c b/gcc/testsuite/gcc.c-torture/compile/930427-2.c new file mode 100644 index 000000000..53b633785 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930427-2.c @@ -0,0 +1,9 @@ +struct s { + int f; +}; + +f (w, v0, v1, v2, v3) + struct s *w; +{ + g (v0 ? 1 : w->f, v1 ? v3 : v2); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930503-1.c b/gcc/testsuite/gcc.c-torture/compile/930503-1.c new file mode 100644 index 000000000..6889e8b7a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930503-1.c @@ -0,0 +1,8 @@ +f (const char *s, char *d, unsigned l) +{ + if (0) + while (1); + else + while (--l >= 0) + *d++ = *s++; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930503-2.c b/gcc/testsuite/gcc.c-torture/compile/930503-2.c new file mode 100644 index 000000000..1b0ea34f0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930503-2.c @@ -0,0 +1,5 @@ +f() +{ + struct { char x; } r; + g(r); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930506-1.c b/gcc/testsuite/gcc.c-torture/compile/930506-1.c new file mode 100644 index 000000000..8c26ea367 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930506-1.c @@ -0,0 +1,12 @@ +long long +f (a) + double a; +{ + double b; + unsigned long long v; + + b = a / 2.0; + v = (unsigned) b; + a -= (double) v; + return v; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930506-2.c b/gcc/testsuite/gcc.c-torture/compile/930506-2.c new file mode 100644 index 000000000..e11e62f02 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930506-2.c @@ -0,0 +1,15 @@ +#ifndef NO_TRAMPOLINES +int f1() +{ + { int ___() { foo(1); } bar(___); } + return( { int ___() { foo(2); } bar(___);} ); +} + +int f2(int j) +{ + { int ___() { foo(j); } bar(___); } + return( { int ___() { foo(j); } bar(___);} ); +} +#else +int x; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/930510-1.c b/gcc/testsuite/gcc.c-torture/compile/930510-1.c new file mode 100644 index 000000000..8c4628262 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930510-1.c @@ -0,0 +1,18 @@ +typedef long time_t; +static __const int mon_lengths[2][12] = { + 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, + 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 +}; +static time_t +f (janfirst, year, rulep, offset) + __const time_t janfirst; + __const int year; + register __const struct rule * __const rulep; + __const long offset; +{ + register int leapyear; + register time_t value; + register int i; + + value += mon_lengths[leapyear][i] * ((long) (60 * 60) * 24); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930513-1.c b/gcc/testsuite/gcc.c-torture/compile/930513-1.c new file mode 100644 index 000000000..463fd89b4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930513-1.c @@ -0,0 +1,15 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int a; +#else +struct s { + int f1 : 26; + int f2 : 8; +}; + +f (struct s *x) +{ + return x->f2++ == 0; +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/930513-2.c b/gcc/testsuite/gcc.c-torture/compile/930513-2.c new file mode 100644 index 000000000..a7f508c82 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930513-2.c @@ -0,0 +1,9 @@ +double g (); + +f (x) + double x; +{ + x = .85; + while (g () < x) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930513-3.c b/gcc/testsuite/gcc.c-torture/compile/930513-3.c new file mode 100644 index 000000000..f8d4e6034 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930513-3.c @@ -0,0 +1,9 @@ +test () +{ + short *p, q[3]; + int x; + + p = q; + for (x = 0; x < 3; x++) + *p++ = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930523-1.c b/gcc/testsuite/gcc.c-torture/compile/930523-1.c new file mode 100644 index 000000000..5f2b5b5d7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930523-1.c @@ -0,0 +1,54 @@ +int v; + +f () +{ + unsigned long *a1, *a2; + int vertex2; + int c, x1, x2, dx1, dx2, dy1, dy2, e1, e2, s2; + unsigned long m, b; + int n; + unsigned long r; + int aba; + + do + { + if (dx2 >= dy2) + dx2 = dx2 % dy2; + + if (dx2 >= dy2) + { + s2 = - (dx2 / dy2); + dx2 = dx2 % dy2; + } + } + while (vertex2 / 65536); + + for (;;) + { + c = x2; + a2 = a1; + if (v) + a2 = 0; + + if (c + n) + { + m = b << (c * 8); + *a2 = (*a2 & ~m) | (r & m); + n += c; + + while (--n) + { + { + } + } + } + + a1 = 0; + x1 += 0; + if (e1 += dx1) + e1 -= dy1; + x2 += s2; + if (e2 += dx2) + e2 -= dy2; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930525-1.c b/gcc/testsuite/gcc.c-torture/compile/930525-1.c new file mode 100644 index 000000000..00c2e263b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930525-1.c @@ -0,0 +1,7 @@ +typedef struct foo foo_t; +foo_t x; +struct foo { + int i; +}; + +foo_t x = { 10 }; diff --git a/gcc/testsuite/gcc.c-torture/compile/930527-1.c b/gcc/testsuite/gcc.c-torture/compile/930527-1.c new file mode 100644 index 000000000..53e00e65e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930527-1.c @@ -0,0 +1,16 @@ +enum {e0, e1}; + +int x[] = +{ + [e0] = 0 +}; + +f () +{ + switch (1) + { + case e0: + case e1: + break; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930529-1.c b/gcc/testsuite/gcc.c-torture/compile/930529-1.c new file mode 100644 index 000000000..70b2cb8f9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930529-1.c @@ -0,0 +1,83 @@ +struct r +{ + int d1, d2; +}; + +struct km +{ + int d; +}; + +struct f1 +{ + char *fn; + char *fd; + char *fs; + char *ic; + void (*ff) (); +}; + +int g (); + +int y; +struct r *bs; +int bv; + +void b (); +char *w (); + +struct km **q; +char **mns; +int nm; +struct f1 **z; + +f (char *km, char *h) +{ + struct f1 *t; + int map = midn(km, strlen(km)); + int V; + int c; + struct r r; + struct f1 *cm; + + if (!g(&V, &cm, h, strlen(h))) + { + c = (cm - z[V]); + goto L; + } + + for (c = 0; c < nm; c++) + if (!strcmp (h, mns[c])) + { + V = -1; + goto L; + } + + for (c = 0; c < y; c++) + { + if (!memcmp (&bs[c], &r, 8)) + goto L; + } + + h = w (&r); + if (!bv) + { + bs = g (8); + t = (struct f1 *)g (20); + } + else + { + bs = g (bs, y * 8); + z[bv] = cr (z[bv], (1 + y) * 20); + t = &z[bv][y - 1]; + } + bs[y - 1] = r; + t->fs[0] = sp (y - 1); + t->fs[1] = 0; + t->ic = 0; + t->fd = 0; + t->fn = cs (h); + t->ff = b; + L: + g (q[map], V, c); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930530-1.c b/gcc/testsuite/gcc.c-torture/compile/930530-1.c new file mode 100644 index 000000000..848e0400e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930530-1.c @@ -0,0 +1,5 @@ +f () +{ + struct { char a, b; } x; + g (x, x, x, x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930602-1.c b/gcc/testsuite/gcc.c-torture/compile/930602-1.c new file mode 100644 index 000000000..5a0eb2189 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930602-1.c @@ -0,0 +1,13 @@ +typedef struct { + int f[8]; +} T; + +f (w, l, r) + T *w; + unsigned short l, r; +{ + int i; + + for (i = l; i < r; i++) + g (w->f[i]); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930603-1.c b/gcc/testsuite/gcc.c-torture/compile/930603-1.c new file mode 100644 index 000000000..643cc52d4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930603-1.c @@ -0,0 +1,10 @@ +union u { union u *a; double d; }; +union u *s, g(); + +f() +{ + union u x = g(); + + s[0] = *x.a; + s[1] = g(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930607-1.c b/gcc/testsuite/gcc.c-torture/compile/930607-1.c new file mode 100644 index 000000000..97c94b25e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930607-1.c @@ -0,0 +1,9 @@ +typedef void f (); +typedef f *pf; +long long i; + +g () +{ + long long p = i; + ((pf) (long) p) (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930611-1.c b/gcc/testsuite/gcc.c-torture/compile/930611-1.c new file mode 100644 index 000000000..c216c0965 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930611-1.c @@ -0,0 +1,7 @@ +float +f (float a1) +{ + union { float f; int l; } fl1; + fl1.f = a1; + return fl1.l ? 1.0 : a1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930618-1.c b/gcc/testsuite/gcc.c-torture/compile/930618-1.c new file mode 100644 index 000000000..74c215725 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930618-1.c @@ -0,0 +1,8 @@ +f (s) +{ + int r; + + r = (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)) | (!g(s)); + + return r; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930621-1.c b/gcc/testsuite/gcc.c-torture/compile/930621-1.c new file mode 100644 index 000000000..4199bbe08 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930621-1.c @@ -0,0 +1,38 @@ +#if defined(STACK_SIZE) && (STACK_SIZE < 65536) +# define BYTEMEM_SIZE 10000L +#endif + +#ifndef BYTEMEM_SIZE +# define BYTEMEM_SIZE 45000L +#endif + +int bytestart[5000 + 1]; +unsigned char modtext[400 + 1]; +unsigned char bytemem[2][BYTEMEM_SIZE + 1]; + +long +modlookup (int l) +{ + signed char c; + long j; + long k; + signed char w; + long p; + while (p != 0) + { + while ((k < bytestart[p + 2]) && (j <= l) && (modtext[j] == bytemem[w][k])) + { + k = k + 1; + j = j + 1; + } + if (k == bytestart[p + 2]) + if (j > l) + c = 1; + else c = 4; + else if (j > l) + c = 3; + else if (modtext[j] < bytemem[w][k]) + c = 0; + else c = 2; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930623-1.c b/gcc/testsuite/gcc.c-torture/compile/930623-1.c new file mode 100644 index 000000000..4b5b90bd8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930623-1.c @@ -0,0 +1,7 @@ +g (a, b) {} + +f (xx) + void* xx; +{ + __builtin_apply ((void*)g, xx, 200); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930702-1.c b/gcc/testsuite/gcc.c-torture/compile/930702-1.c new file mode 100644 index 000000000..9f51dd876 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930702-1.c @@ -0,0 +1,5 @@ +f () +{ + {({});} + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930926-1.c b/gcc/testsuite/gcc.c-torture/compile/930926-1.c new file mode 100644 index 000000000..fcfa4fbc4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930926-1.c @@ -0,0 +1,7 @@ +int f () { return 0; } + +void +test () +{ + int j = { f() }; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/930927-1.c b/gcc/testsuite/gcc.c-torture/compile/930927-1.c new file mode 100644 index 000000000..81a4979f4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/930927-1.c @@ -0,0 +1,3 @@ +#include + +wchar_t s[5] = L"abcd"; diff --git a/gcc/testsuite/gcc.c-torture/compile/931003-1.c b/gcc/testsuite/gcc.c-torture/compile/931003-1.c new file mode 100644 index 000000000..922b14379 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931003-1.c @@ -0,0 +1,15 @@ +f (n, a) + int n; + double a[]; +{ + double b[51]; + int i, j; + + i = 0; + + for (j = n - 1; j > 0; j--) + b[i++] = 0; + + if (b[0] > b[i - 1]) + a[i] = b[i - 1]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931004-1.c b/gcc/testsuite/gcc.c-torture/compile/931004-1.c new file mode 100644 index 000000000..0e741fd4a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931004-1.c @@ -0,0 +1,8 @@ +#define A "This is a long test that tests the structure initialization" +#define B A,A +#define C B,B,B,B +#define D C,C,C,C +int main() +{ + char *subs[]={ D, D, D, D, D, D, D, D, D, D, D, D, D, D, D}; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931013-1.c b/gcc/testsuite/gcc.c-torture/compile/931013-1.c new file mode 100644 index 000000000..c237c0b73 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931013-1.c @@ -0,0 +1,10 @@ +g (); + +f () +{ + long ldata[2]; + int seed; + + seed = (ldata[0]) + (ldata[1] << 16); + g (seed); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931013-2.c b/gcc/testsuite/gcc.c-torture/compile/931013-2.c new file mode 100644 index 000000000..8fc0db492 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931013-2.c @@ -0,0 +1,20 @@ +f (unsigned short Z[48]) +{ + int j; + unsigned short t1, t2, t3, T[48]; + unsigned short *p = T + 48; + + for (j = 1; j < 8; j++) + { + t1 = *Z++; + *--p = *Z++; + *--p = t1; + t1 = inv(*Z++); + t2 = -*Z++; + t3 = -*Z++; + *--p = inv(*Z++); + *--p = t2; + *--p = t3; + *--p = t1; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931013-3.c b/gcc/testsuite/gcc.c-torture/compile/931013-3.c new file mode 100644 index 000000000..e663b9acc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931013-3.c @@ -0,0 +1,11 @@ +struct s +{ + int f; +}; + +struct s +f () +{ + int addr; + return *(struct s *) &addr; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931018-1.c b/gcc/testsuite/gcc.c-torture/compile/931018-1.c new file mode 100644 index 000000000..7efe40ec0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931018-1.c @@ -0,0 +1,14 @@ +typedef struct +{ + int a, b; +} T; + +f (T *bs) +{ + long long x; + x = ({ + union { T s; long long l; } u; + u.s = *bs; + u.l; + }); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931031-1.c b/gcc/testsuite/gcc.c-torture/compile/931031-1.c new file mode 100644 index 000000000..9015f54f7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931031-1.c @@ -0,0 +1,9 @@ +struct s +{ + int pad:1, no:1; +}; + +f (struct s *b, int c) +{ + char d = b->no && c; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931102-1.c b/gcc/testsuite/gcc.c-torture/compile/931102-1.c new file mode 100644 index 000000000..a039c2633 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931102-1.c @@ -0,0 +1,111 @@ +char *e (); + +#define SET \ + if (d > *b++) d |= a; \ + if (b) b = e(b); + +xxx() +{ + int a, d; + char *b, *c; + + while (1) { + while (1) { + while (1) { + if (a) { + switch (a) { + case 1: + while (1) { + SET + do { + SET + } while (1); + } + case 2: + while (1) { + if (d) { + do { + SET + } while (1); + } + else { + do { + SET + } while (1); + } + } + case 3: + while (1) { + if (d) { + do { + SET + } while (1); + } + else { + do { + SET + } while (1); + } + } + case 4: + while (1) { + if (d) { + do { + SET + } while (1); + } + else { + do { + SET + } while (1); + } + } + } + } + else { + switch (a) { + case 2: + while (1) { + if (d) { + do { + SET + } while (1); + } + else { + do { + SET + } while (1); + } + } + case 3: + while (1) { + if (d) { + do { + SET + } while (1); + } + else { + do { + SET + } while (1); + } + } + case 4: + while (1) { + if (d) { + do { + SET + } while (1); + } + else { + do { + SET + } while (1); + } + } + } + } + } + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931102-2.c b/gcc/testsuite/gcc.c-torture/compile/931102-2.c new file mode 100644 index 000000000..f39b27164 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931102-2.c @@ -0,0 +1,21 @@ +typedef struct { + int a; +} VCR; + +typedef struct { + VCR vcr[8]; +} VCRC; + +typedef struct { + char vcr; +} OWN; + +OWN Own[16]; + +f (x, own) + VCRC *x; + OWN *own; +{ + x[own->vcr / 8].vcr[own->vcr % 8].a--; + x[own->vcr / 8].vcr[own->vcr % 8].a = x[own->vcr / 8].vcr[own->vcr % 8].a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/931203-1.c b/gcc/testsuite/gcc.c-torture/compile/931203-1.c new file mode 100644 index 000000000..3007ff582 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/931203-1.c @@ -0,0 +1,5 @@ +v (a, i) + unsigned *a, i; +{ + a++[i] = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/940611-1.c b/gcc/testsuite/gcc.c-torture/compile/940611-1.c new file mode 100644 index 000000000..90f72486a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/940611-1.c @@ -0,0 +1,10 @@ +f () +{ + do +L:; + while (0); + do + ; + while (0); + goto L; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/940712-1.c b/gcc/testsuite/gcc.c-torture/compile/940712-1.c new file mode 100644 index 000000000..10a6961dc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/940712-1.c @@ -0,0 +1,4 @@ +f () +{ + return (*(volatile unsigned int *)8000) / 3; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/940718-1.c b/gcc/testsuite/gcc.c-torture/compile/940718-1.c new file mode 100644 index 000000000..505280fa9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/940718-1.c @@ -0,0 +1,7 @@ +extern double log (double) __attribute__ ((const)); + +f (double x) +{ + for (;;) + exp(log(x)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/941014-1.c b/gcc/testsuite/gcc.c-torture/compile/941014-1.c new file mode 100644 index 000000000..d31701572 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/941014-1.c @@ -0,0 +1,11 @@ +f (to) + char *to; +{ + unsigned int wch; + register length; + unsigned char tmp; + unsigned int mult = 10; + + tmp = (wch>>(unsigned int)(length * mult)); + *to++ = (unsigned char)tmp; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/941014-2.c b/gcc/testsuite/gcc.c-torture/compile/941014-2.c new file mode 100644 index 000000000..01e9a672e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/941014-2.c @@ -0,0 +1,37 @@ +void +f (n, ppt, xrot) +{ + int tileWidth; + int nlwSrc; + int srcx; + int v3, v4; + register unsigned long ca1, cx1, ca2, cx2; + unsigned long *pSrcLine; + register unsigned long *pDst; + register unsigned long *pSrc; + register unsigned long b, tmp; + unsigned long tileEndMask; + int v1, v2; + int tileEndPart; + int needFirst; + tileEndPart = 0; + v1 = tileEndPart << 5; + v2 = 32 - v1; + while (n--) + { + if ((srcx = (ppt - xrot) % tileWidth) < 0) + if (needFirst) + if (nlwSrc == 1) + { + tmp = b; + if (tileEndPart) + b = (*pSrc & tileEndMask) | (*pSrcLine >> v1); + } + if (tileEndPart) + b = (tmp << v1) | (b >> v2); + if (v4 != 32) + *pDst = (*pDst & ((tmp << v3) | (b >> v4) & ca1 ^ cx1) + ^ (((tmp << v3) | (b >> v4)) & ca2 ^ cx2)); + *pDst = *pDst & tmp; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/941014-3.c b/gcc/testsuite/gcc.c-torture/compile/941014-3.c new file mode 100644 index 000000000..6dcb89395 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/941014-3.c @@ -0,0 +1,72 @@ +typedef unsigned char byte; +typedef unsigned int uint; +typedef unsigned long ulong; +typedef ulong gs_char; +typedef struct gs_show_enum_s gs_show_enum; +typedef struct gs_font_s gs_font; +typedef struct gx_font_stack_item_s { + gs_font *font; +} gx_font_stack_item; +typedef struct gx_font_stack_s { + gx_font_stack_item items[1 + 5 ]; +} gx_font_stack; +struct gs_show_enum_s { + gx_font_stack fstack; +}; +typedef enum { + ft_composite = 0, +} font_type; +struct gs_font_s { + font_type FontType; +}; +typedef enum { + fmap_escape = 3, + fmap_shift = 8 + } fmap_type; +typedef struct gs_type0_data_s { + fmap_type FMapType; +} gs_type0_data; +gs_type0_next_char(register gs_show_enum *penum) +{ + const byte *p; + int fdepth; + gs_font *pfont; + gs_type0_data *pdata; + uint fidx; + gs_char chr; + for (; pfont->FontType == ft_composite; ) + { + fmap_type fmt; + switch ( fmt ) + { + do {} while (0); + rdown: + continue; + case fmap_shift: + p++; + do {} while (0); + goto rdown; + } + break; + } + up: + while ( fdepth > 0 ) + { + switch ( pdata->FMapType ) + { + default: + continue; + case fmap_escape: + fidx = *++p; + do {} while (0); + if ( fidx == chr && fdepth > 1 ) + goto up; + down: + fdepth--; + do {} while (0); + } + break; + } + while ( (pfont = penum->fstack.items[fdepth].font)->FontType == ft_composite ) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/941014-4.c b/gcc/testsuite/gcc.c-torture/compile/941014-4.c new file mode 100644 index 000000000..9e673f378 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/941014-4.c @@ -0,0 +1,16 @@ +#ifndef NO_LABEL_VALUES +f (int *re) +{ + int *loops = 0, *loope = 0; + unsigned dat0 = 0; + static void *debug = &&firstdebug; + + firstdebug: + g (loops, loope); + + if (dat0 & 1) + re[(dat0 >> 2) & 3] = 0; +} +#else +int x; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/941019-1.c b/gcc/testsuite/gcc.c-torture/compile/941019-1.c new file mode 100644 index 000000000..257b594c1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/941019-1.c @@ -0,0 +1 @@ +__complex__ long double sub (__complex__ long double cld) { return cld; } diff --git a/gcc/testsuite/gcc.c-torture/compile/941111-1.c b/gcc/testsuite/gcc.c-torture/compile/941111-1.c new file mode 100644 index 000000000..3f0c28bef --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/941111-1.c @@ -0,0 +1,8 @@ +main () +{ + struct S { int i; char c; } obj1, obj2; + + foo (); + if (obj1.c != obj2.c) + bar (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/941113-1.c b/gcc/testsuite/gcc.c-torture/compile/941113-1.c new file mode 100644 index 000000000..5c2e0b68c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/941113-1.c @@ -0,0 +1,12 @@ +typedef void foo (void); + +f (x) +{ + if (x) + { + const foo* v; + (*v)(); + } + else + g (0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950122-1.c b/gcc/testsuite/gcc.c-torture/compile/950122-1.c new file mode 100644 index 000000000..8dea79050 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950122-1.c @@ -0,0 +1,5 @@ +int +foo (int i, unsigned short j) +{ + return j *= i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950124-1.c b/gcc/testsuite/gcc.c-torture/compile/950124-1.c new file mode 100644 index 000000000..e723954a0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950124-1.c @@ -0,0 +1,15 @@ +f () +{ + if (g ()) + h (); + else + { + do + { + return 0; + break; + } + while (1); + } + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950221-1.c b/gcc/testsuite/gcc.c-torture/compile/950221-1.c new file mode 100644 index 000000000..141476386 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950221-1.c @@ -0,0 +1,16 @@ +short v = -1; + +typedef struct +{ + short network; +} atype; + +void f () +{ + static atype config; + atype *cp; + short net; + cp = &config; + cp->network = (v == -1) ? 100 : v; + net = cp->network; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950329-1.c b/gcc/testsuite/gcc.c-torture/compile/950329-1.c new file mode 100644 index 000000000..7c047f5a5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950329-1.c @@ -0,0 +1,19 @@ +f () +{ + int i; + for (i = 1;; i = 0) + { + if (h ()) + { + if (i) + g (); + g (h ()); + g (h ()); + } + else + { + g (); + break; + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950512-1.c b/gcc/testsuite/gcc.c-torture/compile/950512-1.c new file mode 100644 index 000000000..e43ec48d1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950512-1.c @@ -0,0 +1,6 @@ +typedef unsigned short uint16; +f (unsigned char *w) +{ + w[2] = (uint16) ((((g (0) % 10000 + 42) & 0xFF) << 8) | (((g (0) % 10000 + 42) >> 8) & 0xFF)) & 0xFF, + w[3] = (uint16) ((((g (0) % 10000 + 42) & 0xFF) << 8) | (((g (0) % 10000 + 42) >> 8) & 0xFF)) >> 8; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950530-1.c b/gcc/testsuite/gcc.c-torture/compile/950530-1.c new file mode 100644 index 000000000..2b714e059 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950530-1.c @@ -0,0 +1,4 @@ +f (int *s, int *t) +{ + return (t - s) / 2; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950607-1.c b/gcc/testsuite/gcc.c-torture/compile/950607-1.c new file mode 100644 index 000000000..851defce3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950607-1.c @@ -0,0 +1,38 @@ +typedef struct { + int component_id; + int component_index; + int h_samp_factor; + int v_samp_factor; +} jpeg_component_info; +struct jpeg_common_struct { + struct jpeg_error_mgr * err; +}; +typedef struct jpeg_common_struct * j_common_ptr; +typedef struct jpeg_compress_struct * j_compress_ptr; +struct jpeg_compress_struct { + struct jpeg_error_mgr * err; + int num_components; + jpeg_component_info * comp_info; + int max_h_samp_factor; + int max_v_samp_factor; +}; +struct jpeg_error_mgr { + int msg_code; +}; + +void +jinit_downsampler (j_compress_ptr cinfo) +{ + int ci; + jpeg_component_info * compptr; + + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + if (compptr->h_samp_factor == cinfo->max_h_samp_factor && + compptr->v_samp_factor == cinfo->max_v_samp_factor) { + } else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 && + (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) { + } else + cinfo->err->msg_code = 0; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950610-1.c b/gcc/testsuite/gcc.c-torture/compile/950610-1.c new file mode 100644 index 000000000..16d0d0e60 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950610-1.c @@ -0,0 +1 @@ +f (int n, int a[2][n]) {} diff --git a/gcc/testsuite/gcc.c-torture/compile/950612-1.c b/gcc/testsuite/gcc.c-torture/compile/950612-1.c new file mode 100644 index 000000000..cb3cb0a59 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950612-1.c @@ -0,0 +1,134 @@ +typedef enum +{ + LODI, + STO, + ADDI, + ADD, + SUBI, + SUB, + MULI, + MUL, + DIVI, + DIV, + INC, + DEC +} INSN; + +f (pc) + short *pc; +{ + long long stack[16], *sp = &stack[16], acc = 0; + + for (;;) + { + switch ((INSN)*pc++) + { + case LODI: + *--sp = acc; + acc = ((long long)*pc++) << 32; + break; + case STO: + return (acc >> 32) + (((((unsigned long long) acc) & 0xffffffff) & (1 << 31)) != 0); + break; + case ADDI: + acc += ((long long)*pc++) << 32; + break; + case ADD: + acc = *sp++ + acc; + break; + case SUBI: + acc -= ((long long)*pc++) << 32; + break; + case SUB: + acc = *sp++ - acc; + break; + case MULI: + acc *= *pc++; + break; + case MUL: + { + long long aux; + unsigned char minus; + + minus = 0; + aux = *sp++; + if (aux < 0) + { + minus = ~minus; + aux = -aux; + } + if (acc < 0) + { + minus = ~minus; + acc = -acc; + } + acc = ((((((unsigned long long) acc) & 0xffffffff) * (((unsigned long long) aux) & 0xffffffff)) >> 32) + + ((((unsigned long long) acc) >> 32) * (((unsigned long long) aux) & 0xffffffff) + (((unsigned long long) acc) & 0xffffffff) + (((unsigned long long) aux) >> 32)) + + (((((unsigned long long) acc) >> 32) * (((unsigned long long) aux) >> 32)) << 32)); + if (minus) + acc = -acc; + } + break; + case DIVI: + { + short aux; + + aux = *pc++; + acc = (acc + aux / 2) / aux; + } + break; + case DIV: + { + long long aux; + unsigned char minus; + + minus = 0; + aux = *sp++; + if (aux < 0) + { + minus = ~minus; + aux = -aux; + } + if (acc < 0) + { + minus = ~minus; + acc = -acc; + } + + if (((unsigned long long)acc) == 0) + acc = (unsigned long long)-1 / 2; + else if ((((unsigned long long) ((unsigned long long)acc)) & 0xffffffff) == 0) + acc = ((unsigned long long)aux) / (((unsigned long long) ((unsigned long long)acc)) >> 32); + else if ((((unsigned long long) ((unsigned long long)acc)) >> 32) == 0) + acc = ((((unsigned long long)aux) / ((unsigned long long)acc)) << 32) + + ((((unsigned long long)aux) % ((unsigned long long)acc)) << 32) / ((unsigned long long)acc); + else + { + unsigned char shift; + unsigned long hi; + + shift = 32; + hi = (((unsigned long long) ((unsigned long long)acc)) >> 32); + do { + if (hi & ((unsigned long)1 << (shift - 1))) + break; + } while (--shift != 0); + printf("shift = %d\n", shift); + acc = ((((unsigned long long)aux) / ((unsigned long long)acc)) << 32) + + (((((unsigned long long)aux) % ((unsigned long long)acc)) << (32 - shift)) + ((((unsigned long long)acc) >> shift) / 2)) / (((unsigned long long)acc) >> shift); + } + + if (minus) + acc = -acc; + } + break; + case INC: + acc += 1; + break; + case DEC: + acc -= 1; + break; + } + printf("%08lx.%08lx\n", (long)(((unsigned long long) acc) >> 32) , (long)(((unsigned long long) acc) & 0xffffffff)); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950613-1.c b/gcc/testsuite/gcc.c-torture/compile/950613-1.c new file mode 100644 index 000000000..8aa757f47 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950613-1.c @@ -0,0 +1,31 @@ +#ifndef NO_LABEL_VALUES +f () +{ + long *sp; + long *pc; + + static void *dummy[] = + { + &&L1, + &&L2, + }; + + L1: + { + float val; + val = *(float *) sp; + val = -val; + *(float *) sp = val; + goto *pc++; + } + + L2: + { + float from; + *(long long *) sp = from; + goto *pc++; + } +} +#else +int x; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/950618-1.c b/gcc/testsuite/gcc.c-torture/compile/950618-1.c new file mode 100644 index 000000000..4229da4e9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950618-1.c @@ -0,0 +1,2 @@ +static __inline__ int f () { return g (); } +int g () { return f (); } diff --git a/gcc/testsuite/gcc.c-torture/compile/950719-1.c b/gcc/testsuite/gcc.c-torture/compile/950719-1.c new file mode 100644 index 000000000..d3277fada --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950719-1.c @@ -0,0 +1,11 @@ +typedef struct +{ + int Header; + char data[4092]; +} t_node; + +f (unsigned short rid, unsigned short record_length) +{ + t_node tnode; + g (rid, tnode.data + rid * record_length); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950729-1.c b/gcc/testsuite/gcc.c-torture/compile/950729-1.c new file mode 100644 index 000000000..cfdbad920 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950729-1.c @@ -0,0 +1,39 @@ +static const char * const lcset = "0123456789abcdef"; +static const char * const ucset = "0123456789ABCDEF"; + +char * +f (char *buffer, long long value, char type) +{ + int base, i; + + i = 128 - 1; + buffer[i--] = '\0'; + + switch (type) + { + case 'u': + case 'o': + case 'x': + case 'X': + if (type == 'u') + base = 10; + else if (type == 'o') + base = 8; + else + base = 16; + + while (i >= 0) + { + if (type == 'X') + buffer[i--] = ucset[((unsigned long long) value) % base]; + else + buffer[i--] = lcset[((unsigned long long) value) % base]; + + if ((value = ((unsigned long long) value) / base) == 0) + break; + } + break; + } + + return &buffer[++i]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950816-1.c b/gcc/testsuite/gcc.c-torture/compile/950816-1.c new file mode 100644 index 000000000..da849bbad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950816-1.c @@ -0,0 +1,7 @@ +f () +{ + unsigned char b[2]; + float f; + b[0] = (unsigned char) f / 256; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950816-2.c b/gcc/testsuite/gcc.c-torture/compile/950816-2.c new file mode 100644 index 000000000..41e770d17 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950816-2.c @@ -0,0 +1,8 @@ +f () +{ + int i; + float a,b,c; + unsigned char val[2]; + i = func (&c); + val[0] = c < a ? a : c >= 1.0 ? b : c; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950816-3.c b/gcc/testsuite/gcc.c-torture/compile/950816-3.c new file mode 100644 index 000000000..b3cb0fca3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950816-3.c @@ -0,0 +1,8 @@ +f () +{ + int i; + short x, z; + for (i = 0; i <= 1; i++) + x = i; + return x + z; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950910-1.c b/gcc/testsuite/gcc.c-torture/compile/950910-1.c new file mode 100644 index 000000000..1be2aa55e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950910-1.c @@ -0,0 +1,22 @@ +f (char *p) +{ + char c; + + c = *++p; + if (c != ' ') + return 0; + for (;;) + { + c = *p; + if (g (c)) + p++; + else + { + if (c == ' ') + break; + else + return 0; + } + } + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950919-1.c b/gcc/testsuite/gcc.c-torture/compile/950919-1.c new file mode 100644 index 000000000..8320f6d02 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950919-1.c @@ -0,0 +1,5 @@ +#define empty +#if empty#cpu(m68k) +#endif + +f (){} diff --git a/gcc/testsuite/gcc.c-torture/compile/950921-1.c b/gcc/testsuite/gcc.c-torture/compile/950921-1.c new file mode 100644 index 000000000..371c7d569 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950921-1.c @@ -0,0 +1,12 @@ +f () +{ + union + { + signed char c; + double d; + } u; + + u.c = 1; + u.c = 1; + return u.c; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/950922-1.c b/gcc/testsuite/gcc.c-torture/compile/950922-1.c new file mode 100644 index 000000000..73c52f774 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950922-1.c @@ -0,0 +1,68 @@ +struct sw { + const void *x; + int r; +}; +struct sq { + struct sw *q_w; + int t; + int z; +}; + +int +f (int ch, char *fp, char *ap) +{ + register int n; + register char *cp; + register struct sw *p; + register int f; + int prec; + double _double; + int expt; + int ndig; + char expstr[7]; + unsigned long long _uquad; + struct sq q; + struct sw w[8]; + static char zeroes[16]; + + for (;;) { + switch (ch) { + case 'd': + _double = (double) (ap += 8, *((double *) (ap - 8))); + break; + case 'o': + goto nosign; + case 'u': + _uquad = (f & 0x020 ? (ap += 8, *((long long *) (ap - 8))) : f & 0x010 ? (ap += 4, *((long *) (ap - 4))) : f & 0x040 ? (long)(short)(ap += 4, *((int *) (ap - 4))) : (long)(ap += 4, *((int *) (ap - 4)))); + goto nosign; + case 'x': + _uquad = (f & 0x020 ? (ap += 8, *((long long *) (ap - 8))) : f & 0x010 ? (ap += 4, *((long *) (ap - 4))) : f & 0x040 ? (long)(unsigned short)(ap += 4, *((int *) (ap - 4))) : (long)(ap += 4, *((int *) (ap - 4)))); + nosign: + if (_uquad != 0 || prec != 0); + break; + default:; + } + if ((f & 0x100) == 0) { + } else { + if (ch >= 'f') { + if (_double == 0) { + if (expt < ndig || (f & 0x001) != 0) { + { if ((n = (ndig - 1)) > 0) { while (n > 16) {{ p->x = (zeroes); p->r = 16; q.z += 16; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} n -= 16; }{ p->x = (zeroes); p->r = n; q.z += n; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }}}} + } + } else if (expt <= 0) { + { p->x = ("0"); p->r = 1; q.z += 1; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} + { p->x = 0; p->r = 1; q.z += 1; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} + { if ((n = (-expt)) > 0) { while (n > 16) {{ p->x = (zeroes); p->r = 16; q.z += 16; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} n -= 16; }{ p->x = (zeroes); p->r = n; q.z += n; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} }} + { p->x = cp; p->r = ndig; q.z += ndig; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} + } else { + { p->x = cp; p->r = expt; q.z += expt; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} + cp += expt; + { p->x = ("."); p->r = 1; q.z += 1; p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} + { p->x = cp; p->r = (ndig-expt); q.z += (ndig-expt); p++; if (++q.t >= 8) { if (g(fp, &q)) goto error; p = w; }} + } + } + } + } + + error:; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/951004-1.c b/gcc/testsuite/gcc.c-torture/compile/951004-1.c new file mode 100644 index 000000000..1ca60819c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/951004-1.c @@ -0,0 +1,23 @@ +typedef struct +{ + short v, h; +} S; + +S a; + +f (S pnt) +{ + S mpnt, mtp; + + (&pnt)->v -= 1; + mpnt = pnt; + mtp = a; + if (mtp.v != mpnt.v) + { + S tpnt; + + tpnt = mtp; + mtp = mpnt; + mpnt = tpnt; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/951106-1.c b/gcc/testsuite/gcc.c-torture/compile/951106-1.c new file mode 100644 index 000000000..09cba20c1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/951106-1.c @@ -0,0 +1,4 @@ +f (double a, double b) +{ + g (a, 0, b); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/951116-1.c b/gcc/testsuite/gcc.c-torture/compile/951116-1.c new file mode 100644 index 000000000..100d6902a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/951116-1.c @@ -0,0 +1,9 @@ +f () +{ + long long i; + int j; + long long k = i = j; + + int inner () {return j + i;} + return k; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/951128-1.c b/gcc/testsuite/gcc.c-torture/compile/951128-1.c new file mode 100644 index 000000000..5e4dc7093 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/951128-1.c @@ -0,0 +1,5 @@ +char a[]; +f (const int i) +{ + a[i] = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/951220-1.c b/gcc/testsuite/gcc.c-torture/compile/951220-1.c new file mode 100644 index 000000000..33e98f622 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/951220-1.c @@ -0,0 +1,4 @@ +f (char *x) +{ + return (*x & 2) || (*x & 3); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/951222-1.c b/gcc/testsuite/gcc.c-torture/compile/951222-1.c new file mode 100644 index 000000000..b8246f5fe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/951222-1.c @@ -0,0 +1,15 @@ +extern long long foo (); + +long long +sub1 () +{ + char junk[10000]; + register long long a, b, c; + + b = foo (); + + setjmp (); + a = foo (); + c = a - b; + return c; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/960106-1.c b/gcc/testsuite/gcc.c-torture/compile/960106-1.c new file mode 100644 index 000000000..c8228aab5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960106-1.c @@ -0,0 +1,4 @@ +f (a) +{ + return (a & 1) && !(a & 2 & 4); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/960130-1.c b/gcc/testsuite/gcc.c-torture/compile/960130-1.c new file mode 100644 index 000000000..ed8dab459 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960130-1.c @@ -0,0 +1,8 @@ +int a[1]; + +int +main() +{ + extern int a[]; + return *a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/960201-1.c b/gcc/testsuite/gcc.c-torture/compile/960201-1.c new file mode 100644 index 000000000..adc462389 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960201-1.c @@ -0,0 +1,5 @@ +union foo +{ + char a; + int x[2]; +} __attribute__ ((transparent_union)); diff --git a/gcc/testsuite/gcc.c-torture/compile/960218-1.c b/gcc/testsuite/gcc.c-torture/compile/960218-1.c new file mode 100644 index 000000000..46fbf7785 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960218-1.c @@ -0,0 +1,2 @@ +#define X(x) x +int main() { return X(0/* *//* */); } diff --git a/gcc/testsuite/gcc.c-torture/compile/960220-1.c b/gcc/testsuite/gcc.c-torture/compile/960220-1.c new file mode 100644 index 000000000..766a066c4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960220-1.c @@ -0,0 +1,6 @@ +f () +{ + unsigned long long int a = 0, b; + while (b > a) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/960221-1.c b/gcc/testsuite/gcc.c-torture/compile/960221-1.c new file mode 100644 index 000000000..0e02496c1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960221-1.c @@ -0,0 +1,11 @@ +struct s1 { int f1; }; + +struct s2 { + struct s1 a; + int f2; +}; + +foo (struct s2 *ptr) +{ + *ptr = (struct s2) {{}, 0}; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/960319-1.c b/gcc/testsuite/gcc.c-torture/compile/960319-1.c new file mode 100644 index 000000000..f3d95ab6e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960319-1.c @@ -0,0 +1,10 @@ +static void +f() +{ + long long a[2]; + int i; + if (g()) + if (h()) + ; + *a |= (long long)i << 65 ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/960514-1.c b/gcc/testsuite/gcc.c-torture/compile/960514-1.c new file mode 100644 index 000000000..1d38cfd1a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960514-1.c @@ -0,0 +1,12 @@ +struct s { + unsigned long long t[5]; +}; + +void +f (struct s *d, unsigned long long *l) +{ + int i; + + for (i = 0; i < 5; i++) + d->t[i] += l[i]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/960704-1.c b/gcc/testsuite/gcc.c-torture/compile/960704-1.c new file mode 100644 index 000000000..5a9d35cfd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960704-1.c @@ -0,0 +1,10 @@ +struct A { + double d; +}; + +struct A f (); + +main () +{ + struct A a = f(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/960829-1.c b/gcc/testsuite/gcc.c-torture/compile/960829-1.c new file mode 100644 index 000000000..8c6163dfa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/960829-1.c @@ -0,0 +1,4 @@ +f () +{ + g (0, 0.0, 0.0, 0.0, 0.0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/961004-1.c b/gcc/testsuite/gcc.c-torture/compile/961004-1.c new file mode 100644 index 000000000..6407b625d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/961004-1.c @@ -0,0 +1,37 @@ +void +f1 (o1, o2, o3, i, j, k) + long long *o1, *o2, *o3; + int i, j, k; +{ + while (--i) + o1[i] = o2[j >>= 1] + o3[k >>= 1]; +} + +void +f2 (o1, o2, o3, i, j, k) + long long *o1, *o2, *o3; + int i, j, k; +{ + while (--i) + o1[i] = o2[j >>= 1] - o3[k >>= 1]; +} + +void +f3 (o1, o2, o3, i, j, k) + long long *o1, *o3; + unsigned *o2; + int i, j, k; +{ + while (--i) + o1[i] = o2[j >>= 1] + o3[k >>= 1]; +} + +void +f4 (o1, o2, o3, i, j, k) + long long *o1, *o2; + unsigned *o3; + int i, j, k; +{ + while (--i) + o1[i] = o2[j >>= 1] - o3[k >>= 1]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/961010-1.c b/gcc/testsuite/gcc.c-torture/compile/961010-1.c new file mode 100644 index 000000000..d6145bc42 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/961010-1.c @@ -0,0 +1 @@ +double f (double x) { return x == 0 ? x : 0.0; } diff --git a/gcc/testsuite/gcc.c-torture/compile/961019-1.c b/gcc/testsuite/gcc.c-torture/compile/961019-1.c new file mode 100644 index 000000000..0ea6ec6e2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/961019-1.c @@ -0,0 +1,11 @@ +char _hex_value[256]; + +void +hex_init () +{ + int i; + for (i = 0; i < 256; i++) + _hex_value[i] = 99; + for (i = 0; i < 10; i++) + _hex_value['0' + i] = i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/961031-1.c b/gcc/testsuite/gcc.c-torture/compile/961031-1.c new file mode 100644 index 000000000..ea8718f76 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/961031-1.c @@ -0,0 +1,16 @@ +struct s { + double d; +} sd; + +struct s g () __attribute__ ((const)); + +struct s +g () +{ + return sd; +} + +f () +{ + g (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/961126-1.c b/gcc/testsuite/gcc.c-torture/compile/961126-1.c new file mode 100644 index 000000000..f3b6af555 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/961126-1.c @@ -0,0 +1,107 @@ +int *p; + +main() +{ + int i = sub (); + + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + i = -i; + if (*p != i) + goto quit; + + i = -i; +quit: + sub2 (i); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/961203-1.c b/gcc/testsuite/gcc.c-torture/compile/961203-1.c new file mode 100644 index 000000000..989085843 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/961203-1.c @@ -0,0 +1,22 @@ +/* The structure is too large for the xstormy16 - won't fit in 16 + bits. */ +/* { dg-do assemble } */ + +#if __INT_MAX__ >= 2147483647L +struct s { + char a[0x32100000]; + int x:30, y:30; +}; + +int +main () +{ + struct s* p; + + p = (struct s*) 0; + if (p->x == p->y) + exit (1); +} +#else +int g; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/970206-1.c b/gcc/testsuite/gcc.c-torture/compile/970206-1.c new file mode 100644 index 000000000..95196cd6a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/970206-1.c @@ -0,0 +1,13 @@ +struct Rect +{ + int iA; + int iB; + int iC; + int iD; +}; + +void +f (int * const this, struct Rect arect) +{ + g (*this, arect); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/970214-1.c b/gcc/testsuite/gcc.c-torture/compile/970214-1.c new file mode 100644 index 000000000..508ea9e92 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/970214-1.c @@ -0,0 +1,3 @@ +#include +#define L 264 +wchar_t c = L'X'; diff --git a/gcc/testsuite/gcc.c-torture/compile/980329-1.c b/gcc/testsuite/gcc.c-torture/compile/980329-1.c new file mode 100644 index 000000000..3b3fe27cf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980329-1.c @@ -0,0 +1,72 @@ +typedef __SIZE_TYPE__ size_t; +struct re_pattern_buffer + { + unsigned char *buffer; + unsigned long int used; + }; +struct re_registers + { + int *start; + }; + +static const char **regstart, **regend; +static const char **old_regend; + +static int +re_match_2_internal (struct re_pattern_buffer *bufp, + struct re_registers *regs) +{ + unsigned char *p = bufp->buffer; + unsigned char *pend = p + bufp->used; + + for (;;) + { + int highest_active_reg = 1; + if (bufp) + { + int i; + for (i = 1;; i++) + regs->start[i] = 0; + } + + switch ((unsigned int) *p++) + { + case 1: + { + unsigned char r = *p; + if (r) + highest_active_reg = r; + } + if (p + 2 == pend) + { + char is_a_jump_n = 0; + int mcnt = 0; + unsigned char *p1; + + p1 = p + 2; + switch (*p1++) + { + case 2: + is_a_jump_n = 1; + case 1: + do { do { mcnt = *p1; } while (0); p1 += 2; } while (0); + if (is_a_jump_n) + p1 = 0; + } + + if (mcnt && *p1 == 0) + { + unsigned r; + for (r = 0; r < (unsigned) *p + (unsigned) *(p + 1); r++) + { + if (regend[0] >= regstart[r]) + regend[r] = old_regend[r]; + } + do { while (0 < highest_active_reg + 1) { } } while (0); + } + } + } + } + + return -1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/980408-1.c b/gcc/testsuite/gcc.c-torture/compile/980408-1.c new file mode 100644 index 000000000..09bf43040 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980408-1.c @@ -0,0 +1,129 @@ +typedef struct _RunlengthPacket +{ + unsigned short + red, + green, + blue, + length; + unsigned short + index; +} RunlengthPacket; +typedef struct _Image +{ + int + status, + temporary; + char + filename[1664 ]; + long int + filesize; + int + pipe; + char + magick[1664 ], + *comments, + *label, + *text; + unsigned int + matte; + unsigned int + columns, + rows, + depth; + unsigned int + scene, + number_scenes; + char + *montage, + *directory; + unsigned int + colors; + double + gamma; + float + x_resolution, + y_resolution; + unsigned int + mean_error_per_pixel; + double + normalized_mean_error, + normalized_maximum_error; + unsigned long + total_colors; + char + *signature; + unsigned int + packets, + runlength, + packet_size; + unsigned char + *packed_pixels; + long int + magick_time; + char + magick_filename[1664 ]; + unsigned int + magick_columns, + magick_rows; + char + *geometry, + *page; + unsigned int + dispose, + delay, + iterations; + unsigned int + orphan; + struct _Image + *previous, + *list, + *next; +} Image; + Image *MinifyImage(Image *image) +{ + Image + *minified_image; + register RunlengthPacket + *q, + *s, + *s0, + *s1, + *s2, + *s3; + register unsigned int + x; + unsigned int + blue, + green, + red; + unsigned long + total_matte, + total_blue, + total_green, + total_red; + unsigned short + index; + for (x=0; x < (image->columns-1); x+=2) + { + total_red=0; + total_green=0; + total_blue=0; + total_matte=0; + s=s0; + total_red+=( 3 )*(s->red); total_green+=( 3 )*(s->green); total_blue+=( 3 )*(s->blue); total_matte+=( 3 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 3 )*(s->red); total_green+=( 3 )*(s->green); total_blue+=( 3 )*(s->blue); total_matte+=( 3 )*(s->index); s++; ; + s=s1; + total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 15 )*(s->red); total_green+=( 15 )*(s->green); total_blue+=( 15 )*(s->blue); total_matte+=( 15 )*(s->index); s++; ; total_red+=( 15 )*(s->red); total_green+=( 15 )*(s->green); total_blue+=( 15 )*(s->blue); total_matte+=( 15 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; + s=s2; + total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 15 )*(s->red); total_green+=( 15 )*(s->green); total_blue+=( 15 )*(s->blue); total_matte+=( 15 )*(s->index); s++; ; total_red+=( 15 )*(s->red); total_green+=( 15 )*(s->green); total_blue+=( 15 )*(s->blue); total_matte+=( 15 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; + s=s3; + total_red+=( 3 )*(s->red); total_green+=( 3 )*(s->green); total_blue+=( 3 )*(s->blue); total_matte+=( 3 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 7 )*(s->red); total_green+=( 7 )*(s->green); total_blue+=( 7 )*(s->blue); total_matte+=( 7 )*(s->index); s++; ; total_red+=( 3 )*(s->red); total_green+=( 3 )*(s->green); total_blue+=( 3 )*(s->blue); total_matte+=( 3 )*(s->index); s++; ; + red=(unsigned short) ((total_red+63) >> 7); + green=(unsigned short) ((total_green+63) >> 7); + blue=(unsigned short) ((total_blue+63) >> 7); + index=(unsigned short) ((total_matte+63) >> 7); + if ((red == q->red) && (green == q->green) && (blue == q->blue) && + (index == q->index) && ((int) q->length < 65535L )) + q->length++; + } + return(minified_image); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/980504-1.c b/gcc/testsuite/gcc.c-torture/compile/980504-1.c new file mode 100644 index 000000000..7b757ccd2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980504-1.c @@ -0,0 +1,28 @@ +typedef struct _geom_elem { + double coeffs[6]; +} pGeomDefRec, *pGeomDefPtr; +typedef struct _mpgeombanddef { + int yOut; + int in_width; +} mpGeometryBandRec, *mpGeometryBandPtr; +typedef void *pointer; +typedef unsigned char CARD8; +typedef CARD8 BytePixel; +void BiGL_B (OUTP,srcimg,width,sline,pedpvt,pvtband) pointer OUTP; +pointer *srcimg; +register int width; +int sline; +pGeomDefPtr pedpvt; mpGeometryBandPtr pvtband; +{ + register float s, t, st; + register int isrcline,isrcpix; + register int srcwidth = pvtband->in_width - 1; + register BytePixel val; + register BytePixel *ptrIn, *ptrJn; + register double a = pedpvt->coeffs[0]; + register double c = pedpvt->coeffs[2]; + register double srcpix = a * ((double)(0.0000)) + pedpvt->coeffs[1] * (pvtband->yOut + ((double)(0.0000)) ) + pedpvt->coeffs[4]; + register double srcline = c * ((double)(0.0000)) + pedpvt->coeffs[3] * (pvtband->yOut + ((double)(0.0000)) ) + pedpvt->coeffs[5]; + if ( (isrcpix >= 0) && (isrcpix < srcwidth) ) + val = ptrIn[isrcpix] * ((float)1. - s - t + st) + ptrIn[isrcpix+1] * (s - st) + ptrJn[isrcpix] * (t - st) + ptrJn[isrcpix+1] * (st) + (float)0.5 ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/980506-1.c b/gcc/testsuite/gcc.c-torture/compile/980506-1.c new file mode 100644 index 000000000..5c22e7e50 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980506-1.c @@ -0,0 +1,70 @@ +/* The arrays are too large for the xstormy16 - won't fit in 16 bits. */ +/* { dg-do assemble } */ +/* { dg-require-effective-target size32plus } */ +/* { dg-xfail-if "The array too big" { m6811-*-* m6812-*-* } { "*" } { "" } } /* +/* { dg-skip-if "Array too big" { "avr-*-*" } { "*" } { "" } } */ +/* { dg-xfail-if "The array too big" { h8300-*-* } { "-mno-h" "-mn" } { "" } } */ + +unsigned char TIFFFax2DMode[20][256]; +unsigned char TIFFFax2DNextState[20][256]; +unsigned char TIFFFaxUncompAction[20][256]; +unsigned char TIFFFaxUncompNextState[20][256]; +unsigned char TIFFFax1DAction[230][256]; +unsigned char TIFFFax1DNextState[230][256]; + +typedef struct tableentry { + unsigned short length; + unsigned short code; + short runlen; +} tableentry; + +extern tableentry TIFFFaxWhiteCodes[]; +extern tableentry TIFFFaxBlackCodes[]; + +static short sp_data, sp_bit; + +static unsigned char +fetchByte (inbuf) + +unsigned char **inbuf; + +{ + unsigned char byte = **inbuf; + (*inbuf)++; + return (byte); +} + +static int +decode_white_run (inbuf) + +unsigned char **inbuf; + +{ + short state = sp_bit; + short action; + int runlen = 0; + + for (;;) + { + if (sp_bit == 0) + { + nextbyte: + sp_data = fetchByte (inbuf); + } + + action = TIFFFax1DAction[state][sp_data]; + state = TIFFFax1DNextState[state][sp_data]; + if (action == 0 ) + goto nextbyte; + if (action == 1 ) + return (-1 ); + if (action == 210 ) + return (-3 ); + sp_bit = state; + action = (TIFFFaxWhiteCodes[ action - 2 ].runlen) ; + runlen += action; + if (action < 64) + return (runlen); + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/980506-2.c b/gcc/testsuite/gcc.c-torture/compile/980506-2.c new file mode 100644 index 000000000..6f6fe1927 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980506-2.c @@ -0,0 +1,89 @@ +/* + * inspired by glibc-2.0.6/sysdeps/libm-ieee754/s_nextafterf.c + * + * gcc -O2 -S -DOP=+ gives faddp %st(1),%st + * gcc -O2 -S -DOP=* gives fmulp %st(1),%st + * gcc -O2 -S -DOP=- gives fsubrp %st(1),%st + * gcc -O2 -S -DOP=/ gives fdivrp %st(1),%st + */ + +#ifndef OP +#define OP * +#endif + +typedef int int32_t __attribute__ ((__mode__ ( __SI__ ))) ; +typedef unsigned int u_int32_t __attribute__ ((__mode__ ( __SI__ ))) ; + +typedef union +{ + float value; + u_int32_t word; +} ieee_float_shape_type; + +float __nextafterf(float x, float y) +{ + int32_t hx,hy,ix,iy; + + { + ieee_float_shape_type gf_u; + gf_u.value = x; + hx = gf_u.word; + } + { + ieee_float_shape_type gf_u; + gf_u.value = y; + hy = gf_u.word; + } + ix = hx&0x7fffffff; + iy = hy&0x7fffffff; + + if ( ix > 0x7f800000 || iy > 0x7f800000 ) + return x+y; + if (x == y) return x; + if (ix == 0) + { + { + ieee_float_shape_type sf_u; + sf_u.word = (hy&0x80000000) | 1; + x = sf_u.value; + } + y = x*x; + if (y == x) return y; else return x; + } + if (hx >= 0) + { + if (hx > hy) + hx -= 1; + else + hx += 1; + } + else + { + if (hy >= 0 || hx > hy) + hx -= 1; + else + hx += 1; + } + hy = hx & 0x7f800000; + if (hy >= 0x7f800000) + return x+x; + if (hy < 0x00800000) + { + y = x OP x; + if (y != x) + { + ieee_float_shape_type sf_u; + sf_u.word = hx; + y = sf_u.value; + return y; + } + } + { + ieee_float_shape_type sf_u; + sf_u.word = hx; + x = sf_u.value; + } + return x; +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/980511-1.c b/gcc/testsuite/gcc.c-torture/compile/980511-1.c new file mode 100644 index 000000000..f1bac0c43 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980511-1.c @@ -0,0 +1,20 @@ +typedef unsigned int __kernel_dev_t; +typedef __kernel_dev_t dev_t; +struct ustat { +}; +typedef unsigned int kdev_t; +static inline kdev_t to_kdev_t(int dev) +{ + int major, minor; + major = (dev >> 8); + minor = (dev & 0xff); + return ((( major ) << 22 ) | ( minor )) ; +} +struct super_block { +}; +struct super_block * get_super (kdev_t dev); +int sys_ustat(dev_t dev, struct ustat * ubuf) +{ + struct super_block *s; + s = get_super(to_kdev_t(dev)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/980701-1.c b/gcc/testsuite/gcc.c-torture/compile/980701-1.c new file mode 100644 index 000000000..82dd16d6b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980701-1.c @@ -0,0 +1,9 @@ + +short +func(void) +{ + unsigned char x, y; + + return y | x << 8; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/980706-1.c b/gcc/testsuite/gcc.c-torture/compile/980706-1.c new file mode 100644 index 000000000..214f36d53 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980706-1.c @@ -0,0 +1,10 @@ +void g(long long); + +long long f(long long v1, long long v2, long long v3, long long v4) +{ + g(v1); + g(v2); + g(v3); + g(v4); + return v1 && v2; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/980726-1.c b/gcc/testsuite/gcc.c-torture/compile/980726-1.c new file mode 100644 index 000000000..3d4daa203 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980726-1.c @@ -0,0 +1,10 @@ +static __inline__ unsigned char BCD(unsigned char binval) +{ + if (binval > 99) return 0x99; + return (((binval/10) << 4) | (binval%10)); +} + +void int1a(unsigned char i) +{ + (*((unsigned char *)1)) = BCD(i); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/980729-1.c b/gcc/testsuite/gcc.c-torture/compile/980729-1.c new file mode 100644 index 000000000..973372b2e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980729-1.c @@ -0,0 +1,14 @@ +static int +regex_compile () +{ + int c, c1; + char str[6 + 1]; + c1 = 0; + for (;;) + { + do { } while (0) ; + if (c1 == 6 ) + break; + str[c1++] = c; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/980816-1.c b/gcc/testsuite/gcc.c-torture/compile/980816-1.c new file mode 100644 index 000000000..a79100fab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980816-1.c @@ -0,0 +1,51 @@ +typedef __SIZE_TYPE__ size_t; +typedef void *XtPointer; + +typedef struct _WidgetRec *Widget; +typedef struct _WidgetClassRec *WidgetClass; + +extern WidgetClass commandWidgetClass; + +typedef void (*XtCallbackProc)( + Widget , + XtPointer , + XtPointer +); + +extern const char XtStrings[]; + + +typedef struct +{ + char *Name, + *Label; + XtCallbackProc Callback; + XtPointer ClientData; + Widget W; +} DialogButtonType, *DialogButtonTypePtr; + + +Widget AddButtons(Widget Parent, Widget Top, + DialogButtonTypePtr Buttons, size_t Count) +{ + int i; + + for (i = 0; i < Count; i++) + { + if (!Buttons[i].Label) + continue; + Buttons[i].W = XtVaCreateManagedWidget(Buttons[i].Name, + commandWidgetClass, + Parent, + ((char*)&XtStrings[429]) , Buttons[i].Label, + "fromHoriz" , i ? Buttons[i-1].W : ((void *)0) , + "fromVert" , Top, + "resizable" , 1 , + ((void *)0) ); + + XtAddCallback(((char*)&XtStrings[136]), + Buttons[i].Callback, Buttons[i].ClientData); + } + return(Buttons[Count-1].W); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/980821-1.c b/gcc/testsuite/gcc.c-torture/compile/980821-1.c new file mode 100644 index 000000000..9eb1ac4ca --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980821-1.c @@ -0,0 +1,15 @@ +typedef int __int32_t; +int __kernel_rem_pio2(int prec) +{ + __int32_t i, jz; + double fw, fq[20]; + switch(prec) { + case 2: + fw = 0.0; + case 3: + for (i=jz;i>0;i--) { + fw = fq[i-1] +fq[i]; + fq[i-1] = fw; + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/980825-1.c b/gcc/testsuite/gcc.c-torture/compile/980825-1.c new file mode 100644 index 000000000..34e35bf83 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/980825-1.c @@ -0,0 +1,30 @@ +typedef enum { FALSE, TRUE } boolean; +enum _errorTypes { FATAL = 1, WARNING = 2, PERROR = 4 }; +typedef struct _optionValues { + struct _include { + boolean classNames; + boolean defines; + boolean enumerators; + } include; +} optionValues; +extern optionValues Option; +static void applyTagInclusionList( list ) + const char *const list; +{ + boolean mode = TRUE; + const char *p; + for (p = list ; *p != '\0' ; ++p) + switch (*p) + { + case '=': + clearTagList(); + mode = TRUE; + break; + case '+': mode = TRUE; break; + case '-': mode = FALSE; break; + case 'c': Option.include.classNames = mode; break; + case 'd': Option.include.defines = mode; break; + case 'e': Option.include.enumerators = mode; break; + default: error(FATAL, "-i: Invalid tag option '%c'", *p); break; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/981001-1.c b/gcc/testsuite/gcc.c-torture/compile/981001-1.c new file mode 100644 index 000000000..d7cf0dc64 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981001-1.c @@ -0,0 +1,18 @@ +unsigned short code = 0x0000; +unsigned short low = 0x4000; +unsigned short high = 0xb000; + +int main (void) +{ + if ( + (high & 0x8000) != (low & 0x8000) + && ( low & 0x4000) == 0x4000 + && (high & 0x4000) == 0 + ) + { + code ^= 0x4000; + low |= 0x4000; + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/981001-2.c b/gcc/testsuite/gcc.c-torture/compile/981001-2.c new file mode 100644 index 000000000..f635cbb60 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981001-2.c @@ -0,0 +1,14 @@ +/* { dg-require-weak "" } */ +/* { dg-require-alias "" } */ +#define weak_alias(func, aliasname) \ + extern __typeof (func) aliasname __attribute__ ((weak, alias (#func))); + +#define add3(d, m, c) ((d) + (m) + (c)) + +int +__add3(int d, int m, int c) +{ + return d + m + c; +} + +weak_alias (__add3, add3) diff --git a/gcc/testsuite/gcc.c-torture/compile/981001-3.c b/gcc/testsuite/gcc.c-torture/compile/981001-3.c new file mode 100644 index 000000000..5f6458757 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981001-3.c @@ -0,0 +1,14 @@ +#define P(a, b) P1(a,b) +#define P1(a,b) a##b + +#define FLT_MIN_EXP (-125) +#define DBL_MIN_EXP (-1021) + +#define MIN_EXP P(FLT,_MIN_EXP) + +#define FLT FLT +int f1 = MIN_EXP; + +#undef FLT +#define FLT DBL +int f2 = MIN_EXP; diff --git a/gcc/testsuite/gcc.c-torture/compile/981001-4.c b/gcc/testsuite/gcc.c-torture/compile/981001-4.c new file mode 100644 index 000000000..dd3df9cce --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981001-4.c @@ -0,0 +1,14 @@ +#define P(a,b) P1(a,b) +#define P1(a,b) a##b + +#define ONCE(x, y) (x ?: (x = y())) +#define PREFIX + +extern int P(PREFIX, init) (void); + +int +fun(void) +{ + static int memo; + return ONCE(memo, P(PREFIX, init)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/981006-1.c b/gcc/testsuite/gcc.c-torture/compile/981006-1.c new file mode 100644 index 000000000..d77c115f2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981006-1.c @@ -0,0 +1,53 @@ +/* Test that tablejump insns are correctly handled. If the compiler + loses track of the jump targets, it will report that x and y can be + used uninitialized. + + This is broken in egcs 1998/10/06 for mips in pic mode. */ +/* { dg-do assemble } */ +/* For MIPS at least, pic is needed to trigger the problem. */ +/* { dg-options "-w -Wuninitialized -Werror -fpic" } */ +/* { dg-options "-w -Wuninitialized -Werror" { target { { rs6000-*-aix* powerpc*-*-aix* arm*-*-* fr30-*-* sh-*-hms h8300*-*-* cris-*-elf* mmix-*-* } || { ! fpic } } } } */ + +int foo (int a, int b) +{ + __label__ z; + int x; /* { dg-bogus "warning: `.' might be used uninitialized in this function" } */ + int y; /* { dg-bogus "warning: `.' might be used uninitialized in this function" } */ + static void *p; + + switch (a) { + case 2: + x = 4; + break; + case 4: + x = 6; + break; + case 8: case 10: case 13: case 11: case 17: case 19: + x = 7; + break; + default: + x = -1; + break; + } + switch (b) { + case 2: + y = 4; + break; + case 4: + y = 6; + break; + case 8: case 10: case 13: case 11: case 17: case 19: + y = 7; + break; + default: + y = -1; + break; + } + z: + p = &&z; + return x * y; +} +int main (int argc, char *argv[]) +{ + return 1 == foo (argc, argc + 1); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/981007-1.c b/gcc/testsuite/gcc.c-torture/compile/981007-1.c new file mode 100644 index 000000000..d41400b78 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981007-1.c @@ -0,0 +1,21 @@ +extern double fabs (double); +extern double sqrt (double); + +typedef struct complexm { + double re,im; +} complex; + +static complex +setCom (double r, double i) +{ + complex ct; + ct.re=fabs(r)<1E-300?0.0:r; + ct.im=fabs(i)<1E-300?0.0:i; + return ct; +} + +static complex +csqrt_crash (double x) +{ + return (x>=0) ? setCom(sqrt(x),0) : setCom(0,sqrt(-x)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/981107-1.c b/gcc/testsuite/gcc.c-torture/compile/981107-1.c new file mode 100644 index 000000000..987ec180f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981107-1.c @@ -0,0 +1,9 @@ +unsigned long seed(void) +{ + unsigned long u; + + call(); + + u = 26107 * (unsigned long)&u; + return u; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/981223-1.c b/gcc/testsuite/gcc.c-torture/compile/981223-1.c new file mode 100644 index 000000000..b62894807 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981223-1.c @@ -0,0 +1,17 @@ +/* The problem on IA-64 is that the assembler emits + + Warning: Additional NOP may be necessary to workaround Itanium + processor A/B step errata */ + +/* { dg-prune-output "Assembler messages" } */ +/* { dg-prune-output "Additional NOP may be necessary" } */ + + +__complex__ float +func (__complex__ float x) +{ + if (__real__ x == 0.0) + return 1.0; + else + return 0.0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/990107-1.c b/gcc/testsuite/gcc.c-torture/compile/990107-1.c new file mode 100644 index 000000000..a123ce9cb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990107-1.c @@ -0,0 +1,7 @@ +static int +java_double_finite (d) + double d; +{ + long long *ip = (long long *) &d; + return (*ip & 0x7ff0000000000000LL ) != 0x7ff0000000000000LL ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/990117-1.c b/gcc/testsuite/gcc.c-torture/compile/990117-1.c new file mode 100644 index 000000000..dda522059 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990117-1.c @@ -0,0 +1,13 @@ +static void +__bb_init_prg () +{ + const char *p; + + { + unsigned long l; + + (__extension__ (__builtin_constant_p (p) && __builtin_constant_p (l) + ? 5 : 2)); + } + +} diff --git a/gcc/testsuite/gcc.c-torture/compile/990203-1.c b/gcc/testsuite/gcc.c-torture/compile/990203-1.c new file mode 100644 index 000000000..2c69a8fe0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990203-1.c @@ -0,0 +1,7 @@ +int +f (f) + float f; +{ + long long *ip = (long long *) &f; + return (*ip & 0x7ff0000000000000LL ) != 0x7ff0000000000000LL ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/990517-1.c b/gcc/testsuite/gcc.c-torture/compile/990517-1.c new file mode 100644 index 000000000..c738d4be7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990517-1.c @@ -0,0 +1,30 @@ +/* Extracted from the sdm module in perl. */ +typedef struct { + char *dptr; + int dsize; +} datum; +extern long sdbm_hash (char *, int) ; +extern void sdbm__putpair (char *, datum, datum) ; +void +sdbm__splpage (char *pag, char *New, long int sbit) +{ + datum key; + datum val; + register int n; + register int off = 1024 ; + char cur[1024 ]; + register short *ino = (short *) cur; + (void) memcpy(cur, pag, 1024 ); + (void) ({ void *__s = ( pag ); __builtin_memset ( __s , '\0', 1024 ) ; __s; }); + (void) ({ void *__s = ( New ); __builtin_memset ( __s , '\0', 1024 ) ; __s; }); + n = ino[0]; + for (ino++; n > 0; ino += 2) { + key.dptr = cur + ino[0]; + key.dsize = off - ino[0]; + val.dptr = cur + ino[1]; + val.dsize = ino[0] - ino[1]; + (void) sdbm__putpair ((sdbm_hash(( key ).dptr, ( key ).dsize) & sbit) ? New : pag, key, val); + off = ino[1]; + n -= 2; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/990519-1.c b/gcc/testsuite/gcc.c-torture/compile/990519-1.c new file mode 100644 index 000000000..9c1161782 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990519-1.c @@ -0,0 +1,10 @@ + typedef int gboolean; + + typedef struct{ + gboolean names : 1; + gboolean types : 1; + } ParamOptions; + + int p_param(ParamOptions* o){ + return o->types && o->names; + } diff --git a/gcc/testsuite/gcc.c-torture/compile/990523-1.c b/gcc/testsuite/gcc.c-torture/compile/990523-1.c new file mode 100644 index 000000000..5ab61f36c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990523-1.c @@ -0,0 +1,30 @@ +extern float decwin[512+32]; + +int synth_1to1(float *bandPtr,int channel,unsigned char *out,int *pnt) +{ + static const int step = 2; + short *samples = (short *) (out+*pnt); + + float *b0; + int clip = 0; + int bo1; + + { + register int j; + float *window = decwin + 16 - bo1; + for (j=15;j;j--,b0-=0x20,window-=0x10,samples+=step) + { + float sum; + sum -= *(--window) * *b0++; + sum -= *(--window) * *b0++; + sum -= *(--window) * *b0++; + sum -= *(--window) * *b0++; + sum -= *(--window) * *b0++; + sum -= *(--window) * *b0++; + sum -= *(--window) * *b0++; + sum -= *(--window) * *b0++; + + if( ( sum ) > 32767.0) *( samples ) = 0x7fff; ( clip )++; ; + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/990527-1.c b/gcc/testsuite/gcc.c-torture/compile/990527-1.c new file mode 100644 index 000000000..474403030 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990527-1.c @@ -0,0 +1,37 @@ +typedef struct { + int dummy; + int width, height; +} XWindowAttributes; + +typedef struct { + short x, y; +} XPoint; + +extern unsigned int ya_random (void); +extern int XDrawPoints(XPoint*, int); + +static int iterations, offset; +static int xsym, ysym; + +static void +hurm (void) +{ + XWindowAttributes xgwa; + int xlim, ylim, x, y, i; + XPoint points [4]; + + + for (i = 0; i < iterations; i++) + { + int j = 0; + j++; + if (xsym) + { + points [j].x = xlim - x; + j++; + } + points [j].x = x; + j++; + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/990617-1.c b/gcc/testsuite/gcc.c-torture/compile/990617-1.c new file mode 100644 index 000000000..e9d3cf336 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990617-1.c @@ -0,0 +1,21 @@ +/* 0x70000000 is too large a constant to become a pointer on + xstormy16. */ +/* { dg-do assemble } */ +/* { dg-xfail-if "" { xstormy16-*-* } { "*" } { "" } } */ + +int main() +{ + do { + long l; + long *p = &l; + + *p = 0x0000000070000000L; + p += 2; + { + unsigned int *addr = (unsigned int *)0x70000000; + printf("%d, %d\n", addr[1], addr[0]); + } + + } while (1); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/990625-1.c b/gcc/testsuite/gcc.c-torture/compile/990625-1.c new file mode 100644 index 000000000..97a2331c7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990625-1.c @@ -0,0 +1,12 @@ +#define __USE_STRING_INLINES +#include + +void test() +{ + char *p, *a; + const char *s; + + while ( (s = a) ) + p = strcpy(strcpy(p,"/"), s); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/990625-2.c b/gcc/testsuite/gcc.c-torture/compile/990625-2.c new file mode 100644 index 000000000..92c33742b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990625-2.c @@ -0,0 +1,12 @@ +void +broken030599(int *n) +{ + int i, x; + for (i = 0; i < 32; i++) { + x=0; + x++; + if (i & 4) + x++; + x++; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/990801-1.c b/gcc/testsuite/gcc.c-torture/compile/990801-1.c new file mode 100644 index 000000000..d35ec87b9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990801-1.c @@ -0,0 +1,26 @@ +extern int getch(); +extern int class(); + +int +token() +{ + int state = 1; + + while (1) { + int c=0; + c = getch(); + switch (state) { + case 1: break; + case 4: break; + case 5: break; + case 6: + { + switch (class(c)) { + default: break; + } + } break; + case 7: break; + } + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/990801-2.c b/gcc/testsuite/gcc.c-torture/compile/990801-2.c new file mode 100644 index 000000000..0a575ea17 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990801-2.c @@ -0,0 +1,11 @@ +void f() +{ + extern char* p; + int ch; + while (!(ch = 0)) { + if ((ch == 0) || (ch == 2)) { + break; + } + *p = 0; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/990829-1.c b/gcc/testsuite/gcc.c-torture/compile/990829-1.c new file mode 100644 index 000000000..225282193 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990829-1.c @@ -0,0 +1,13 @@ +struct x +{ + int a:16; + int b:16; + int c; +}; + +bar() +{ + struct x y; + y.b = 1 < y.a; + foo(&y); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/990913-1.c b/gcc/testsuite/gcc.c-torture/compile/990913-1.c new file mode 100644 index 000000000..cad31a022 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990913-1.c @@ -0,0 +1,10 @@ + +int f() +{ + unsigned char hrs, min; + + min = ((min / 10) << 4) + min % 10; + hrs = ((hrs / 10) << 4) + hrs % 10; + + return hrs + min; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/990928-1.c b/gcc/testsuite/gcc.c-torture/compile/990928-1.c new file mode 100644 index 000000000..5658e3605 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990928-1.c @@ -0,0 +1,10 @@ +/* Make sure that debug information can be generated + for inline functions containing incomplete type + declarations. */ +inline int foo (void) +{ + struct imcomplete1 * ptr1; + union incomplete2 * ptr2; + enum incomplete3 * ptr3; + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/991008-1.c b/gcc/testsuite/gcc.c-torture/compile/991008-1.c new file mode 100644 index 000000000..ba668fe25 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991008-1.c @@ -0,0 +1,23 @@ +typedef struct { + int x; +} FILE; +extern void fputs (const char *, FILE *); + +int mView; +void foo (FILE * out, int aIndent) +{ + if (0 != mView) { + aIndent++; + aIndent--; + { + int __t = aIndent; + while (--__t >= 0) + fputs (" ", out); + } + + } { + int __t = aIndent; + while (--__t >= 0) + fputs (" ", out); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/991026-1.c b/gcc/testsuite/gcc.c-torture/compile/991026-1.c new file mode 100644 index 000000000..191742112 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991026-1.c @@ -0,0 +1,13 @@ +void something_f(float); + +int foo(void) +{ + union + { + float f; + double d; + } u, *pu = &u; + + u.f = 1.0; + something_f(u.f); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/991026-2.c b/gcc/testsuite/gcc.c-torture/compile/991026-2.c new file mode 100644 index 000000000..bb358f411 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991026-2.c @@ -0,0 +1,33 @@ +typedef int __pid_t; +extern __pid_t fork (void) ; +extern int printf (__const char *__restrict __format, ...) ; +extern char *strerror (int __errnum) ; +extern int errno; +extern int *__errno_location (void) __attribute__ ((__const__)); +extern void _exit (int __status) __attribute__ ((__noreturn__)); +extern void exit (int __status) __attribute__ ((__noreturn__)); +extern int close (int __fd) ; +extern int dup (int __fd) ; +extern int open (__const char *__file, int __oflag, ...) ; + + +char myname[]="foo"; + +detach() +{ + switch(fork()) { + case -1: + printf("%s: Error: fork - %s\n",myname, strerror((*__errno_location ()) )); + exit(255); + case 0: + + close(0); + close(1); + close(2); + dup(dup(open("/dev/null", 02 ))); + return; + default: + + _exit(0); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/991127-1.c b/gcc/testsuite/gcc.c-torture/compile/991127-1.c new file mode 100644 index 000000000..86098d883 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991127-1.c @@ -0,0 +1,12 @@ + +extern void foo (int *); + +static void bar (char *buf) +{ + int a; + foo (&a); + while (a > 0) { + *buf++ = '0'; + a--; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/991202-1.c b/gcc/testsuite/gcc.c-torture/compile/991202-1.c new file mode 100644 index 000000000..cc4f478f5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991202-1.c @@ -0,0 +1,18 @@ +extern float A[], B[]; +extern float MAXNUMF; +float chbevlf(float, float *, int); +float expf(float), i1f(float), logf(float), sqrtf(float); + +float k1f(float xx) +{ + float x, y; + + x = xx; + if( x <= 2.0 ) + { + y = x * x - 2.0; + y = logf( 0.5f * x ) * i1f(x) + chbevlf( y, A, 7 ) / x; + return( y ); + } + return( expf(-x) * chbevlf( (float)(8.0/x - 2.0), B, 10 ) / sqrtf(x) ); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/991208-1.c b/gcc/testsuite/gcc.c-torture/compile/991208-1.c new file mode 100644 index 000000000..1bee1e84b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991208-1.c @@ -0,0 +1,4 @@ +void fn (char *ptr) +{ + void *p = ptr - 8 - 4; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/991213-1.c b/gcc/testsuite/gcc.c-torture/compile/991213-1.c new file mode 100644 index 000000000..4803d1391 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991213-1.c @@ -0,0 +1,13 @@ +typedef __complex__ double double_complex; + + + +void +p (const double_complex *t, int n) +{ + int i; + double s = ({ typeof ( t[n/2] ) arg = ( t[n/2] ); (__imag__ arg); }) ; + for (i = 1; i < n/2; i++) + s += 2* ({ typeof ( t[i] ) arg = ( t[i] ); (__imag__ arg); }) ; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/991213-2.c b/gcc/testsuite/gcc.c-torture/compile/991213-2.c new file mode 100644 index 000000000..98385d562 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991213-2.c @@ -0,0 +1,15 @@ +typedef long __kernel_time_t; +typedef __kernel_time_t time_t; +time2( + void (* const (funcp)(time_t)), + const long offset, int * const okayp) +{ + register int bits; + time_t t; + for (bits = 0, t = 1; t > 0; ++bits, t <<= 1) + ; + t = (t < 0) ? 0 : ((time_t) 1 << bits); + for ( ; ; ) { + (*funcp)((time_t)&t); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/991213-3.c b/gcc/testsuite/gcc.c-torture/compile/991213-3.c new file mode 100644 index 000000000..ce8347f5d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991213-3.c @@ -0,0 +1,2 @@ +int jump () { goto * (int (*) ()) 0xbabebec0; } + diff --git a/gcc/testsuite/gcc.c-torture/compile/991214-1.c b/gcc/testsuite/gcc.c-torture/compile/991214-1.c new file mode 100644 index 000000000..2748a15af --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991214-1.c @@ -0,0 +1,11 @@ +void foo(double bar[], double *zp, int n) +{ + int i, j; + + i = 0; + for(j = 0; j < n; j++) + { + i += j+1; + bar[i] *= (1.0 + *zp); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/991214-2.c b/gcc/testsuite/gcc.c-torture/compile/991214-2.c new file mode 100644 index 000000000..3e18d215e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/991214-2.c @@ -0,0 +1,28 @@ +#if defined(STACK_SIZE) && (STACK_SIZE < 65536) +# define HISTO_SIZE 9 +#else +# define HISTO_SIZE 36 +#endif + +extern int N; +extern int nrows; +extern int or_num_angles; + +typedef struct +{ + double value; + int count; +}Histo; + +Histo add_histo[10][2][HISTO_SIZE][HISTO_SIZE]; + +void cmd_connection_statistics( ) +{ + int i,j,k,m; + + for(i=0; i 8192) + bar (x); + else + ({ __here: (unsigned long) &&__here; }); +} + +void +test (void) +{ + baz (16384); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/bcopy-1.c b/gcc/testsuite/gcc.c-torture/compile/bcopy-1.c new file mode 100644 index 000000000..5d3a882c8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/bcopy-1.c @@ -0,0 +1,14 @@ +/* PR middle-end/31095, expand_builtin_memmove_args forgot to take into + account that tree folding of builtins can add an extra NOP_EXPR. */ + +struct timeval +{ + int tv_sec; + int tv_usec; +}; +void +capture_next_packet (void) +{ + struct timeval past, now, then; + __builtin_bcopy (&then, &past, sizeof (then)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/builtin_constant_p.c b/gcc/testsuite/gcc.c-torture/compile/builtin_constant_p.c new file mode 100644 index 000000000..8b18c8af5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/builtin_constant_p.c @@ -0,0 +1,6 @@ +int main (int argc, char *argv[]) +{ + static int a[] = { __builtin_constant_p (argc) ? 1 : 0 }; + return a[0]; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/builtin_unreachable-1.c b/gcc/testsuite/gcc.c-torture/compile/builtin_unreachable-1.c new file mode 100644 index 000000000..dd32ca806 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/builtin_unreachable-1.c @@ -0,0 +1,6 @@ +void bar (const char *); +void foo (void) +{ + bar ("foo"); + __builtin_unreachable (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/calls.c b/gcc/testsuite/gcc.c-torture/compile/calls.c new file mode 100644 index 000000000..1582c0e92 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/calls.c @@ -0,0 +1,22 @@ +typedef void *(*T)(void); +f1 () +{ + ((T) 0)(); +} +f2 () +{ + ((T) 1000)(); +} +f3 () +{ + ((T) 10000000)(); +} +f4 (r) +{ + ((T) r)(); +} +f5 () +{ + int (*r)() = f3; + ((T) r)(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/cmpdi-1.c b/gcc/testsuite/gcc.c-torture/compile/cmpdi-1.c new file mode 100644 index 000000000..9e1b659c7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/cmpdi-1.c @@ -0,0 +1,15 @@ +f (long long d) +{ + int i = 0; + if (d == 1) + i = 1; + return i; +} + +g (long long d) +{ + int i = 0; + if (d <= 0) + i = 1; + return i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/combine-hang.c b/gcc/testsuite/gcc.c-torture/compile/combine-hang.c new file mode 100644 index 000000000..7cc57afe6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/combine-hang.c @@ -0,0 +1,26 @@ +typedef union +{ + double value; + struct + { + unsigned long msw; + unsigned long lsw; + } parts; +} ieee_double_shape_type; + +double f (int iy) +{ + double z, t; + ieee_double_shape_type u, v; + + if (iy == 1) + return 0; + + u.parts.msw = iy; + u.parts.lsw = 0; + z = u.value; + v.parts.msw = iy; + v.parts.lsw = 0; + t = v.value; + return 1.0+z+t+t; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/compile.exp b/gcc/testsuite/gcc.c-torture/compile/compile.exp new file mode 100644 index 000000000..01c5644ff --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/compile.exp @@ -0,0 +1,34 @@ +# Expect driver script for GCC Regression Tests +# Copyright (C) 1993, 1995, 1997, 2003, 2007 Free Software Foundation +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# These tests come from Torbjorn Granlund's (tege@cygnus.com) +# C torture test suite, and other contributors. + +# Load support procs. +load_lib gcc-dg.exp + +# Initialize `dg'. +dg-init + +# Main loop. +set saved-dg-do-what-default ${dg-do-what-default} +set dg-do-what-default "assemble" +gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-w" +set dg-do-what-default ${saved-dg-do-what-default} + +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.c-torture/compile/complex-1.c b/gcc/testsuite/gcc.c-torture/compile/complex-1.c new file mode 100644 index 000000000..6ba9f0469 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/complex-1.c @@ -0,0 +1,12 @@ +extern void u (int, int); +extern void v (float, float); + +void f (__complex__ int x) +{ + u (0, x); +} + +void g (__complex__ float x) +{ + v (0, x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/complex-2.c b/gcc/testsuite/gcc.c-torture/compile/complex-2.c new file mode 100644 index 000000000..4462eee45 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/complex-2.c @@ -0,0 +1,16 @@ +/* PR 22103 */ + +_Complex float f(void); +void *a; + +_Complex float g(void) +{ + _Complex float x = f(); + __imag__ x = 1.0; + if (__imag__ x != 1.0) + { + a = &x; + } + return x; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/complex-3.c b/gcc/testsuite/gcc.c-torture/compile/complex-3.c new file mode 100644 index 000000000..f12a8f9da --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/complex-3.c @@ -0,0 +1,17 @@ +/* PR 22116 */ + +void g(_Complex float); +_Complex float f(int data, _Complex float x, _Complex float y) +{ + _Complex float i, t; + if (data) + { + i = x + __imag__ y; + g(i); + } + else + i = 5; + t = x + __imag__ y; + g(t); + return t * i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/complex-4.c b/gcc/testsuite/gcc.c-torture/compile/complex-4.c new file mode 100644 index 000000000..cf1002903 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/complex-4.c @@ -0,0 +1,9 @@ +/* This used to ICE because gimplify_modify_expr_complex_part was not + updated for the GIMPLE_MODIFY_EXPR changes in that calling + tree_to_gimple_tuple was needed. */ + +void f(void) +{ + double _Complex Res; + __real__ Res = __imag__ Res = 0.0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/complex-5.c b/gcc/testsuite/gcc.c-torture/compile/complex-5.c new file mode 100644 index 000000000..59ddf68be --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/complex-5.c @@ -0,0 +1,9 @@ +int foo(__complex__ int z0, __complex__ int z1) +{ + return z0 != 0 || z1 != 0; +} + +int foo1(__complex__ int z0, __complex__ int z1) +{ + return z0 == 0 && z1 == 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/complex-6.c b/gcc/testsuite/gcc.c-torture/compile/complex-6.c new file mode 100644 index 000000000..eb89040ab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/complex-6.c @@ -0,0 +1,17 @@ +/* PR tree-opt/35737 */ + +long buf[10]; + +int foo() +{ + __complex__ int i = 0; + + if (__builtin_setjmp(buf)) + { + i = 1; + bar(); + } + + return i == 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/compound-literal-1.c b/gcc/testsuite/gcc.c-torture/compile/compound-literal-1.c new file mode 100644 index 000000000..968bb450a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/compound-literal-1.c @@ -0,0 +1,9 @@ +/* ICE incrementing compound literal: bug 28418 from Volker Reichelt + . */ + +struct A { int i; }; + +void foo() +{ + ((struct A) { 0 }).i += 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/compound-literal-2.c b/gcc/testsuite/gcc.c-torture/compile/compound-literal-2.c new file mode 100644 index 000000000..7e2f30400 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/compound-literal-2.c @@ -0,0 +1,8 @@ +/* PR C/30265, invalid gimple was produced because we did not mark + the compound literal's decl early enough. */ + +int f(float *); +int g(float x) +{ + return f(&(float){x}) + f(&x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/compound-literal-3.c b/gcc/testsuite/gcc.c-torture/compile/compound-literal-3.c new file mode 100644 index 000000000..bcd413c9c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/compound-literal-3.c @@ -0,0 +1,8 @@ +/* PR C/30265, invalid gimple was produced because we did not mark + the compound literal's decl early enough. */ + +int f(_Complex float *); +int g(_Complex float x) +{ + return f(&(_Complex float){x+1}) + f(&x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/const-high-part.c b/gcc/testsuite/gcc.c-torture/compile/const-high-part.c new file mode 100644 index 000000000..95e205970 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/const-high-part.c @@ -0,0 +1,19 @@ +/* { dg-require-effective-target int32plus } */ +/* { dg-require-effective-target size32plus } */ + +char *buf; +int buflen; + +inline int +sub (int length) +{ + if (length <= buflen) + buf[length] = '\0'; + return 0; +} + +int +sub2 (void) +{ + return sub (0x7fffffff); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/cpp-1.c b/gcc/testsuite/gcc.c-torture/compile/cpp-1.c new file mode 100644 index 000000000..09d49bc61 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/cpp-1.c @@ -0,0 +1,8 @@ +/* Copyright (C) 2000 Free Software Foundation. + + by Alexandre Oliva */ + +#define foo/**/1 +#if foo != 1 +# error "foo not properly defined" +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/cpp-2.c b/gcc/testsuite/gcc.c-torture/compile/cpp-2.c new file mode 100644 index 000000000..ae9425f09 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/cpp-2.c @@ -0,0 +1,5 @@ +/* Copyright (C) 2000 Free Software Foundation. + + by Alexandre Oliva */ + +#pragma /* the token after #pragma is optional. */ diff --git a/gcc/testsuite/gcc.c-torture/compile/debugvlafunction-1.c b/gcc/testsuite/gcc.c-torture/compile/debugvlafunction-1.c new file mode 100644 index 000000000..3911f87bc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/debugvlafunction-1.c @@ -0,0 +1,11 @@ +extern void dynreplace_trampoline(void); +extern void dynreplace_trampoline_endlabel(void); +int dynreplace_add_trampoline(void) +{ + unsigned long trampoline_code[(((unsigned long) +(&(dynreplace_trampoline_endlabel)) +-(unsigned long) (&dynreplace_trampoline))) +]; +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/dll.c b/gcc/testsuite/gcc.c-torture/compile/dll.c new file mode 100644 index 000000000..7f7bfcee5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/dll.c @@ -0,0 +1,23 @@ +/* { dg-require-dll "" } */ + +__declspec (dllimport) int foo; +extern int (* import) (void) __attribute__((dllimport)); +int func2 (void) __attribute__((dllexport)); + +__declspec(dllexport) int +func1 (int a) +{ + return a + foo; +} + +static int +internal (void) +{ + return 77; +} + +int +func2 (void) +{ + return import (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/fix-trunc-mem-1.c b/gcc/testsuite/gcc.c-torture/compile/fix-trunc-mem-1.c new file mode 100644 index 000000000..dbd428259 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/fix-trunc-mem-1.c @@ -0,0 +1,12 @@ +/* PR target/14201 */ +/* Excercise float -> integer in memory patterns. */ +/* { dg-add-options ieee } */ + +void f1 (float v, int *p) { *p = v; } +void f2 (float v, unsigned int*p) { *p = v; } +void f3 (float v, long long *p) { *p = v; } +void f4 (float v, unsigned long long *p) { *p = v; } +void f5 (double v, int *p) { *p = v; } +void f6 (double v, unsigned int *p) { *p = v; } +void f7 (double v, long long *p) { *p = v; } +void f8 (double v, unsigned long long *p) { *p = v; } diff --git a/gcc/testsuite/gcc.c-torture/compile/funcptr-1.c b/gcc/testsuite/gcc.c-torture/compile/funcptr-1.c new file mode 100644 index 000000000..79687c9c0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/funcptr-1.c @@ -0,0 +1,19 @@ +extern int (*gp)(const char*); + +int +g (const char* d) +{ + printf ("g"); + return 0; +} + +f () +{ + int errcnt=0; + + if (gp != g) + { + printf ("f"); + errcnt++; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/goto-1.c b/gcc/testsuite/gcc.c-torture/compile/goto-1.c new file mode 100644 index 000000000..caeed3aa0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/goto-1.c @@ -0,0 +1,16 @@ +f () +{ + do + { + if (0) + { + L1:; + } + else + goto L2; + L2:; + } + while (0); + + goto L1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/iftrap-1.c b/gcc/testsuite/gcc.c-torture/compile/iftrap-1.c new file mode 100644 index 000000000..a0adc78cf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/iftrap-1.c @@ -0,0 +1,99 @@ +/* Verify that ifcvt doesn't crash under a number of interesting conditions. */ + +void f1(int p) +{ + if (p) + __builtin_trap(); +} + +void f2(int p) +{ + if (p) + __builtin_trap(); + else + bar(); +} + +void f3(int p) +{ + if (p) + bar(); + else + __builtin_trap(); +} + +void f4(int p, int q) +{ + if (p) + { + bar(); + if (q) + bar(); + } + else + __builtin_trap(); +} + +void f5(int p) +{ + if (p) + __builtin_trap(); + else + abort(); +} + +void f6(int p) +{ + if (p) + abort(); + else + __builtin_trap(); +} + +void f7(int p) +{ + if (p) + __builtin_trap(); + else + __builtin_trap(); +} + +void f8(int p) +{ + if (p) + __builtin_trap(); + else + { + bar(); + __builtin_trap(); + } +} + +void f9(int p) +{ + if (p) + { + bar(); + __builtin_trap(); + } + else + __builtin_trap(); +} + +void f10(int p) +{ + if (p) + __builtin_trap(); + while (1) + bar(); +} + +void f11(int p) +{ + if (p) + __builtin_trap(); + else + bar(); + while (1) + baz(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/iftrap-2.c b/gcc/testsuite/gcc.c-torture/compile/iftrap-2.c new file mode 100644 index 000000000..bb7bb5726 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/iftrap-2.c @@ -0,0 +1,10 @@ +void foo(int p, int q) +{ + if (p) + { + if (q) + __builtin_trap (); + } + else + bar(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/iftrap-3.c b/gcc/testsuite/gcc.c-torture/compile/iftrap-3.c new file mode 100644 index 000000000..52278e145 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/iftrap-3.c @@ -0,0 +1,4 @@ +/* Check that the conditional_trap pattern handles floating-point + comparisons correctly. */ +void f1 (float x, float y) { if (x == y) __builtin_trap (); } +void f2 (double x, double y) { if (x == y) __builtin_trap (); } diff --git a/gcc/testsuite/gcc.c-torture/compile/init-1.c b/gcc/testsuite/gcc.c-torture/compile/init-1.c new file mode 100644 index 000000000..38db9ad87 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/init-1.c @@ -0,0 +1,19 @@ +typedef struct +{ + char *key; + char *value; +} T1; + +typedef struct +{ + long type; + char *value; +} T3; + +T1 a[] = +{ + { + "", + ((char *)&((T3) {1, (char *) 1})) + } +}; diff --git a/gcc/testsuite/gcc.c-torture/compile/init-2.c b/gcc/testsuite/gcc.c-torture/compile/init-2.c new file mode 100644 index 000000000..63a7f5849 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/init-2.c @@ -0,0 +1,4 @@ +struct +{ + int e1, e2; +} v = { e2: 0 }; diff --git a/gcc/testsuite/gcc.c-torture/compile/init-3.c b/gcc/testsuite/gcc.c-torture/compile/init-3.c new file mode 100644 index 000000000..be3d9b496 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/init-3.c @@ -0,0 +1,11 @@ +struct empty { }; +struct something { + int spacer; + struct empty foo; + int bar; +}; + +struct something X = { + foo: { }, + bar: 1, +}; diff --git a/gcc/testsuite/gcc.c-torture/compile/inline-1.c b/gcc/testsuite/gcc.c-torture/compile/inline-1.c new file mode 100644 index 000000000..23af7cb2b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/inline-1.c @@ -0,0 +1,21 @@ +typedef __builtin_va_list va_list; + +extern void foo (va_list); + +static void +build_message_string (const char *msg, ...) +{ + va_list ap; + + __builtin_va_start (ap, msg); + foo (ap); + __builtin_va_end (ap); +} + +void +file_name_as_prefix (f) + const char *f; +{ + build_message_string ("%s: ", f); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/labels-1.c b/gcc/testsuite/gcc.c-torture/compile/labels-1.c new file mode 100644 index 000000000..fae6ab8f4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/labels-1.c @@ -0,0 +1,13 @@ +#ifndef NO_LABEL_VALUES +f () +{ + void *x = &&L2; + if (&&L3 - &&L1 > 1) + abort(); + L1: return 1; + L2: abort (); + L3:; +} +#else +int x; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/labels-2.c b/gcc/testsuite/gcc.c-torture/compile/labels-2.c new file mode 100644 index 000000000..cf4f116e6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/labels-2.c @@ -0,0 +1,10 @@ +struct bp { void *v, *b, *e; }; +f () +{ + struct bp x = { &&L2 }; + if (&&L3 - &&L1 > 1) + abort (); +L1:return 1; +L2:abort (); +L3:; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/labels-3.c b/gcc/testsuite/gcc.c-torture/compile/labels-3.c new file mode 100644 index 000000000..14eb9522f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/labels-3.c @@ -0,0 +1,18 @@ +/* This test does not compile on mips-irix6 using the native assembler, + though it does work with gas. See PR6200. Since we cannot (???) + distinguish which assembler is being used, always pass -S for + irix. */ +/* { dg-options "-w -S" { target mips*-*-irix* } } */ + +/* Verify that we can narrow the storage associated with label diffs. */ + +int foo (int a) +{ + static const short ar[] = { &&l1 - &&l1, &&l2 - &&l1 }; + void *p = &&l1 + ar[a]; + goto *p; + l1: + return 1; + l2: + return 2; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/libcall-1.c b/gcc/testsuite/gcc.c-torture/compile/libcall-1.c new file mode 100644 index 000000000..c1b1cfc61 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/libcall-1.c @@ -0,0 +1,14 @@ +/* Failed on ARM because rtx_varies_p didn't like the REG_EQUAL notes + generated for libcalls. + http://gcc.gnu.org/ml/gcc-patches/2004-02/msg01518.html */ +static const char digs[] = "0123456789ABCDEF"; +int __attribute__((pure)) bar(); + +int foo (int i) +{ + int len; + if (i) + return 0; + len = bar(); + return digs[len]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-blockid.c b/gcc/testsuite/gcc.c-torture/compile/limits-blockid.c new file mode 100644 index 000000000..545dfe4dc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-blockid.c @@ -0,0 +1,22 @@ +#define LIM1(x) x##0; x##1; x##2; x##3; x##4; x##5; x##6; x##7; x##8; x##9; +#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \ + LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9) +#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \ + LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9) +#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \ + LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9) +#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \ + LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9) +#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \ + LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9) +#define LIM7(x) LIM6(x##0) LIM6(x##1) LIM6(x##2) LIM6(x##3) LIM6(x##4) \ + LIM6(x##5) LIM6(x##6) LIM6(x##7) LIM6(x##8) LIM6(x##9) + +void q9_func(void) +{ +#if __INT_MAX__ >= 100000 + LIM5(char t) +#else + LIM4(char t) +#endif +} diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-caselabels.c b/gcc/testsuite/gcc.c-torture/compile/limits-caselabels.c new file mode 100644 index 000000000..08e8195bf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-caselabels.c @@ -0,0 +1,21 @@ +#define LIM1(x) x##0: x##1: x##2: x##3: x##4: x##5: x##6: x##7: x##8: x##9: +#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \ + LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9) +#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \ + LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9) +#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \ + LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9) +#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \ + LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9) +#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \ + LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9) +#define LIM7(x) LIM6(x##0) LIM6(x##1) LIM6(x##2) LIM6(x##3) LIM6(x##4) \ + LIM6(x##5) LIM6(x##6) LIM6(x##7) LIM6(x##8) LIM6(x##9) + +void q19_func (long i) +{ + switch (i) { + LIM5 (case 1) + break; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-declparen.c b/gcc/testsuite/gcc.c-torture/compile/limits-declparen.c new file mode 100644 index 000000000..ee8558006 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-declparen.c @@ -0,0 +1,16 @@ +/* { dg-xfail-if "" { alpha*-dec-osf5* } { "-g" } { "" } } */ +#define PTR1 (* (* (* (* (* (* (* (* (* (* +#define PTR2 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 +#define PTR3 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 +#define PTR4 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 +#define PTR5 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 +#define PTR6 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 + +#define RBR1 ) ) ) ) ) ) ) ) ) ) +#define RBR2 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 +#define RBR3 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 +#define RBR4 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 +#define RBR5 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 +#define RBR6 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 + +int PTR4 q4_var RBR4 = 0; diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-enumconst.c b/gcc/testsuite/gcc.c-torture/compile/limits-enumconst.c new file mode 100644 index 000000000..975cafc83 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-enumconst.c @@ -0,0 +1,22 @@ +#define LIM1(x) x##0, x##1, x##2, x##3, x##4, x##5, x##6, x##7, x##8, x##9, +#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \ + LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9) +#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \ + LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9) +#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \ + LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9) +#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \ + LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9) +#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \ + LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9) +#define LIM7(x) LIM6(x##0) LIM6(x##1) LIM6(x##2) LIM6(x##3) LIM6(x##4) \ + LIM6(x##5) LIM6(x##6) LIM6(x##7) LIM6(x##8) LIM6(x##9) + +enum q21_enum +{ +#if __INT_MAX__ >= 100000 + LIM5 (e) +#else + LIM4 (e) +#endif +}; diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-exprparen.c b/gcc/testsuite/gcc.c-torture/compile/limits-exprparen.c new file mode 100644 index 000000000..2c6dce04a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-exprparen.c @@ -0,0 +1,15 @@ +#define LBR1 ( ( ( ( ( ( ( ( ( ( +#define LBR2 LBR1 LBR1 LBR1 LBR1 LBR1 LBR1 LBR1 LBR1 LBR1 LBR1 +#define LBR3 LBR2 LBR2 LBR2 LBR2 LBR2 LBR2 LBR2 LBR2 LBR2 LBR2 +#define LBR4 LBR3 LBR3 LBR3 LBR3 LBR3 LBR3 LBR3 LBR3 LBR3 LBR3 +#define LBR5 LBR4 LBR4 LBR4 LBR4 LBR4 LBR4 LBR4 LBR4 LBR4 LBR4 +#define LBR6 LBR5 LBR5 LBR5 LBR5 LBR5 LBR5 LBR5 LBR5 LBR5 LBR5 + +#define RBR1 ) ) ) ) ) ) ) ) ) ) +#define RBR2 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 +#define RBR3 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 +#define RBR4 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 +#define RBR5 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 +#define RBR6 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 + +int q5_var = LBR4 0 RBR4; diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-externalid.c b/gcc/testsuite/gcc.c-torture/compile/limits-externalid.c new file mode 100644 index 000000000..1b316c791 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-externalid.c @@ -0,0 +1,15 @@ +#define LIM1(x) x##0; x##1; x##2; x##3; x##4; x##5; x##6; x##7; x##8; x##9; +#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \ + LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9) +#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \ + LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9) +#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \ + LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9) +#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \ + LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9) +#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \ + LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9) +#define LIM7(x) LIM6(x##0) LIM6(x##1) LIM6(x##2) LIM6(x##3) LIM6(x##4) \ + LIM6(x##5) LIM6(x##6) LIM6(x##7) LIM6(x##8) LIM6(x##9) + +LIM5(char t) diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-externdecl.c b/gcc/testsuite/gcc.c-torture/compile/limits-externdecl.c new file mode 100644 index 000000000..c484becb8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-externdecl.c @@ -0,0 +1,56 @@ +/* Inspired by the test case for PR middle-end/52640. */ + +typedef struct +{ + char *value; +} REFERENCE; + +/* Add a few "extern int Xxxxxx ();" declarations. */ +#undef DEF +#undef LIM1 +#undef LIM2 +#undef LIM3 +#undef LIM4 +#undef LIM5 +#undef LIM6 +#define DEF(x) extern int x () +#define LIM1(x) DEF(x##0); DEF(x##1); DEF(x##2); DEF(x##3); DEF(x##4); \ + DEF(x##5); DEF(x##6); DEF(x##7); DEF(x##8); DEF(x##9); +#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \ + LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9) +#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \ + LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9) +#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \ + LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9) +#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \ + LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9) +#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \ + LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9) +LIM5 (X); + +/* Add references to them, or GCC will simply ignore the extern decls. */ +#undef DEF +#undef LIM1 +#undef LIM2 +#undef LIM3 +#undef LIM4 +#undef LIM5 +#undef LIM6 +#define DEF(x) (char *) x +#define LIM1(x) DEF(x##0), DEF(x##1), DEF(x##2), DEF(x##3), DEF(x##4), \ + DEF(x##5), DEF(x##6), DEF(x##7), DEF(x##8), DEF(x##9), +#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \ + LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9) +#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \ + LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9) +#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \ + LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9) +#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \ + LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9) +#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \ + LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9) +REFERENCE references[] = { + LIM5 (X) + 0 +}; + diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-fnargs.c b/gcc/testsuite/gcc.c-torture/compile/limits-fnargs.c new file mode 100644 index 000000000..126a2b8e7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-fnargs.c @@ -0,0 +1,23 @@ +/* { dg-timeout-factor 4.0 } */ +/* { dg-require-effective-target run_expensive_tests } */ + +#define PAR1 int, int, int, int, int, int, int, int, int, int +#define PAR2 PAR1, PAR1, PAR1, PAR1, PAR1, PAR1, PAR1, PAR1, PAR1, PAR1 +#define PAR3 PAR2, PAR2, PAR2, PAR2, PAR2, PAR2, PAR2, PAR2, PAR2, PAR2 +#define PAR4 PAR3, PAR3, PAR3, PAR3, PAR3, PAR3, PAR3, PAR3, PAR3, PAR3 +#define PAR5 PAR4, PAR4, PAR4, PAR4, PAR4, PAR4, PAR4, PAR4, PAR4, PAR4 +#define PAR6 PAR5, PAR5, PAR5, PAR5, PAR5, PAR5, PAR5, PAR5, PAR5, PAR5 + +extern void func (PAR4); + +#define ARG1 0,1,2,3,4,5,6,7,8,9 +#define ARG2 ARG1, ARG1, ARG1, ARG1, ARG1, ARG1, ARG1, ARG1, ARG1, ARG1 +#define ARG3 ARG2, ARG2, ARG2, ARG2, ARG2, ARG2, ARG2, ARG2, ARG2, ARG2 +#define ARG4 ARG3, ARG3, ARG3, ARG3, ARG3, ARG3, ARG3, ARG3, ARG3, ARG3 +#define ARG5 ARG4, ARG4, ARG4, ARG4, ARG4, ARG4, ARG4, ARG4, ARG4, ARG4 +#define ARG5HALF ARG5, ARG5, ARG5, ARG5, ARG5 + +void caller(void) +{ + func (ARG4); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-fndefn.c b/gcc/testsuite/gcc.c-torture/compile/limits-fndefn.c new file mode 100644 index 000000000..65e60b39e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-fndefn.c @@ -0,0 +1,19 @@ +/* { dg-skip-if "too complex for avr and picochip" { picochip-*-* avr-*-* } { "*" } { "" } } */ +/* { dg-timeout-factor 4.0 } */ +#define LIM1(x) x##0, x##1, x##2, x##3, x##4, x##5, x##6, x##7, x##8, x##9, +#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \ + LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9) +#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \ + LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9) +#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \ + LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9) +#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \ + LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9) +#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \ + LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9) +#define LIM7(x) LIM6(x##0) LIM6(x##1) LIM6(x##2) LIM6(x##3) LIM6(x##4) \ + LIM6(x##5) LIM6(x##6) LIM6(x##7) LIM6(x##8) LIM6(x##9) + +void func1 (LIM5(int p) int t) +{ +} diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-idexternal.c b/gcc/testsuite/gcc.c-torture/compile/limits-idexternal.c new file mode 100644 index 000000000..1f346aadf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-idexternal.c @@ -0,0 +1,11 @@ +#define LIM1 0123456789 +#define LIM2 LIM1##LIM1##LIM1##LIM1##LIM1##LIM1##LIM1##LIM1##LIM1##LIM1 +#define LIM3 LIM2##LIM2##LIM2##LIM2##LIM2##LIM2##LIM2##LIM2##LIM2##LIM2 +#define LIM4 LIM3##LIM3##LIM3##LIM3##LIM3##LIM3##LIM3##LIM3##LIM3##LIM3 +#define LIM5 LIM4##LIM4##LIM4##LIM4##LIM4##LIM4##LIM4##LIM4##LIM4##LIM4 +#define LIM6 LIM5##LIM5##LIM5##LIM5##LIM5##LIM5##LIM5##LIM5##LIM5##LIM5 + +#define V(x) v##LIM5##x + +int V(a); +int V(b); diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-idinternal.c b/gcc/testsuite/gcc.c-torture/compile/limits-idinternal.c new file mode 100644 index 000000000..cbd095ee0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-idinternal.c @@ -0,0 +1,11 @@ +#define LIM1 0123456789 +#define LIM2 LIM1##LIM1##LIM1##LIM1##LIM1##LIM1##LIM1##LIM1##LIM1##LIM1 +#define LIM3 LIM2##LIM2##LIM2##LIM2##LIM2##LIM2##LIM2##LIM2##LIM2##LIM2 +#define LIM4 LIM3##LIM3##LIM3##LIM3##LIM3##LIM3##LIM3##LIM3##LIM3##LIM3 +#define LIM5 LIM4##LIM4##LIM4##LIM4##LIM4##LIM4##LIM4##LIM4##LIM4##LIM4 +#define LIM6 LIM5##LIM5##LIM5##LIM5##LIM5##LIM5##LIM5##LIM5##LIM5##LIM5 + +#define V(x) v##LIM6##x + +static int V(a); +static int V(b); diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-pointer.c b/gcc/testsuite/gcc.c-torture/compile/limits-pointer.c new file mode 100644 index 000000000..435155566 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-pointer.c @@ -0,0 +1,9 @@ +/* { dg-xfail-if "" { alpha*-dec-osf5* } { "-g" } { "" } } */ +#define PTR1 * * * * * * * * * * +#define PTR2 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 +#define PTR3 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 +#define PTR4 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 +#define PTR5 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 +#define PTR6 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 + +int PTR4 q3_var = 0; diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-stringlit.c b/gcc/testsuite/gcc.c-torture/compile/limits-stringlit.c new file mode 100644 index 000000000..41fa2f140 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-stringlit.c @@ -0,0 +1,12 @@ +/* { dg-skip-if "Array too big" { avr-*-* picochip-*-* m32c-*-* pdp11-*-* } { "*" } { "" } } */ + +#define STR2 "012345678901234567890123456789012345678901234567890123456789\ +0123456789012345678901234567890123456789" +#define STR3 STR2 STR2 STR2 STR2 STR2 STR2 STR2 STR2 STR2 STR2 +#define STR4 STR3 STR3 STR3 STR3 STR3 STR3 STR3 STR3 STR3 STR3 +#define STR5 STR4 STR4 STR4 STR4 STR4 STR4 STR4 STR4 STR4 STR4 +#define STR6 STR5 STR5 STR5 STR5 STR5 STR5 STR5 STR5 STR5 STR5 +#define STR7 STR6 STR6 STR6 STR6 STR6 STR6 STR6 STR6 STR6 STR6 +#define STR8 STR7 STR7 STR7 STR7 STR7 STR7 STR7 STR7 STR7 STR7 + +char vlv[] = STR6; diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-structmem.c b/gcc/testsuite/gcc.c-torture/compile/limits-structmem.c new file mode 100644 index 000000000..2f2265a5e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-structmem.c @@ -0,0 +1,18 @@ +#define LIM1(x) x##0; x##1; x##2; x##3; x##4; x##5; x##6; x##7; x##8; x##9; +#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \ + LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9) +#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \ + LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9) +#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \ + LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9) +#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \ + LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9) +#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \ + LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9) +#define LIM7(x) LIM6(x##0) LIM6(x##1) LIM6(x##2) LIM6(x##3) LIM6(x##4) \ + LIM6(x##5) LIM6(x##6) LIM6(x##7) LIM6(x##8) LIM6(x##9) + +struct q20_struct +{ + LIM4 (char m) +}; diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-structnest.c b/gcc/testsuite/gcc.c-torture/compile/limits-structnest.c new file mode 100644 index 000000000..62448fb51 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/limits-structnest.c @@ -0,0 +1,23 @@ +#define LIM1(x) x##0 {x##1 {x##2 {x##3 {x##4 {x##5 {x##6 {x##7 {x##8 {x##9 { +#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \ + LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9) +#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \ + LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9) +#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \ + LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9) +#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \ + LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9) +#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \ + LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9) +#define LIM7(x) LIM6(x##0) LIM6(x##1) LIM6(x##2) LIM6(x##3) LIM6(x##4) \ + LIM6(x##5) LIM6(x##6) LIM6(x##7) LIM6(x##8) LIM6(x##9) + +#define RBR1 } x; } x; } x; } x; } x; } x; } x; } x; } x; } x; +#define RBR2 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 +#define RBR3 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 +#define RBR4 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 +#define RBR5 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 + +LIM4(struct s) + int x; +RBR4 diff --git a/gcc/testsuite/gcc.c-torture/compile/m68k-byte-addr.c b/gcc/testsuite/gcc.c-torture/compile/m68k-byte-addr.c new file mode 100644 index 000000000..88667a461 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/m68k-byte-addr.c @@ -0,0 +1,20 @@ +/* This testcase triggered an attempt to reload a byte value into an + address register. */ +extern volatile unsigned char x[]; + +#define DECLARE(I) orig##I, inc##I +#define READ(I) orig##I = x[I] +#define INC(I) inc##I = orig##I + 1 +#define WRITE1(I) x[I] = orig##I +#define WRITE2(I) x[I] = inc##I + +#define REPEAT(X) X(0), X(1), X(2), X(3), X(4), X(5), X(6), X(7), X(8) + +void foo (void) +{ + unsigned char REPEAT (DECLARE); + REPEAT (READ); + REPEAT (INC); + REPEAT (WRITE1); + REPEAT (WRITE2); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/mangle-1.c b/gcc/testsuite/gcc.c-torture/compile/mangle-1.c new file mode 100644 index 000000000..7abc934e7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/mangle-1.c @@ -0,0 +1,9 @@ +int foo(void) +{ + static int x asm ("x") = 3; + return x++; +} + +int X2 asm ("x.0") = 4; +int X3 asm ("_x.0") = 5; + diff --git a/gcc/testsuite/gcc.c-torture/compile/memcpy-1.c b/gcc/testsuite/gcc.c-torture/compile/memcpy-1.c new file mode 100644 index 000000000..4a4e75096 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/memcpy-1.c @@ -0,0 +1,9 @@ +static const char OggFLAC__MAPPING_VERSION_MAJOR = 1; +void f(void) +{ + char synthetic_first_packet_body[10]; + char *b = &synthetic_first_packet_body[4]; + __builtin_memcpy (b, &OggFLAC__MAPPING_VERSION_MAJOR, (1u)); +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/memcpy-2.c b/gcc/testsuite/gcc.c-torture/compile/memcpy-2.c new file mode 100644 index 000000000..4645ced59 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/memcpy-2.c @@ -0,0 +1,10 @@ +static const char OggFLAC__MAPPING_VERSION_MAJOR = 1; +void f(void) +{ + char synthetic_first_packet_body[10]; + char *b = synthetic_first_packet_body; + b+=4u; + __builtin_memcpy (b, &OggFLAC__MAPPING_VERSION_MAJOR, (1u)); +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/mipscop-1.c b/gcc/testsuite/gcc.c-torture/compile/mipscop-1.c new file mode 100644 index 000000000..8a40ba1c6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/mipscop-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target mips*-*-* } } */ + +register unsigned int cp0count asm ("$c0r1"); + +int __attribute__ ((nomips16)) +main (int argc, char *argv[]) +{ + unsigned int d; + + d = cp0count + 3; + printf ("%d\n", d); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/mipscop-2.c b/gcc/testsuite/gcc.c-torture/compile/mipscop-2.c new file mode 100644 index 000000000..94df41d65 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/mipscop-2.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target mips*-*-* } } */ + +register unsigned int c3r1 asm ("$c3r1"); + +extern unsigned int b, c; + +void __attribute__ ((nomips16)) +foo () +{ + unsigned int a, d; + + c3r1 = a; + b = c3r1; + + c3r1 = c; + d = c3r1; + printf ("%d\n", d); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/mipscop-3.c b/gcc/testsuite/gcc.c-torture/compile/mipscop-3.c new file mode 100644 index 000000000..cb4bd4d3e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/mipscop-3.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target mips*-*-* } } */ + +register unsigned int c3r1 asm ("$c3r1"), c3r2 asm ("$c3r2"); + +extern unsigned int b, c; + +void __attribute__ ((nomips16)) +foo () +{ + unsigned int a, d; + + c3r1 = a; + b = c3r1; + + c3r2 = c; + d = c3r1; + printf ("%d\n", d); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/mipscop-4.c b/gcc/testsuite/gcc.c-torture/compile/mipscop-4.c new file mode 100644 index 000000000..263fc5cac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/mipscop-4.c @@ -0,0 +1,19 @@ +/* { dg-do compile { target mips*-*-* } } */ + +register unsigned long c3r1 asm ("$c3r1"), c3r2 asm ("$c3r2"); + +extern unsigned long b, c; + +void __attribute__ ((nomips16)) +foo () +{ + unsigned long a, d; + + c3r1 = a; + b = c3r1; + + c3r2 = c; + d = c3r1; + printf ("%d\n", d); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/nested-1.c b/gcc/testsuite/gcc.c-torture/compile/nested-1.c new file mode 100644 index 000000000..135538a85 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/nested-1.c @@ -0,0 +1,21 @@ +/* { dg-require-effective-target trampolines } */ + +typedef __SIZE_TYPE__ size_t; +extern int printf (const char *, ...); +extern void *memset (void *, int, size_t); + +int bar (int (*)(), int, void *); + +int +main(int argc, char **argv) +{ + struct s { int a; char b[argc]; }; + int nested (struct s x) { return x.a + sizeof(x); } + struct s t; + memset (&t, 0, sizeof(t)); + t.a = 123; + printf("%d\n", bar (nested, argc, &t)); + return 0; +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/nested-2.c b/gcc/testsuite/gcc.c-torture/compile/nested-2.c new file mode 100644 index 000000000..6e61b323b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/nested-2.c @@ -0,0 +1,16 @@ +/* PR 21105 */ + +void +CheckFile () +{ + char tagname[10]; + char *a = tagname; + + int validate () + { + return (a == tagname + 4); + } + + if (a == tagname) + validate (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/packed-1.c b/gcc/testsuite/gcc.c-torture/compile/packed-1.c new file mode 100644 index 000000000..709fc3cb1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/packed-1.c @@ -0,0 +1,14 @@ +struct s +{ + int e; +} x; + +struct rbuf +{ + struct s *p __attribute__ ((packed)); +} *b; + +f () +{ + b->p = &x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pc44485.c b/gcc/testsuite/gcc.c-torture/compile/pc44485.c new file mode 100644 index 000000000..fc959257d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pc44485.c @@ -0,0 +1,46 @@ +static int +foo (int si1, int si2) +{ + return si1 > 0 && si2 > 0 && si1 > -si2 || si1 < 0 && si2 < 0 + && si1 < -si2 ? : si1 + si2; +} + +struct S0 +{ + unsigned short f1; +}; +int g_4; +struct S0 g_54 = { + 3428 +}; + +int +func_21 (int * p_22, int * const int32p_24, unsigned p_25, + const int * p_26); + +void int324 (unsigned p_15, int * p_16, int * p_17, int * p_18) +{ + if (foo (g_4, func_21 (p_18, &g_4, 0, 0))) + { + for (g_54.f1; g_54.f1; g_54.f1 += 1) + { + } + } +} + +int +func_21 (int * p_22, int * const int32p_24, unsigned p_25, + const int * p_26) +{ + for (0; 1; p_25 += 1) + lbl_29:if (p_25) + goto lbl_28; +lbl_28:for (p_25 = 0; p_25 < 9; p_25 += 1) + if (p_25) + goto lbl_29; + unsigned short l_53; + for (0; l_53; l_53 = foo) + { + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr12517.c b/gcc/testsuite/gcc.c-torture/compile/pr12517.c new file mode 100644 index 000000000..af82db8f4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr12517.c @@ -0,0 +1,19 @@ +/* PR tree-optimization/12517 */ + +int f(void); +void g(int); +void h(int a, int b, int c) +{ + int i = f(); + + if (b && (i & 4)) + g(i & 8 ? 0 : 1); + if (a) { + do { + if (i & 8) + g(0); + if (i & 4) + g(i ? 0 : 1); + } while (--c); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr12578.c b/gcc/testsuite/gcc.c-torture/compile/pr12578.c new file mode 100644 index 000000000..69afffe00 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr12578.c @@ -0,0 +1,15 @@ +/* PR tree-optimization/12517 */ + +void trivial_regexp_p(int *s, int len) +{ + while (--len) { + switch (*s++) { + case '\\': + switch (*s++) { + case '|': + ; + } + } + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr12899.c b/gcc/testsuite/gcc.c-torture/compile/pr12899.c new file mode 100644 index 000000000..6bd4724fd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr12899.c @@ -0,0 +1,11 @@ +/* PR tree-optimization/12899 */ + +void +bb_getopt_ulflags (char *s) +{ + for (;;) + if (s[1]) + do + s++; + while (*s); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr13066-1.c b/gcc/testsuite/gcc.c-torture/compile/pr13066-1.c new file mode 100644 index 000000000..c2930f95d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr13066-1.c @@ -0,0 +1,10 @@ +void *g, *c; +int a, b; + +int f() +{ + if ((0 == a) != (b || g == c)) + return 1; + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr13889.c b/gcc/testsuite/gcc.c-torture/compile/pr13889.c new file mode 100644 index 000000000..d14bc9ac5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr13889.c @@ -0,0 +1,7 @@ +/* PR target/13889 */ +struct { long long a; } *p; +void initNetFlowFunct(void) { + unsigned int b = (unsigned int)-1; + p->a = b; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr14692.c b/gcc/testsuite/gcc.c-torture/compile/pr14692.c new file mode 100644 index 000000000..3f36b3ccb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr14692.c @@ -0,0 +1,14 @@ +/* PR rtl-optimization/14692 */ + +void assert_failed (void); +void eidecpos_1 (unsigned char *pos, long n) +{ + int i; + for (i = 0; i < n; i++) + { + const unsigned char *dc_ptr1 = pos; + pos--; + if (dc_ptr1 - pos == 1) + assert_failed (); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr14730.c b/gcc/testsuite/gcc.c-torture/compile/pr14730.c new file mode 100644 index 000000000..6f08ab465 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr14730.c @@ -0,0 +1,16 @@ +/* PR middle-end/14730 */ + +int t (char i) +{ + switch (i) + { + case 1: + case 7: + case 10: + case 14: + case 9: + case 256: + return 0; + } + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr15245.c b/gcc/testsuite/gcc.c-torture/compile/pr15245.c new file mode 100644 index 000000000..d7d9051a1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr15245.c @@ -0,0 +1,21 @@ +/* Testcase from + PR optimization/15245 + This used to ICE as convert was used + in tree-ssa-phiopt which created non gimple + code. */ + +char *f(char *x, int flag) +{ + char *ret = (char*)0; + + + if( x > (char*)1 ) { + if(x) + return (char*)0; + } else { + if( flag & 1 ) + ret = (char*)1; + flag |= 2; + } + return ret; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr16461.c b/gcc/testsuite/gcc.c-torture/compile/pr16461.c new file mode 100644 index 000000000..b48eee205 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr16461.c @@ -0,0 +1,14 @@ +/* PR tree-optimization/16461 */ + +int DVDinput_read(int); +int DVDReadBlocksPath(int offset, int block_count) { + int ret = 0, ret2 = 0; + for (;;) { + if (offset) + ret = DVDinput_read(block_count); + else + ret2 = DVDinput_read(block_count); + break; + } + return ret + ret2; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr16566-1.c b/gcc/testsuite/gcc.c-torture/compile/pr16566-1.c new file mode 100644 index 000000000..4ed4ab730 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr16566-1.c @@ -0,0 +1,15 @@ +/* ICE with flexible arrays in non-lvalue structures. Bug 16566 + (comment #3). */ + +struct S; + +struct C { + int i; + struct S *tab[]; +}; + +struct S { struct C c; }; + +void foo (struct S *x) { + foo(((void)1, x->c).tab[0]); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr16566-2.c b/gcc/testsuite/gcc.c-torture/compile/pr16566-2.c new file mode 100644 index 000000000..2f7a10668 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr16566-2.c @@ -0,0 +1,14 @@ +/* ICE with flexible arrays in non-lvalue structures. Bug 16566 + (comment #5). */ +/* { dg-options "-Wno-psabi" { target { { i?86-*-* x86_64-*-* } && lp64 } } } */ + +struct A +{ + int i; + int x[]; +}; + +int foo(struct A a) +{ + return (a,a).x[0]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr16566-3.c b/gcc/testsuite/gcc.c-torture/compile/pr16566-3.c new file mode 100644 index 000000000..954aa361d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr16566-3.c @@ -0,0 +1,12 @@ +/* ICE with flexible arrays in non-lvalue structures. Bug 16566 + (testcase from duplicate bug 16575). */ + +struct S; +struct C { + int i; + struct S *tab[]; +}; +struct S { struct C c; }; +void foo (struct S *x) { + ((void)1, x->c).tab[0] = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr16808.c b/gcc/testsuite/gcc.c-torture/compile/pr16808.c new file mode 100644 index 000000000..28527de5d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr16808.c @@ -0,0 +1,38 @@ +/* We used to ICE as we did not mark a Vop for rename as + we changed a function call to a normal modify statement + while folding exp(0.0); */ + +double exp(double); +void f0(void); +void f(double); +typedef struct Parser { + int x; + char *s; +} Parser; +static double pop(Parser *p) { + if (p->s[0] <= 0) { + f0(); + return 0; + } + --p->x; + return 0; +} +static void evalFactor(Parser *p) { + while (p->x) + f(exp(pop(p))); +} +static void evalTerm(Parser *p) { + while (p->s[0]) + evalFactor(p); +} +static void evalExpression(Parser *p) { + evalTerm(p); + while (p->s[0]) + evalTerm(p); +} +void evalPrimary(Parser *p) { + if (p->s) + return; + evalExpression(p); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr17119.c b/gcc/testsuite/gcc.c-torture/compile/pr17119.c new file mode 100644 index 000000000..28d6ccbe0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr17119.c @@ -0,0 +1,19 @@ +void +_mesa_DrawPixels (int width, int height, unsigned format, + unsigned type, const void * pixels) +{ + switch (format) + { + case 0x1900: + func1 (); + break; + case 0x1907: + case 0x80E0: + case 0x1908: + case 0x80E1: + case 0x8000: + func2 (); + break; + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr17273.c b/gcc/testsuite/gcc.c-torture/compile/pr17273.c new file mode 100644 index 000000000..42d318ef6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr17273.c @@ -0,0 +1,22 @@ +struct A { int i; }; +struct B { struct A a; }; + +void f(struct A*, struct A*); +#define bool _Bool + +void bar(bool b) +{ + struct B * D1601; + struct A D1576; + struct A * D1593; + struct B * D1592; + struct B D1575; + + D1575 = (struct B){}; + + if (b) D1592 = &D1575; else D1592 = &D1575; + + D1593 = &D1592->a; // <-- we are prograting &D1575 into here. + D1576 = (struct A){}; + f (D1593, &D1576); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr17397.c b/gcc/testsuite/gcc.c-torture/compile/pr17397.c new file mode 100644 index 000000000..b857472f6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr17397.c @@ -0,0 +1,12 @@ +/* ICE due to invalid GIMPLE created during strlen simplification. */ + +extern unsigned long strlen (__const char *__s); +extern void bar (); +extern int cols; + +void foo (void) +{ + char s[cols + 2]; + if (strlen (s) > 0) + bar (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr17407.c b/gcc/testsuite/gcc.c-torture/compile/pr17407.c new file mode 100644 index 000000000..a06ab1758 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr17407.c @@ -0,0 +1,15 @@ +typedef struct libxml_xpathCallback { + void *ns_uri; +} libxml_xpathCallback; + +typedef libxml_xpathCallback libxml_xpathCallbackArray[]; + +libxml_xpathCallbackArray *libxml_xpathCallbacks; + +void foo1(void); + +void +foo (void) +{ + if ((*libxml_xpathCallbacks)[3].ns_uri != ((void *)0)) foo1(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr17408.c b/gcc/testsuite/gcc.c-torture/compile/pr17408.c new file mode 100644 index 000000000..4819673f2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr17408.c @@ -0,0 +1,5 @@ +/* PRs 17408 and 17409, with different options. */ +extern int t; +extern int t = 0; +void f(){t =0;} +void g(){h(&t);} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr17529.c b/gcc/testsuite/gcc.c-torture/compile/pr17529.c new file mode 100644 index 000000000..63a96a1c3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr17529.c @@ -0,0 +1,14 @@ + +static inline void +bar (const int * const x) +{ + __asm__ __volatile__ (""::"m" (*x)); +} + +static const int y[1]; + +void +foo (void) +{ + bar (y); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr17558.c b/gcc/testsuite/gcc.c-torture/compile/pr17558.c new file mode 100644 index 000000000..bc6655285 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr17558.c @@ -0,0 +1,10 @@ +struct xobject { + char type; +}; +extern struct xobject *t1_Xform ( struct xobject *obj); +struct xobject * +t1_Xform(struct xobject *obj) +{ + register struct font *F = (struct font *) obj; + return((struct xobject*)F); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr17656.c b/gcc/testsuite/gcc.c-torture/compile/pr17656.c new file mode 100644 index 000000000..0acb71f0c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr17656.c @@ -0,0 +1,18 @@ +int sprintf (char *s, const char *format, ...); + +int foo(int i, int j) +{ + char *buf, *str; + + if (i) + str = ""; + else if (j) + str = ""; + else + return 1; + + /* We were propagating &""[0] here and not calling fold_stmt with a + proper statement pointer. */ + sprintf(buf, str); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr17906.c b/gcc/testsuite/gcc.c-torture/compile/pr17906.c new file mode 100644 index 000000000..2b18a6aab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr17906.c @@ -0,0 +1,7 @@ +struct usc_bigstack_t {}; + +void +usc_recressive_func(int cnt, int max, struct usc_bigstack_t bstack) +{ + usc_recressive_func(cnt+1, max, bstack); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr17913.c b/gcc/testsuite/gcc.c-torture/compile/pr17913.c new file mode 100644 index 000000000..30654a395 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr17913.c @@ -0,0 +1,7 @@ +/* Test for computed jump into cond_expr: bug 17913. */ +void f (void) +{ + void *p = &&a; + 1 ? 1 : ({ a : 1; }); + goto *p; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr18291.c b/gcc/testsuite/gcc.c-torture/compile/pr18291.c new file mode 100644 index 000000000..7d983696f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr18291.c @@ -0,0 +1,12 @@ +int baz(int k2) +{ + int i, j, *p, k = 1, k1 = 0; + if (k2) + p = &j; + else + p = &i; + if (k1) + *p = 0 , p = &k; + *p = 1; + return k; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr18299-1.c b/gcc/testsuite/gcc.c-torture/compile/pr18299-1.c new file mode 100644 index 000000000..7dc115701 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr18299-1.c @@ -0,0 +1,12 @@ +/* We used to ICE in gimple-lower because we + would produce __t (VAR_DECL) as a statement in the + instruction stream which is not valid. */ + +static inline int f(int i) +{ + const int __t = (__t); +} +int g(void) +{ + return f(0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr18712.c b/gcc/testsuite/gcc.c-torture/compile/pr18712.c new file mode 100644 index 000000000..7d53aaae8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr18712.c @@ -0,0 +1,17 @@ +void *eintr_source (void *arg) +{ + int ts = 0; + + if (arg) + foo (); + + while (1) + { + if (arg) + foo (); + + foo1 (&ts); + } + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr18903.c b/gcc/testsuite/gcc.c-torture/compile/pr18903.c new file mode 100644 index 000000000..3c1235112 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr18903.c @@ -0,0 +1,17 @@ +/* We were ICEing in bsi_after_labels because + we had a BB which did not have a lablel. + PR middle-end/18903 */ + +#ifndef NO_LABEL_VALUES +void g (int s, int f) +{ + &&ff; + s = f; + ff: + goto end; + f = s; + end:; +} +#else +int g; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/pr19080.c b/gcc/testsuite/gcc.c-torture/compile/pr19080.c new file mode 100644 index 000000000..b5686b80b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr19080.c @@ -0,0 +1,115 @@ +typedef union { int ioport; volatile char *maddr; } bus_space_handle_t; +struct scb { unsigned short *hscb; }; +struct ahd_softc +{ + int tags[2]; + bus_space_handle_t bshs[2]; + int dst_mode; + int src_mode; + int flags; +}; +void outb(int, int); + +int foo_inb(struct ahd_softc*); +int foo_int_int (int, int); +int ahd_inb(struct ahd_softc*); +int ahd_scb_active_in_fifo (void); + +void ahd_flush_qoutfifo (struct ahd_softc *ahd, struct scb *scb) +{ + int src, dst, *a = &src, *b = &dst; *a = 1, *b = 1; + int bb, p; + + if (ahd->src_mode == 1) + { int src, dst, *a = &src, *b = &dst; *a = 1, *b = 1;} + foo_int_int (ahd->src_mode, ahd->dst_mode); + p = 1; + if (ahd->src_mode == 2 && ahd->dst_mode == p) + { + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + } + ahd->src_mode = 1; + ahd->dst_mode = 2; + while ((ahd_inb (ahd) & 0x01) != 0) + { + p = 1; + if (ahd->src_mode == 2 && ahd->dst_mode == p) + { + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + } + ahd->src_mode = 1; + ahd->dst_mode = 2; + if (ahd_scb_active_in_fifo () == 0) + continue; + p = 1; + if (ahd->src_mode == 2 && ahd->dst_mode == p) + { + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + } + ahd->src_mode = 1; + ahd->dst_mode = 2; + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if ((ahd->flags & 1) != 0) + foo_inb (ahd); + if ((ahd->flags & 1) != 0) + foo_inb (ahd); + if ((ahd->flags & 1) != 0) + foo_inb (ahd); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if ((ahd->flags & 1) != 0) + foo_inb (ahd); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + bb = (*(scb->hscb)); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + bb = (*(scb->hscb)); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + } + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + p = 1; + if (ahd->src_mode == 2 && ahd->dst_mode == p) + { + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + } + ahd->src_mode = 1; + ahd->dst_mode = 2; + if (ahd->src_mode == 2 && ahd->dst_mode == dst) + { + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + if (ahd->tags[0] == 1) *(ahd->bshs[0].maddr); + outb (1, ahd->bshs[0].ioport ); + } + ahd->src_mode = 1; + ahd->dst_mode = 2; + ahd->flags |= 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr19121.c b/gcc/testsuite/gcc.c-torture/compile/pr19121.c new file mode 100644 index 000000000..b8f4c21f9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr19121.c @@ -0,0 +1,23 @@ +typedef struct interpreter { + char Itokenbuf[256]; +} PerlInterpreter; +static inline void S_missingterm(char *s) +{ + char tmpbuf[3] = ""; + char q; + if (!s) + s = tmpbuf; + q = strchr(s,'"') ? '\'' : '"'; +} +void S_scan_heredoc(PerlInterpreter *my_perl, char *s, int i) +{ + char term; + term = *my_perl->Itokenbuf; + if (i) + { + *s = term; + S_missingterm(my_perl->Itokenbuf); + } + else + S_missingterm(my_perl->Itokenbuf); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr19357.c b/gcc/testsuite/gcc.c-torture/compile/pr19357.c new file mode 100644 index 000000000..2dc26d786 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr19357.c @@ -0,0 +1,8 @@ +/* This generated an ICE for an ia64-linux target. */ +struct f { + float f[8]; +}; + +long double ftest(struct f arg1, long double arg2) { + return arg2; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr19736.c b/gcc/testsuite/gcc.c-torture/compile/pr19736.c new file mode 100644 index 000000000..0b618b126 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr19736.c @@ -0,0 +1,21 @@ +/* We used to ICE because we had forgot to update the immediate_uses + information after foldding the last strcpy in Reduce PHI. + This was PR tree-opt/19763. */ + +extern char *strcpy (char *, const char *); +void sdbout_one_type (char *p) +{ + int i, t = 1; + char *q; + for (i = 0; i < 2; i++) + { + strcpy (p, "1"); + p += sizeof ("1"); + } + if (t) + q = "2"; + else + q = "3"; + strcpy (p, q); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr19853.c b/gcc/testsuite/gcc.c-torture/compile/pr19853.c new file mode 100644 index 000000000..f7fdf49bc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr19853.c @@ -0,0 +1,19 @@ +struct test { int *x; } global_test; +int global_int; + +int flag; + +void test (char *dummy) +{ + static const struct test const_test = { &global_int }; + struct test local_test; + + int i; + for (i = 0; i < 1; i++) + *dummy = 0; + if (flag) + __builtin_memset (dummy, 0, 16); + + local_test = const_test; + global_test = local_test; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr20203.c b/gcc/testsuite/gcc.c-torture/compile/pr20203.c new file mode 100644 index 000000000..1fb2a045d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr20203.c @@ -0,0 +1,16 @@ +void *memset (void *, int, unsigned long); + +typedef struct bfd_section +{ + unsigned long size; + unsigned char *contents; +} asection; + +int +_bfd_mips_elf_finish_dynamic_sections (asection *s) +{ + long long dummy_offset; + dummy_offset = s->size - 16; + memset (s->contents + dummy_offset, 0, 16); + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr20412.c b/gcc/testsuite/gcc.c-torture/compile/pr20412.c new file mode 100644 index 000000000..a165a921a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr20412.c @@ -0,0 +1,20 @@ +int +foo(void) +{ + int a,b,g; + int i,len; + int stop; + + len = 10; + stop = 0; + for (i=0; i>1 & 1U)) & ((l6_data_Z_0th & 1U) + | !(((char )(l6_data_Z_0th>>35 & 15U))==14U))) + t = 0ULL; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr20583.c b/gcc/testsuite/gcc.c-torture/compile/pr20583.c new file mode 100644 index 000000000..6c5f891d3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr20583.c @@ -0,0 +1,30 @@ +/* PR target/20583 + On m68k-none-elf, CSE used to generate + + (set (reg:HI ...) + (const:HI (truncate:HI (minus:SI (label_ref ...) + (label_ref ...))))) + + which output functions do not know how to handle. Make sure that + such a constant will be rejected. */ + +void bar (unsigned int); + +void +foo (void) +{ + char buf[1] = { 3 }; + const char *p = buf; + const char **q = &p; + unsigned int ch; + switch (**q) + { + case 1: ch = 5; break; + case 2: ch = 4; break; + case 3: ch = 3; break; + case 4: ch = 2; break; + case 5: ch = 1; break; + default: ch = 0; break; + } + bar (ch); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr20928.c b/gcc/testsuite/gcc.c-torture/compile/pr20928.c new file mode 100644 index 000000000..ea8be9e87 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr20928.c @@ -0,0 +1,10 @@ +extern struct bar_t bar; +void *a; +void +foo (void) +{ + void **p = a; + do { + *p++ = ((unsigned char *) &bar + ((unsigned long int) 1L << 31)); + } while (p); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21021.c b/gcc/testsuite/gcc.c-torture/compile/pr21021.c new file mode 100644 index 000000000..b74821630 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21021.c @@ -0,0 +1,19 @@ +/* PR tree-optimization/21021 + + The front end produces a comparison of mismatched types, namely an + integer and a pointer, causing VRP to compute TYPE_MAX_VALUE for a + pointer, which we cannot. */ + +extern void *bar (void); + +int +foo (unsigned int *p, unsigned int *q) +{ + const void *r = bar (); + + if (r >= (const void *) *p + && r < (const void *) *q) + return 1; + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21030.c b/gcc/testsuite/gcc.c-torture/compile/pr21030.c new file mode 100644 index 000000000..b7590c0ed --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21030.c @@ -0,0 +1,19 @@ +/* PR tree-optimization/21030 + VRP used to create invalid ranges where VR->MIN is greater than + VR->MAX. */ + +void +foo (int unit) +{ + int i; + + for (i = 0; unit; i++, unit--) + { + if (i >= 0) + { + int j = i; + while (j) + j--; + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21293.c b/gcc/testsuite/gcc.c-torture/compile/pr21293.c new file mode 100644 index 000000000..54184b3e0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21293.c @@ -0,0 +1,12 @@ +/* Testcase from Dale Johannesen . */ +struct { +double x[1]; +} g; +void k( double *, double*); +void h(int Tmp8) +{ + int i; + for(i = 1;i <= Tmp8;i++) + k(&g.x[ + -1],&g.x[ Tmp8 + -1]); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21356.c b/gcc/testsuite/gcc.c-torture/compile/pr21356.c new file mode 100644 index 000000000..b072b5165 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21356.c @@ -0,0 +1,13 @@ +int a; +void* p; + +void foo (void) +{ + switch (a) + { + a0: case 0: p = &&a1; + a1: case 1: p = &&a2; + a2: default: p = &&a1; + } + goto *p; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21380.c b/gcc/testsuite/gcc.c-torture/compile/pr21380.c new file mode 100644 index 000000000..55ac08e78 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21380.c @@ -0,0 +1,42 @@ +void bar (void); + +void +foo (int *diff) +{ + double deltay = 0.0; + int Stangent = 0; + int mindiff; + int Sflipped = 0; + int i; + int Sturn, Snofit; + + Sturn = 1; + if (Sturn) + Stangent = 1; + if (Sturn) + { + Sflipped = 0; + Snofit = 1; + while (Snofit) + { + Snofit = 0; + mindiff = 0; + for (i = 0; i < 4; i++) + mindiff = diff[i]; + while (!Snofit && (mindiff < 0.0)) + { + deltay = (Stangent ? deltay : 0.0); + if (deltay < 0.0) + Snofit = 1; + for (i = 0; i < 4; i++) + { + } + } + if (Snofit) + if (Sflipped) + break; + } + if (Snofit) + bar (); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21532.c b/gcc/testsuite/gcc.c-torture/compile/pr21532.c new file mode 100644 index 000000000..1b8bc2248 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21532.c @@ -0,0 +1,14 @@ + + +int +bar (unsigned char key) +{ + unsigned char buf[sizeof (unsigned long)+2]; + unsigned char b; + unsigned char *buf_ = buf + 1; + + for (b = 8; b != 0; b--) + buf_[b] = key >> b; + + return foo (b); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21562.c b/gcc/testsuite/gcc.c-torture/compile/pr21562.c new file mode 100644 index 000000000..9b4932f8f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21562.c @@ -0,0 +1,25 @@ +/* { dg-options "-fno-inline" } */ +struct foo { int a, b, c; }; +void abort(void); +void exit(int); + +void +brother (int a, int b, int c) +{ + if (a) + abort (); +} + +void +sister (struct foo f, int b, int c) +{ + brother ((f.b == b), b, c); +} + +int +main () +{ + struct foo f = { 7, 8, 9 }; + sister (f, 1, 2); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21638.c b/gcc/testsuite/gcc.c-torture/compile/pr21638.c new file mode 100644 index 000000000..36fd0104a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21638.c @@ -0,0 +1,21 @@ +typedef struct hashhdr { + int bitmaps[32]; +} HASHHDR; + +static void +swap_header_copy(HASHHDR *srcp, HASHHDR *destp) +{ + int i; + for (i = 0; i < 32; i++) + ((char *)&(destp->bitmaps[i]))[0] = ((char *)&(srcp->bitmaps[i]))[1]; +} + +int +flush_meta(HASHHDR *whdrp1) +{ + HASHHDR *whdrp; + HASHHDR whdr; + whdrp = &whdr; + swap_header_copy(whdrp1, whdrp); + return (0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21728.c b/gcc/testsuite/gcc.c-torture/compile/pr21728.c new file mode 100644 index 000000000..991cb3886 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21728.c @@ -0,0 +1,10 @@ +int main (void) +{ + __label__ l1; + void __attribute__((used)) q(void) + { + goto l1; + } + + l1:; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21761.c b/gcc/testsuite/gcc.c-torture/compile/pr21761.c new file mode 100644 index 000000000..b9ca5c919 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21761.c @@ -0,0 +1,9 @@ +void f1() +{ + long bit=0, exponent; + exponent = -exponent; + for (bit = 1; exponent; bit <<= 1) + if (exponent & bit) + exponent ^= bit; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21839.c b/gcc/testsuite/gcc.c-torture/compile/pr21839.c new file mode 100644 index 000000000..c02085c2d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21839.c @@ -0,0 +1,12 @@ + typedef struct { } spinlock_t; +typedef struct { + unsigned sequence; + spinlock_t lock; +} seqlock_t; +void ext3_new_inode(seqlock_t *rsv_seqlock) +{ + *rsv_seqlock = (seqlock_t) { 0, (spinlock_t) { } }; + +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21840.c b/gcc/testsuite/gcc.c-torture/compile/pr21840.c new file mode 100644 index 000000000..bec3d6bf5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21840.c @@ -0,0 +1,11 @@ +void fn_show_state(void); +typedef void (*fn_handler_fn)(void); +static fn_handler_fn fn_handler[1]; + +void k_spec(unsigned char value) +{ + void *func = fn_handler[value]; + if (func == fn_show_state ) + return; + fn_handler[value](); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr22013-1.c b/gcc/testsuite/gcc.c-torture/compile/pr22013-1.c new file mode 100644 index 000000000..1dd0adcff --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr22013-1.c @@ -0,0 +1,11 @@ +typedef unsigned short W; +typedef const W *P; + +extern void g(P); + +void +f () +{ + const P s = (const W []){ 'R' }; + g (s); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr22269.c b/gcc/testsuite/gcc.c-torture/compile/pr22269.c new file mode 100644 index 000000000..bfcf20926 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr22269.c @@ -0,0 +1,16 @@ +/* We used to ICE in tree-ssa-reassoc because we did look at the correct operand to + see if it was a SSA_NAME. */ +int printf(const char*, ...); +int main(int argv, char*argc) { + + int d1; + int d2; + int s1, s2; + int b; + ((d1)&=(int)0x0000ffffL, (d1)|=((int)(short)(0x344))<<16); + ((d1)&=(int)0xffff0000UL, (d1)|=(int)(unsigned short)(0x4567)); + ((d2)&=(int)0x0000ffffL, (d2)|=((int)(short)(0))<<16); + ((d2)&=(int)0xffff0000UL, (d2)|=(int)(unsigned short)(0x3b9a)); + printf(" dividend >>: %ld\n", d1); + printf(" divisor >>: %ld\n", d2); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr22379.c b/gcc/testsuite/gcc.c-torture/compile/pr22379.c new file mode 100644 index 000000000..fae84a0af --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr22379.c @@ -0,0 +1,23 @@ +void __add_entropy_words(void); +void __wake_up(void); +void SHATransform(void); +static inline __attribute__((always_inline)) void add_entropy_words(void){} +void extract_entropy(void); +static inline __attribute__((always_inline)) void xfer_secondary_pool(void) +{ +extract_entropy(); +add_entropy_words(); +} +void extract_entropy(void) +{ +xfer_secondary_pool(); +__wake_up(); +} +void init_std_data(void) +{ +add_entropy_words(); +} +void rand_initialize(void) +{ +init_std_data(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr22398.c b/gcc/testsuite/gcc.c-torture/compile/pr22398.c new file mode 100644 index 000000000..448de5712 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr22398.c @@ -0,0 +1,21 @@ +#if ULONG_MAX != 4294967295u && ULONG_MAX != 18446744073709551615ull +int main(void) { exit (0); } +#else +#if ULONG_MAX != 18446744073709551615ull +#define NUM 0xf0000000 +#else +#define NUM 0xf000000000000000 +#endif + + +int func1(void *rw) +{ + return (rw && (((unsigned long) rw) >= NUM) ); +} + +void func2(void *rw) +{ + while(rw && (((unsigned long) rw) >= NUM) ) {} +} + +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/pr22422.c b/gcc/testsuite/gcc.c-torture/compile/pr22422.c new file mode 100644 index 000000000..bc176f969 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr22422.c @@ -0,0 +1,30 @@ +/* We should not crash trying to figure out the points-to sets for the below. We used to because we + ended up adding pointers to the points-to set of the ANYTHING variable. */ +struct D +{ + int n; + int c [8]; +}; + +struct A +{ + int i; + char *p; +}; + +struct B +{ + struct A *a; + struct D *d; +}; + +int dtInsert1 (struct B *b) +{ + struct A a = { 0, 0 }; + struct D *d; + b->a = &a; + d = b->d; + &d->c [d->n]; + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr22531.c b/gcc/testsuite/gcc.c-torture/compile/pr22531.c new file mode 100644 index 000000000..70e2df79f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr22531.c @@ -0,0 +1,7 @@ +typedef struct dw_cfi_oprnd_struct { + unsigned long reg; +} dw_cfa_location; +void def_cfa_1 (void) { + dw_cfa_location loc; + loc.reg = loc.reg; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr22589-1.c b/gcc/testsuite/gcc.c-torture/compile/pr22589-1.c new file mode 100644 index 000000000..d9cc0cfb5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr22589-1.c @@ -0,0 +1,4 @@ +int bar (char *foo) +{ + return (long long) ((int) foo + 0) < 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr23233-1.c b/gcc/testsuite/gcc.c-torture/compile/pr23233-1.c new file mode 100644 index 000000000..356c06335 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr23233-1.c @@ -0,0 +1,8 @@ +void foo (volatile long long *x) +{ + while (*x) + { + *x = 0; + *((volatile char *) 0) = 0; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr23237.c b/gcc/testsuite/gcc.c-torture/compile/pr23237.c new file mode 100644 index 000000000..f3f917d0d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr23237.c @@ -0,0 +1,16 @@ +/* Don't assemble, as this section syntax may not be valid on all platforms + (e.g., Darwin). */ +/* { dg-do compile } */ + +/* { dg-require-effective-target named_sections } */ + +static __attribute__ ((__section__ (".init.data"))) char *message; +static __attribute__ ((__section__ (".init.data"))) int (*actions[])(void) = {}; +void unpack_to_rootfs(void) +{ + while (!message) + { + if(!actions[0]) + return; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr23435.c b/gcc/testsuite/gcc.c-torture/compile/pr23435.c new file mode 100644 index 000000000..fb41af1e8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr23435.c @@ -0,0 +1,11 @@ +/* PR target/23435. + + On m68k-none-elf, this used to cause an unrecognized insn because + zero_extendsidi2 accepted operands that are both memory even though + such a pattern did not exist. */ + +void +foo (unsigned long *a, unsigned long long *p) +{ + *p = *a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr23445.c b/gcc/testsuite/gcc.c-torture/compile/pr23445.c new file mode 100644 index 000000000..3ddf9b702 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr23445.c @@ -0,0 +1,10 @@ + struct buffer_head { + char *b_data; + }; + void asfs_deletebnode( struct buffer_head *bhsec) { + if (bhsec == 0) { + void *bnc2 = (void *) bhsec->b_data; + if (bnc2) return; + if (bhsec) __brelse(bhsec); + } + } diff --git a/gcc/testsuite/gcc.c-torture/compile/pr23476.c b/gcc/testsuite/gcc.c-torture/compile/pr23476.c new file mode 100644 index 000000000..9cccde6e9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr23476.c @@ -0,0 +1,14 @@ +int h(int); +int t; +static inline int f(const int i) +{ + int tt = i; + _Bool a = i < t; + if (a) + return h(t); + return 9; +} +int g(void) +{ + return f(0x7FFFFFFF); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr23929.c b/gcc/testsuite/gcc.c-torture/compile/pr23929.c new file mode 100644 index 000000000..210bb585e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr23929.c @@ -0,0 +1,21 @@ +/* PR tree-optimization/23929 */ + +extern void bar (char *); + +void +foo (int n, char *z) +{ + char b[2048]; + int x, y; + + bar (b); + for (y = 0; y < 60; y++) + if (n == 600) + for (x = 0; x < 320;) + { + *z++ = b[x]; + x += 1; + *z++ = b[x]; + x += 1; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr23944.c b/gcc/testsuite/gcc.c-torture/compile/pr23944.c new file mode 100644 index 000000000..45bed7e5d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr23944.c @@ -0,0 +1,4 @@ +float f(float src[][4]) +{ + return *(src[3]); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr23946.c b/gcc/testsuite/gcc.c-torture/compile/pr23946.c new file mode 100644 index 000000000..ecaa5b163 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr23946.c @@ -0,0 +1,72 @@ + +extern int foo (void); + +int +avi_parse_comments (int fd, char *buf, int space_left) +{ + int len = 0, readlen = 0, k; + char *data, *c, *d; + + if (fd <= 0 || !buf || space_left <= 0) + return -1; + + memset (buf, 0, space_left); + + readlen = foo (); + if (!(data = malloc (readlen * sizeof (char) + 1))) + return -1; + + c = data; + space_left--; + + while (len < space_left) + { + if (!c || *c == '\0') + break; + else if (*c == 'I') + { + d = c + 4; + + k = 0; + while (d[k] != '\r' && d[k] != '\n' && d[k] != '\0') + ++k; + if (k >= space_left) + return len; + + + memcpy (buf + len, c, 4); + len += 4; + + + long2str (buf + len, k + 1); + len += 4; + + + memcpy (buf + len, d, k); + + *(buf + len + k + 1) = '\0'; + + + if ((k + 1) & 1) + { + k++; + *(buf + len + k + 1) = '\0'; + } + len += k + 1; + + + while (*c != '\n' && *c != '\0') + ++c; + if (*c != '\0') + ++c; + else + break; + + } + } + free (data); + + return len; +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr23960.c b/gcc/testsuite/gcc.c-torture/compile/pr23960.c new file mode 100644 index 000000000..5ca0562af --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr23960.c @@ -0,0 +1,12 @@ +/* PR tree-optimization/23960 + fold-const.c used to construct a comparison node with one pointer + operand and one non-pointer operand. */ + +void abort (void) __attribute__ ((noreturn)); + +void +foo (char *d, unsigned long int n) +{ + if (d + n > d) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr24227.c b/gcc/testsuite/gcc.c-torture/compile/pr24227.c new file mode 100644 index 000000000..a4bb44ad4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr24227.c @@ -0,0 +1,6 @@ +int Fdisplay_buffer (int buffer) +{ + if (((struct buffer *) ((unsigned int) buffer)) == + (0,(struct buffer *) ((unsigned int) ((buffer) & 1)))) + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr24883.c b/gcc/testsuite/gcc.c-torture/compile/pr24883.c new file mode 100644 index 000000000..b2ced75ac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr24883.c @@ -0,0 +1,21 @@ +typedef struct _rec_stl rec_stl; +struct _rec_stl { + unsigned char **strs; +}; +orec_str_list(int count) { + rec_stl *stl; + int i, j; + int li, lj; + unsigned char ci, cj; + for (i = 0; i < count; i++) { + for (j = i + 1; j < count; j++) { + cj = lj > 2 ? stl->strs[j][0] : (long)stl->strs[j] & 0xff; + if ((count >= 16 && cj < ci) || (cj == ci && lj > li)) { + stl->strs[j] = stl->strs[i]; + ci ^= cj; + cj ^= ci; + ci ^= cj; + } + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr24930.c b/gcc/testsuite/gcc.c-torture/compile/pr24930.c new file mode 100644 index 000000000..d52bb5c50 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr24930.c @@ -0,0 +1,17 @@ +/* PR 24930 */ +extern int foo(int u) __attribute__((noinline)); +int foo(int u) {return 0;} +int +main(int argc, char** argv) +{ + const char *buf = argv[1]; + + unsigned int data = (((unsigned int) buf[0]) << 8) + (unsigned int) buf[1]; + if (data & 0x8000) { + data &= 0x7fff ; + data ^= 0x7fff ; + data += 1 ; + data *= -1 ; + } + return foo((int)data); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr25224.c b/gcc/testsuite/gcc.c-torture/compile/pr25224.c new file mode 100644 index 000000000..0ccf0cdf3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr25224.c @@ -0,0 +1,20 @@ +/* { dg-options "-funswitch-loops" } */ +static float rgam; +extern void *jmp(void *); + +void drotmg(float d1) { +void *labels[] = { &&L170, &&L180, 0 }; + + for(;;) { + goto *jmp(labels); + if (d1 <= rgam) + goto L170; + +L170: + if (d1 <= rgam) + goto L170; + } + +L180: + goto L170; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr25310.c b/gcc/testsuite/gcc.c-torture/compile/pr25310.c new file mode 100644 index 000000000..71081d821 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr25310.c @@ -0,0 +1,22 @@ + +/* Prevent spurious test failures on 16-bit targets. */ +#if __INT_MAX__ >= 2147483647L + +extern int f (char *, int); + +void test (void) +{ + char buffer[65536]; + char *bufptr; + char *bufend; + int bytes; + + bufptr = buffer; + bufend = buffer + sizeof(buffer) - 1; + + while ((bytes = f (bufptr, bufend - bufptr)) > 0) + bufptr += bytes; +} + +#endif + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr25311.c b/gcc/testsuite/gcc.c-torture/compile/pr25311.c new file mode 100644 index 000000000..26c5bc37b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr25311.c @@ -0,0 +1,47 @@ + +struct w +{ + int top; + int left; + int height; + int width; + struct w *next; + struct w *parent; + struct w *child; +}; + +extern struct w *Qnil; + +void +set_size (struct w *w, int new_size, int nodelete, int set_height) +{ + int old_size = set_height? w->height : w->width; + + if (nodelete || w->parent == Qnil) + { + int last_pos, last_old_pos, pos, old_pos, first; + int div_val = old_size << 1; + struct w *c; + + last_pos = first = set_height? w->top : w->left; + last_old_pos = 0; + + for (c = w->child; c != Qnil; c = c->next) + { + if (set_height) + old_pos = last_old_pos + c->height; + else + old_pos = last_old_pos + c->width; + + pos = (((old_pos * new_size) << 1) + old_size) / div_val; + set_size (c, pos + first - last_pos, 1, set_height); + last_pos = pos + first; + last_old_pos = old_pos; + } + + if (!nodelete) + for (c = w->child; c != Qnil; c = c->next) + use (c); + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr25483.c b/gcc/testsuite/gcc.c-torture/compile/pr25483.c new file mode 100644 index 000000000..99151fda0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr25483.c @@ -0,0 +1,15 @@ +/* { dg-options "-fmove-loop-invariants" } */ + +static int mdct_win[8]; +int x; + +int +decode_init (double d) +{ + int j; + for (j = 4; j; j--) + { + d *= 0.5; + mdct_win[j] = (d * 3); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr25513.c b/gcc/testsuite/gcc.c-torture/compile/pr25513.c new file mode 100644 index 000000000..d2aa591fe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr25513.c @@ -0,0 +1,9 @@ +int f(void) +{ + static _Complex double t; + int i, j; + for(i = 0;i<2;i++) + for(j = 0;j<2;j++) + t = .5 * 1.0; + return t; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr25514.c b/gcc/testsuite/gcc.c-torture/compile/pr25514.c new file mode 100644 index 000000000..0bf5aa907 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr25514.c @@ -0,0 +1,24 @@ +struct node { + struct node *next; + int value; +}; + +struct node *current_node, global_list; + +void +bar (void) +{ + struct node *node, *next; + + node = current_node; + next = node->next; + if (node != &global_list) + current_node = next; + else + { + node = global_list.next; + global_list.value = node->value; + global_list.next = node->next; + } + foo (node); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr25860.c b/gcc/testsuite/gcc.c-torture/compile/pr25860.c new file mode 100644 index 000000000..033b567d8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr25860.c @@ -0,0 +1,20 @@ +/* We used to ICE because PRE would try to PRE the load of *Note from the + loop. */ + +struct g +{ + int i; +}; +struct f +{ + struct g i; +}; +int GSM_RingNoteGetFullDuration(struct g)__attribute__((const)); +void savewav(struct f *gg) +{ + struct g *Note; + long i = 0,j,length=0; + Note = &gg->i; + for (j=0;j= 0; loop--) + key_put(keyring->keys[loop]); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr26622.c b/gcc/testsuite/gcc.c-torture/compile/pr26622.c new file mode 100644 index 000000000..aea991ece --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr26622.c @@ -0,0 +1,11 @@ +/* PR middle-end/26622 + fold_ternary used to create a tree with mismatching types, causing + (const_int 128) to appear in QImode rtx. */ + +unsigned char g; + +unsigned long long +foo (void) +{ + return ((long long) ((g & 0x80) != 0)) << 7; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr26626.c b/gcc/testsuite/gcc.c-torture/compile/pr26626.c new file mode 100644 index 000000000..a4e03012b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr26626.c @@ -0,0 +1,13 @@ +typedef union { + int d; +} U; + +int rv; +void breakme() +{ + U *rv0; + U *pretmp = (U*)&rv; + rv0 = pretmp; + rv0->d = 42; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr26725.c b/gcc/testsuite/gcc.c-torture/compile/pr26725.c new file mode 100644 index 000000000..934042a52 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr26725.c @@ -0,0 +1,15 @@ +struct { unsigned int num; } *numptr; +void notice (int); +void doit (unsigned int *); + +void +rewrite_finalize_block (int x) +{ + unsigned int *tmp; + while (tmp = (numptr ? &numptr->num : 0), (tmp ? *tmp : 0) > 0) + { + tmp = (numptr ? &numptr->num : 0); + (void) (*tmp ? 0 : notice (x)); + doit (tmp); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr26781-1.c b/gcc/testsuite/gcc.c-torture/compile/pr26781-1.c new file mode 100644 index 000000000..028919e52 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr26781-1.c @@ -0,0 +1,11 @@ +void zconfdump(void) +{ + char *p, *p2; + for (p2 = p; p2; ) + { + char __a0, __a1, __a2; + __a0 = ((__const char *) ("\"\\"))[0]; + if (__a0) + return; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr26781-2.c b/gcc/testsuite/gcc.c-torture/compile/pr26781-2.c new file mode 100644 index 000000000..47168fdc6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr26781-2.c @@ -0,0 +1,11 @@ +void zconfdump(__SIZE_TYPE__ i) +{ + for (;;) + { + char __a0; + __a0 = ("\"\\")[i]; + if (__a0) + return; + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr26833.c b/gcc/testsuite/gcc.c-torture/compile/pr26833.c new file mode 100644 index 000000000..76c201c6e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr26833.c @@ -0,0 +1,19 @@ +void yasm_lc3b__parse_insn( int num_info, int *num_operands + , int *operands, int op) +{ + int found = 0; + int i; + for (; num_info>0 && !found; num_info--) + { + int mismatch = 0; + for(i = 0;op && (i<*num_operands)&& !mismatch; i++) + { + if (!(int)(operands[i] & 0x1)) + mismatch = 1; + if (mismatch) + break; + } + if (!mismatch) + found = 1; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr26840.c b/gcc/testsuite/gcc.c-torture/compile/pr26840.c new file mode 100644 index 000000000..8d864a295 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr26840.c @@ -0,0 +1,42 @@ +extern int f1 (void **); +extern void f2 (void *); + +struct s +{ + unsigned char field1; + int field2; +}; + +static inline struct s * +get_globals (void) +{ + struct s * r; + void * rr; + + if (f1 (&rr)) + return 0; + r = rr; + if (! r) + { + extern struct s t; + r = &t; + } + r->field1 = 1; + return r; +} + +void +atexit_common (const void *dso) +{ + struct s *g = get_globals (); + + if (! g) + return; + if (g->field1) + { + g->field2 = 0; + f2 (g); + } + else + f2 (g); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr27087.c b/gcc/testsuite/gcc.c-torture/compile/pr27087.c new file mode 100644 index 000000000..3add13bcb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr27087.c @@ -0,0 +1,23 @@ +extern int ptbl[4]; +extern int ctbl[4]; + +void doViews(void) { + int *c = ctbl, *p = ptbl; + while (1) + { + p++; + c++; + if (*p) + { + if (c == p) + { + if (*c) + return; + } + else + return; + } + } + + g(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr27282.c b/gcc/testsuite/gcc.c-torture/compile/pr27282.c new file mode 100644 index 000000000..ab6636650 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr27282.c @@ -0,0 +1,17 @@ +/* This test used to ICE on PowerPC at -O due to combine GEN_INT bug. */ +typedef struct _ColRowInfo ColRowInfo; +typedef struct { } +GnmSheetRange; +struct _ColRowInfo +{ + float size_pts; + unsigned margin_a:3; + unsigned margin_b:3; + unsigned visible:1; +}; +colrow_equal (ColRowInfo const *a, ColRowInfo const *b) +{ + return a->size_pts == b->size_pts && a->margin_a == b->margin_a + && a->visible == b->visible; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr27341-1.c b/gcc/testsuite/gcc.c-torture/compile/pr27341-1.c new file mode 100644 index 000000000..b77e937b9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr27341-1.c @@ -0,0 +1,7 @@ +extern double R_NaReal; +void z_atan2 (double _Complex * r, double _Complex * ccs) +{ + if (*ccs == 0) + __imag__ *r = R_NaReal; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr27341-2.c b/gcc/testsuite/gcc.c-torture/compile/pr27341-2.c new file mode 100644 index 000000000..e6be1e471 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr27341-2.c @@ -0,0 +1,8 @@ +void zgemm_ (const int*, const double*); +extern void matmul_c8 (_Complex double * dest) +{ + const int ldc = 0; + const double zero = 0; + zgemm_ ( &zero, &ldc); + dest[1] += 1 ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr27373.c b/gcc/testsuite/gcc.c-torture/compile/pr27373.c new file mode 100644 index 000000000..bf6217471 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr27373.c @@ -0,0 +1,40 @@ +typedef struct atype +{ + float bg[1], cg[1]; + _Bool ant; +}atype; + + +void cp_assert(_Bool*, float*, int*, _Bool*); + +void f(atype **rng_stream, int *error, float u) +{ + _Bool t = *rng_stream != 0; + float routinep; + _Bool failure; + cp_assert ( &t, &routinep, error, &failure); + if (failure == 0) + { + typedef float ty[1]; + ty *tt = &((*rng_stream)->bg); + int i = 1; + + do + { + (*tt)[i - 1] = u; + i ++; + }while (i > 1); + { + ty *tt = &(*rng_stream)->cg; + int i = 1; + + do + { + (*tt)[i - 1] = u; + i ++; + }while (i > 1); + } + } +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr27528.c b/gcc/testsuite/gcc.c-torture/compile/pr27528.c new file mode 100644 index 000000000..040049127 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr27528.c @@ -0,0 +1,40 @@ +/* Check that constant constraints like "i", "n" and "s" can be used in + cases where the operand is an initializer constant. */ +/* { dg-require-effective-target nonpic } */ + +int x[2] = { 1, 2 }; + +#ifdef __OPTIMIZE__ +static inline void __attribute__((__always_inline__)) +insn1 (int x) +{ + asm volatile ("" :: "n" (x), "i" (x)); +} + +static inline void __attribute__((__always_inline__)) +insn2 (const void *x) +{ + asm volatile ("" :: "s" (x), "i" (x)); +} +#endif + +void +foo (void) +{ +#ifdef __OPTIMIZE__ + insn1 (2); + insn1 (2); + insn1 (400); + insn1 (__LINE__); + insn2 (x); + insn2 (x); + insn2 (&x[1]); + insn2 ("string"); +#endif + asm volatile ("" :: "s" (x), "i" (x)); + /* At the time of writing, &x[1] is decomposed before reaching expand + when compiling with -O0. */ + asm volatile ("" :: "s" ("string"), "i" ("string")); + asm volatile ("" :: "s" (__FILE__), "i" (__FILE__)); + asm volatile ("" :: "s" (__FUNCTION__), "i" (__FUNCTION__)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr27571.c b/gcc/testsuite/gcc.c-torture/compile/pr27571.c new file mode 100644 index 000000000..af66369c2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr27571.c @@ -0,0 +1,27 @@ +/* PR target/27571 + alpha_does_function_need_gp did not properly skip jump table insns */ + +int r3isseparator(int); +void r3isdigit(int); +void r3decimalvalue(int); + +void r7todouble(int *storage, int *count) { + int i = 0; + int state = 0; + int cc = 0; + while (i > *count) { + cc = *storage; + switch (state) { + case 0: + if (r3isseparator(cc)) + state = 1; + case 1: + r3isdigit(cc); + case 2: + case 5: + case 6: + r3decimalvalue(cc); + } + i++; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr27863.c b/gcc/testsuite/gcc.c-torture/compile/pr27863.c new file mode 100644 index 000000000..86abc0686 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr27863.c @@ -0,0 +1,28 @@ +/* This test used to ICE on IA64. */ +long stack[100]; +int main(int argc,char**argv,char **envp) +{ + long *esp=stack; + static void* jarray[]={ &&KeyCtrlKV }; + *++esp=(long)&&_loc0; + goto SetTermStruc; + _loc0:; + *++esp=(long)&&_loc1; + _loc1:; +*++esp=(long)&&_loc35; + _loc35:; +goto *(*esp--); +*++esp=(long)&&_loc36; + _loc36:; +*++esp=(long)&&_loc37; + _loc37:; +KeyCtrlKV: +*++esp=(long)&&_loc66; +_loc66:; +*++esp=(long)&&_loc106; + _loc106:; +*++esp=(long)&&_loc119; + _loc119:; +SetTermStruc: + goto *(*esp--); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr27889.c b/gcc/testsuite/gcc.c-torture/compile/pr27889.c new file mode 100644 index 000000000..4e76caa56 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr27889.c @@ -0,0 +1,13 @@ +/* { dg-require-effective-target trampolines } */ + +void h(void (*)(void)); +_Complex int g (void) +{ + _Complex int x; + void f(void) + { + x = x + x; + } + h(f); + return x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr27907.c b/gcc/testsuite/gcc.c-torture/compile/pr27907.c new file mode 100644 index 000000000..575ac6a77 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr27907.c @@ -0,0 +1,23 @@ +typedef double fann_type; +typedef struct { } _G_fpos64_t; +struct fann_neuron +{ + fann_type value; +} +__attribute__ ((packed)); +struct fann_layer +{ + struct fann_neuron *last_neuron; +}; +struct fann +{ + struct fann_layer *first_layer; +}; +fann_run (struct fann *ann, fann_type * input) +{ + struct fann_layer *layer_it, *layer_it2, *last_layer; + for (layer_it = ann->first_layer + 1; layer_it != last_layer; layer_it++) + { + ((layer_it - 1)->last_neuron - 1)->value = 1; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr28489.c b/gcc/testsuite/gcc.c-torture/compile/pr28489.c new file mode 100644 index 000000000..766880fef --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr28489.c @@ -0,0 +1,48 @@ +typedef int c_int; +union c_insn +{ + void (*op) (); + c_int *mem; + c_int imm; +}; +static union c_insn c_stack[((0x100 + 4) * 4)]; +static struct c_ident *c_funcs; +static void (*c_op_bz) (); +static void c_direct (union c_insn *addr); +c_compile (int (*ext_getchar) (), void (*ext_rewind) (), + struct c_ident *externs) +{ + c_direct (((void *) 0)); +} +static void +c_direct (union c_insn *addr) +{ + union c_insn *pc = addr; + union c_insn *sp = c_stack; + c_int imm = 0; + static void *ops[] = { + &&op_index, &&op_assign, &&op_add_a, &&op_sub_a, &&op_mul_a, &&op_div_a, + &&op_mod_a, &&op_or_a, &&op_xor_a, &&op_and_a, &&op_shl_a, &&op_shr_a, + }; + { + c_op_bz = &&op_bz; + } + goto *(pc++)->op; +op_bz:if (imm) + { + } +op_push_imm_imm:(sp - 2)->imm = imm; + goto *(pc - 1)->op; +op_index:imm = *((sp - 3)->mem += imm); +op_assign:*(sp - 3)->mem = imm; +op_add_a:imm = *(sp - 3)->mem += imm; +op_sub_a:imm = *(sp - 3)->mem -= imm; +op_mul_a:imm = *(sp - 3)->mem *= imm; +op_div_a:imm = *(sp - 3)->mem /= imm; +op_mod_a:imm = *(sp - 3)->mem %= imm; +op_or_a:imm = *(sp - 3)->mem |= imm; +op_xor_a:imm = *(sp - 3)->mem ^= imm; +op_and_a:imm = *(sp - 3)->mem &= imm; +op_shl_a:imm = *(sp - 3)->mem <<= imm; +op_shr_a:imm = *(sp - 3)->mem >>= imm; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr28675.c b/gcc/testsuite/gcc.c-torture/compile/pr28675.c new file mode 100644 index 000000000..0d7835373 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr28675.c @@ -0,0 +1,38 @@ +struct fb_cmap { + unsigned int start; + unsigned int len; + unsigned short *red; + unsigned short *green; + unsigned short *blue; + unsigned short *transp; +}; + +typedef struct { + int r; + int g; + int b; + int a; +} rgba_t; + +static unsigned int cmap_len; + +extern unsigned int red_len, green_len, blue_len, alpha_len; +extern struct fb_cmap fb_cmap; +extern rgba_t *clut; +extern int fb_set_cmap(void); + +void directcolor_update_cmap(void) +{ + unsigned int i; + + for (i = 0; i < cmap_len; i++) { + if (i < red_len) + fb_cmap.red[i] = clut[i].r; + if (i < green_len) + fb_cmap.green[i] = clut[i].g; + if (i < blue_len) + fb_cmap.blue[i] = clut[i].b; + if (fb_cmap.transp && i < alpha_len) + fb_cmap.transp[i] = clut[i].a; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr28776-1.c b/gcc/testsuite/gcc.c-torture/compile/pr28776-1.c new file mode 100644 index 000000000..a37fb6fe1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr28776-1.c @@ -0,0 +1,16 @@ +typedef struct dw_fde_struct +{ + int decl; +} *dw_fde_ref; +dw_fde_ref fde_table; +unsigned fde_table_in_use; +void output_call_frame_info (void) +{ + unsigned int i; + dw_fde_ref fde; + for (i = 0; i < fde_table_in_use; i++) + { + fde = &fde_table[i]; + tree_contains_struct_check_failed (fde_table[i].decl); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr28776-2.c b/gcc/testsuite/gcc.c-torture/compile/pr28776-2.c new file mode 100644 index 000000000..61a5d37df --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr28776-2.c @@ -0,0 +1,26 @@ +typedef struct RangeCoder +{ + unsigned char one_state[256]; +} RangeCoder; +static inline void put_rac(RangeCoder *c, unsigned char* const state) +{ + *state= c->one_state[*state]; +} +typedef struct PlaneContext{ + unsigned (*state)[32]; +} PlaneContext; +static inline void put_symbol(RangeCoder *c, unsigned char *state) +{ + int i; + const int e; + put_rac(c, state); + for(i=e-1; i>=0; i--) + put_rac(c, state+22+i); +} +int encode_line(void) +{ + PlaneContext * const p; + RangeCoder * const c; + int a; + put_symbol(c, p->state[a]); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr28905.c b/gcc/testsuite/gcc.c-torture/compile/pr28905.c new file mode 100644 index 000000000..83a381ab8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr28905.c @@ -0,0 +1,11 @@ +/* We used to ICE here because after VRP we ended up with + non-compatible ranges in a value-range equivalences set. */ +void code_comment (int size) +{ + int i; + for (i = 0; i < size; i++) + if (i) + if (i < 0) + if (i < 0) + return; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr29128.c b/gcc/testsuite/gcc.c-torture/compile/pr29128.c new file mode 100644 index 000000000..2afeae3ce --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr29128.c @@ -0,0 +1,28 @@ +typedef unsigned long Eterm; +process_main (void) +{ + register Eterm x0; + register Eterm *reg = ((void *) 0); + register Eterm *I = ((void *) 0); + static void *opcodes[] = { + &&lb_allocate_heap_zero_III, + &&lb_allocate_init_tIy, &&lb_allocate_zero_tt + }; +lb_allocate_heap_III:{ + Eterm *next; + goto *(next); + } +lb_allocate_heap_zero_III:{ + } +lb_allocate_init_tIy:{ + } +lb_allocate_zero_tt:{ + Eterm *next; + { + Eterm *tmp_ptr = ((Eterm *) (((x0)) - 0x1)); + (*(Eterm *) (((unsigned char *) reg) + (I[(0) + 1]))) = ((tmp_ptr)[0]); + x0 = ((tmp_ptr)[1]); + } + goto *(next); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr29201.c b/gcc/testsuite/gcc.c-torture/compile/pr29201.c new file mode 100644 index 000000000..f0f4c404c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr29201.c @@ -0,0 +1,116 @@ +/* { dg-do assemble { target ia64-*-* } } */ +typedef int gint; +typedef gint gboolean; +typedef unsigned int guint; +typedef struct _MetaRectangle MetaRectangle; +struct _MetaRectangle +{ + int x; + int y; +}; +typedef struct _MetaDisplay MetaDisplay; +typedef struct _MetaFrame MetaFrame; +typedef struct _MetaWindow MetaWindow; +typedef struct +{ + int win_gravity; +} +XSizeHints; +typedef enum +{ + META_DEBUG_FOCUS = 1 << 0, META_DEBUG_WORKAREA = 1 << 1, META_DEBUG_STACK = + 1 << 6, META_DEBUG_WINDOW_OPS = 1 << 7, META_DEBUG_GEOMETRY = + 1 << 20, META_DEBUG_EDGE_RESISTANCE = 1 << 21 +} +MetaStackLayer; +struct _MetaWindow +{ + MetaDisplay *display; + MetaFrame *frame; + guint user_has_move_resized:1; + MetaRectangle user_rect; + XSizeHints size_hints; +}; +void meta_window_get_position (MetaWindow * window, int *x, int *y); +typedef struct _MetaFrameGeometry MetaFrameGeometry; +struct _MetaFrameGeometry +{ +}; +struct _MetaFrame +{ + MetaWindow *window; + MetaRectangle rect; + int child_x; + int child_y; +}; +typedef enum +{ + META_IS_CONFIGURE_REQUEST = 1 << 0, META_DO_GRAVITY_ADJUST = + 1 << 3, META_IS_RESIZE_ACTION = 1 << 4 +} +MetaMoveResizeFlags; +adjust_for_gravity (MetaWindow * window, MetaFrameGeometry * fgeom, + gboolean coords_assume_border, int gravity, + MetaRectangle * rect) +{ + int ref_x, ref_y; + int child_x, child_y; + int frame_width, frame_height; + switch (gravity) + { + case 1: + ref_x = rect->x; + } + switch (gravity) + { + case 1: + rect->y = ref_y + child_y; + case 2: + rect->x = ref_x - frame_width / 2 + child_x; + break; + case 3: + case 5: + case 6: + rect->x = ref_x - frame_width + child_x; + } +} +meta_window_move_resize_internal (MetaWindow * window, + MetaMoveResizeFlags flags, + int resize_gravity, int root_x_nw, + int root_y_nw, int w, int h) +{ + unsigned int mask; + MetaFrameGeometry fgeom; + gboolean need_resize_client = (0); + gboolean is_configure_request; + MetaRectangle new_rect; + MetaRectangle old_rect; + { + adjust_for_gravity (window, window->frame ? &fgeom : ((void *) 0), + is_configure_request, window->size_hints.win_gravity, + &new_rect); + } + meta_window_constrain (window, window->frame ? &fgeom : ((void *) 0), flags, + resize_gravity, &old_rect, &new_rect); + if (mask != 0) + { + { + meta_topic_real (META_DEBUG_GEOMETRY, + need_resize_client ? "true" : "false"); + } + } + { + window->user_has_move_resized = (!(0)); + meta_window_get_position (window, &window->user_rect.x, + &window->user_rect.y); + } +} +void +meta_window_get_position (MetaWindow * window, int *x, int *y) +{ + if (window->frame) + { + *x = window->frame->rect.x + window->frame->child_x; + *y = window->frame->rect.y + window->frame->child_y; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr29241.c b/gcc/testsuite/gcc.c-torture/compile/pr29241.c new file mode 100644 index 000000000..6db15c1c1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr29241.c @@ -0,0 +1,15 @@ +static inline __attribute__((always_inline)) void ip_finish_output2(){} +void ip_fragment(void (*)(void)); +static inline __attribute__((always_inline)) void ip_finish_output() +{ + ip_fragment(ip_finish_output2); + ip_finish_output2(); +} +void ip_mc_output() +{ + ip_finish_output(); +} +void ip_output() +{ + ip_finish_output(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr29250.c b/gcc/testsuite/gcc.c-torture/compile/pr29250.c new file mode 100644 index 000000000..970af329d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr29250.c @@ -0,0 +1,32 @@ +/* We used to ICE because EXPAND_SUM was being used for all recursive calls + to expand_expr. */ +struct TSparseEntry +{ + int feat_index; + double entry; +}; + +struct TSparse +{ + int vec_index; + int num_feat_entries; + struct TSparseEntry *features; +}; + +void +get_full_feature_matrix (struct TSparse* sparse_feature_matrix, int num_vec) +{ + double *fm; + int v, f; + + for (v=0; v < num_vec; v++) + { + for (f=0; f < sparse_feature_matrix[v].num_feat_entries; f++) + { + long long offs = sparse_feature_matrix[v].vec_index + + sparse_feature_matrix[v].features[f].feat_index; + fm[offs] = sparse_feature_matrix[v].features[f].entry; + } + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr29945.c b/gcc/testsuite/gcc.c-torture/compile/pr29945.c new file mode 100644 index 000000000..775af29ef --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr29945.c @@ -0,0 +1,8 @@ +/* This test used to ICE on the SPU target. */ +extern const char *__ctype_ptr; + +parse_real (unsigned char c) +{ + if ((__ctype_ptr[c]&04) && c != '.') + unget_char ( c); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr30132.c b/gcc/testsuite/gcc.c-torture/compile/pr30132.c new file mode 100644 index 000000000..adffae772 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr30132.c @@ -0,0 +1,5 @@ +double testit(double _Complex* t) +{ + return *t==0.0?0.0:-*t; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr30311.c b/gcc/testsuite/gcc.c-torture/compile/pr30311.c new file mode 100644 index 000000000..85ce75099 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr30311.c @@ -0,0 +1,16 @@ +/* ICE in subreg_get_info: bug 30311. */ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +inline double bar(double x) +{ + long double d; + __asm__ ("" : "=t" (d) : "0" (x)); + return d; +} + +double foo(double x) +{ + if (x) + return bar(x); + else + return bar(x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr30338.c b/gcc/testsuite/gcc.c-torture/compile/pr30338.c new file mode 100644 index 000000000..2d6245d01 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr30338.c @@ -0,0 +1,14 @@ +/* We used to do folding with mismatched types which caused us to + infinitely loop in comparison foldings. */ + +extern char *grub_scratch_mem; +int testload_func (char *arg, int flags) +{ + int i; + for (i = 0; i < 0x10ac0; i++) + if (*((unsigned char *) ((0x200000 + i + (int) grub_scratch_mem))) + != *((unsigned char *) ((0x300000 + i + (int) grub_scratch_mem)))) + return 0; + return 1; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr30433.c b/gcc/testsuite/gcc.c-torture/compile/pr30433.c new file mode 100644 index 000000000..1f0edd079 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr30433.c @@ -0,0 +1,2 @@ +int f = (_Complex float)(0.5) == 0.5; + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr30564-1.c b/gcc/testsuite/gcc.c-torture/compile/pr30564-1.c new file mode 100644 index 000000000..6c373f74b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr30564-1.c @@ -0,0 +1,15 @@ +static int spready[] = {0, 1, 2, 3}; +void explosion_map (int y) +{ + int i; + for (i = 0; i < 4; i++) + if (y * spready[i] < 0) + break; +} +void explosion (void) +{ + int i; + explosion_map (0); + for (i = 0; i < 2; i++) + continue; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr30564-2.c b/gcc/testsuite/gcc.c-torture/compile/pr30564-2.c new file mode 100644 index 000000000..403f39661 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr30564-2.c @@ -0,0 +1,12 @@ + +static int RawOrEnc = 0; +static inline void addpair(int fp, int un) +{ + if (RawOrEnc == 0 && fp != un) + RawOrEnc = 1; +} +int f(int un0, char *a, unsigned int __s2_len) +{ + addpair(un0, un0); + __s2_len < 4 ? __builtin_strcmp (a, "-") : 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr30984.c b/gcc/testsuite/gcc.c-torture/compile/pr30984.c new file mode 100644 index 000000000..265a6f361 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr30984.c @@ -0,0 +1,7 @@ +int fs_exec(int ino) +{ + void *src = 0; + if (ino) + src = (void*)0xe000; + goto *src; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr31034.c b/gcc/testsuite/gcc.c-torture/compile/pr31034.c new file mode 100644 index 000000000..affad9515 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr31034.c @@ -0,0 +1,14 @@ +static inline int +mod (int a, int n) +{ + return a >= n ? a % n : a; +} +void dpara(int); +void opticurve (int m) +{ + int i; + for (i = 0; i < m; i++) + { + dpara(mod (i - 1, m)); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr31345-1.c b/gcc/testsuite/gcc.c-torture/compile/pr31345-1.c new file mode 100644 index 000000000..fb4d8034c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr31345-1.c @@ -0,0 +1,24 @@ +/* PR tree-optimization/31345 + This caused a crash in VRP when dealing with overflow infinities. */ + +void +dpsnaffle (const char *kbuf) +{ + int hash, thash, head[2], off; + { + int _DP_i; + (hash) = 19780211; + { + (hash) = (hash) + (kbuf)[_DP_i]; + } + (hash) = ((hash) * 43321879) & 0x7FFFFFFF; + } + while (off != 0) + { + if (hash > thash) {} + else if (hash < thash) + { + off = head[2]; + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr31541.c b/gcc/testsuite/gcc.c-torture/compile/pr31541.c new file mode 100644 index 000000000..0cac26ed0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr31541.c @@ -0,0 +1,9 @@ +typedef unsigned char Uchar; +struct scsi_mode_header { + unsigned char sense_data_len : 8; +}; +int f(void) +{ + struct scsi_mode_header md; +return *(Uchar*)&md; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr31703.c b/gcc/testsuite/gcc.c-torture/compile/pr31703.c new file mode 100644 index 000000000..e463205a2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr31703.c @@ -0,0 +1,11 @@ +typedef unsigned long long HARD_REG_ELT_TYPE; +static HARD_REG_ELT_TYPE reload_reg_used_in_output_addr[30]; +int reload_reg_reaches_end_p (unsigned int regno, int opnum) +{ + int i; + for (i = opnum + 1; i < opnum; i++) + if (reload_reg_used_in_output_addr[i] + & ((HARD_REG_ELT_TYPE)1 << regno)) + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr31710.c b/gcc/testsuite/gcc.c-torture/compile/pr31710.c new file mode 100644 index 000000000..0c8562dbc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr31710.c @@ -0,0 +1,6 @@ +typedef short SHORT; +struct v { SHORT i; }; +void f(struct v *pin, struct v *pout) { + if (pin->i == (-0x7fff)-1) + pout->i = -pin->i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr31797.c b/gcc/testsuite/gcc.c-torture/compile/pr31797.c new file mode 100644 index 000000000..97958f389 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr31797.c @@ -0,0 +1,31 @@ +struct GTeth_desc +{ + unsigned ed_cmdsts; +}; +struct GTeth_softc +{ + struct GTeth_desc txq_desc[32]; + unsigned int txq_fi; + unsigned int txq_nactive; +}; + +void +GTeth_txq_free (struct GTeth_softc *sc) +{ + struct GTeth_desc *txd = &sc->txq_desc[0]; + txd->ed_cmdsts &= ~(1U << (31)); +} +void +GTeth_txq_done (struct GTeth_softc *sc) +{ + while (sc->txq_nactive > 0) + { + volatile struct GTeth_desc *txd = &sc->txq_desc[sc->txq_fi]; + if (txd->ed_cmdsts) + { + if (sc->txq_nactive == 1) + return; + } + GTeth_txq_free (sc); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr31953.c b/gcc/testsuite/gcc.c-torture/compile/pr31953.c new file mode 100644 index 000000000..667c9ae88 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr31953.c @@ -0,0 +1,14 @@ +struct WView +{ + int hexedit_mode:1; +}; +toggle_hexedit_mode (struct WView *view) +{ + if (view->hexedit_mode) + { + } + else + { + view->hexedit_mode = !view->hexedit_mode; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32139.c b/gcc/testsuite/gcc.c-torture/compile/pr32139.c new file mode 100644 index 000000000..7b8522f51 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32139.c @@ -0,0 +1,11 @@ +/* PR tree-optimization/32139 */ +int foo (void); +int bar (void) __attribute__ ((const)); + +int +test (int x) +{ + int a = (x == 10000 ? foo : bar) (); + int b = (x == 10000 ? foo : bar) (); + return a + b; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32169.c b/gcc/testsuite/gcc.c-torture/compile/pr32169.c new file mode 100644 index 000000000..29d3022df --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32169.c @@ -0,0 +1,17 @@ +void f(char); +static inline +void * __memset_generic(char c) +{ + f(c); +} +int prepare_startup_playback_urb( + int b, + int c +) +{ + char d; + if (b) + __memset_generic(c == ( 1) ? 0x80 : 0); + else + __memset_generic (c == ( 1) ? 0x80 : 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32349.c b/gcc/testsuite/gcc.c-torture/compile/pr32349.c new file mode 100644 index 000000000..df725afbf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32349.c @@ -0,0 +1,26 @@ +/* { dg-options "-fmodulo-sched" } */ + + +extern long *x1, *x2, *x3; + +int +foo () +{ + /* Switching the following two lines prevents the ICE. */ + long *p1, *p2; + long m, n, i; + + p1 = x1; + p2 = x2; + n = 0; + for (i = *x3; 0 < i; i--) + { + m = (*p1++) ^ (*p2++); + m = (m & 0x55555555) + ((m >> 1) & 0x55555555); + m = (m & 0x33333333) + ((m >> 2) & 0x33333333); + m = (m + (m >> 4)) & 0x0f0f0f0f; + m = (m + (m >> 8)); + n += m; + } + return n; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32355.c b/gcc/testsuite/gcc.c-torture/compile/pr32355.c new file mode 100644 index 000000000..e88cf5cf7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32355.c @@ -0,0 +1,31 @@ +typedef struct +{ +} +__sigset_t; +typedef struct +{ + char coredump; +} +EMode; +extern EMode Mode; +struct sigaction +{ + __sigset_t sa_mask; + int sa_flags; +}; +doSignalsSetup (void) +{ + static const int signals[] = { + 1, 2 , 3, 4, 6, 8, 11, 13, 14, 15, 10, 12, 17, 7 + }; + unsigned int i, sig; + struct sigaction sa; + for (i = 0; i < sizeof (signals) / sizeof (int); i++) + { + sig = signals[i]; + if (Mode.coredump && (sig == 4 || sig == 8)) + continue; + sa.sa_flags = (sig == 17); + sigemptyset (&sa.sa_mask); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32372.c b/gcc/testsuite/gcc.c-torture/compile/pr32372.c new file mode 100644 index 000000000..cead1ca00 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32372.c @@ -0,0 +1,21 @@ +typedef struct AVCodecContext +{ + int flags; + void *priv_data; + char codec_name[32]; +} +AVCodecContext; +typedef struct ScanTable +{ + int obmc; + int umvplus; + int h263_aic; +} +MpegEncContext; +MPV_encode_init (AVCodecContext *avctx) +{ + MpegEncContext *s = avctx->priv_data; + s->umvplus = (avctx->flags & 0x02000000) ? 1 : 0; + s->h263_aic = (avctx->flags & 0x01000000) ? 1 : 0; + s->h263_aic = s->obmc || s->umvplus; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32399.c b/gcc/testsuite/gcc.c-torture/compile/pr32399.c new file mode 100644 index 000000000..cc2b1b189 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32399.c @@ -0,0 +1,16 @@ +void f(unsigned char *src, unsigned char *dst, int num, unsigned char *pos, unsigned char *diffuse, int hasdiffuse, unsigned char *specular, int hasspecular) { + int i; + + for(i=num;i--;) { + float *p = (float *) ((__SIZE_TYPE__) dst + (__SIZE_TYPE__) pos); + if(hasdiffuse) { + unsigned int *dstColor = (unsigned int *) (dst + i + (__SIZE_TYPE__) diffuse); + *dstColor = * (unsigned int *) ( ((__SIZE_TYPE__) src + (__SIZE_TYPE__) diffuse) + i); + } + if(hasspecular) { + unsigned int *dstColor = (unsigned int *) (dst + i + (__SIZE_TYPE__) specular); + *dstColor = * (unsigned int *) ( ((__SIZE_TYPE__) src + (__SIZE_TYPE__) specular) + i); + } + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32453.c b/gcc/testsuite/gcc.c-torture/compile/pr32453.c new file mode 100644 index 000000000..bdabac76d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32453.c @@ -0,0 +1,11 @@ +void ucs2reverse_internal_loop_single (long *irreversible, int foo) +{ + unsigned char bytebuf[2]; + const unsigned char *inptr = bytebuf; + if (irreversible == (void *)0) + ; + else + inptr += 2; + if (inptr != bytebuf) + ((inptr - bytebuf > foo) ? (void) (0) : __assert_fail ()); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32482.c b/gcc/testsuite/gcc.c-torture/compile/pr32482.c new file mode 100644 index 000000000..9f0e3bfeb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32482.c @@ -0,0 +1,23 @@ +typedef struct { unsigned long bits[((((1 << 0))+32 -1)/32)]; } nodemask_t; +static inline __attribute__((always_inline)) +int bitmap_empty(const unsigned long *src, int nbits) +{ + return ! (*src & ( ((nbits) % 32) ? (1UL<<((nbits) % 32))-1 : ~0UL )); +} +static inline __attribute__((always_inline)) +int __nodes_empty(const nodemask_t *srcp, int nbits) +{ + return bitmap_empty(srcp->bits, nbits); +} +extern nodemask_t node_online_map; +void drain_array(void); +void drain_cpu_caches(void) +{ + int node; + if (!__nodes_empty(&(node_online_map), (1 << 0))) + for (((node)) = 0; ((node)) < 1; ((node))++) + { + } + if (!__nodes_empty(&(node_online_map), (1 << 0))) + drain_array(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32571.c b/gcc/testsuite/gcc.c-torture/compile/pr32571.c new file mode 100644 index 000000000..9592e3f36 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32571.c @@ -0,0 +1,38 @@ + +struct list_head { + struct list_head *next, *prev; +}; +struct ib_fmr { + int *device; + struct list_head list; +}; +static inline +struct mthca_fmr *to_mfmr(struct ib_fmr *ibmr) +{ + const struct ib_fmr *__mptr = (ibmr); + return (struct mthca_fmr *)( (char *)__mptr ); +} +void mthca_unmap_fmr(struct list_head *fmr_list) +{ + struct ib_fmr *fmr; + if (mthca_is_memfree()) + { + for (fmr = + ({ const struct list_head *__mptr = ((fmr_list)->next); (struct ib_fmr *)( +(char *)__mptr - 8 );}); + &fmr->list != (fmr_list); + fmr = ({ const struct list_head *__mptr = (fmr->list.next); (struct ib_fmr +*)( (char *)__mptr - 8);}) + ) + mthca_arbel_fmr_unmap(to_mfmr(fmr)); + } + else + for (fmr = + ({ const struct list_head *__mptr = ((fmr_list)->next); (struct ib_fmr *)( +(char *)__mptr - 8);}); + &fmr->list != (fmr_list); + fmr = ({ const struct list_head *__mptr = (fmr->list.next); (struct ib_fmr +*)( (char *)__mptr - 8);}) + ) + mthca_tavor_fmr_unmap(to_mfmr(fmr)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32584.c b/gcc/testsuite/gcc.c-torture/compile/pr32584.c new file mode 100644 index 000000000..403ea9b12 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32584.c @@ -0,0 +1,74 @@ +typedef __SIZE_TYPE__ size_t; +/* Kludge */ +#define unsigned +typedef __SIZE_TYPE__ __ssize_t; +#undef unsigned +typedef struct +{ +} __mbstate_t; +typedef struct +{ +} _G_fpos64_t; +enum +{ + __GCONV_INTERNAL_ERROR +}; +typedef int (*__gconv_trans_fct) (struct __gconv_step *, + size_t *); +typedef int (*__gconv_trans_context_fct) (void *, __const unsigned char *, + unsigned char *, unsigned char *); +struct __gconv_trans_data +{ +}; +struct _IO_marker { +}; +typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf, + size_t __n); +typedef struct blockbox { +} *BBOXPTR, BBOX ; +typedef struct netbox { +} *NBOXPTR, NBOX ; +typedef struct termbox { + struct termbox *nextterm ; +} *TEBOXPTR, TEBOX ; +typedef struct tilebox { + TEBOXPTR termsptr ; +} +*TIBOXPTR , +TIBOX ; +typedef struct cellbox { + TIBOXPTR tileptr ; +} +*CBOXPTR , +CBOX ; +typedef struct dimbox { +} +DBOX ; +typedef struct rowbox { +} ROWBOX ; +typedef struct binbox { +} +CHANGRDBOX ; +extern int numcells ; +extern int numterms ; +sortpin() +{ +int j , n , cell ; +CBOXPTR ptr ; +TIBOXPTR tile ; +TEBOXPTR term , *xpptr ; +for( cell = 1 ; cell <= numcells + numterms ; cell++ ) { + if( ( tile = ptr->tileptr ) == (TIBOXPTR) ((void *)0) ) { + } + n = 0 ; + for( term = tile->termsptr ; term != (TEBOXPTR) ((void *)0) ; + term = term->nextterm ) { + xpptr[ ++n ] = term ; + } + xpptr[ n + 1 ] = (TEBOXPTR) ((void *)0) ; + ptr->tileptr->termsptr = xpptr[ 1 ] ; + for( j = 1 ; j <= n ; j++ ) { + } +} +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32606.c b/gcc/testsuite/gcc.c-torture/compile/pr32606.c new file mode 100644 index 000000000..91348c40e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32606.c @@ -0,0 +1,30 @@ +int inb(int); +void is870(unsigned int wkport, unsigned char j) +{ + unsigned int tmport; + unsigned char i; + for (i = 0; i < 16; i++) + { + tmport = wkport + 0x18; + tmport += 0x07; + while ((inb(tmport) & 0x80) == 0) + { + if ((inb(tmport) & 0x01) != 0) + { + tmport -= 0x06; + tmport += 0x06; + } + } + tmport = wkport + 0x14; + tmport += 0x04; + tmport += 0x07; +widep_in1: + if ((j & 0x01) != 0) + { + tmport -= 0x06; + tmport += 0x06; + goto widep_in1; + } + while ((inb(tmport) & 0x80) == 0) {} + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32780.c b/gcc/testsuite/gcc.c-torture/compile/pr32780.c new file mode 100644 index 000000000..cfe64e434 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32780.c @@ -0,0 +1,10 @@ +typedef __SIZE_TYPE__ size_t; +extern void dont_optimize_away(size_t); + +void crashGcc(char*a) +{ + size_t b=(size_t)a - ((size_t)a & 1); + size_t c=(size_t)a - (b & (size_t)a); + dont_optimize_away(b+c); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32796.c b/gcc/testsuite/gcc.c-torture/compile/pr32796.c new file mode 100644 index 000000000..9e0abfb0e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32796.c @@ -0,0 +1,6 @@ + + +__SIZE_TYPE__ f (void *ptr) +{ + return ((__SIZE_TYPE__)(ptr)-1) | 1ULL; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32919.c b/gcc/testsuite/gcc.c-torture/compile/pr32919.c new file mode 100644 index 000000000..33956c8c0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32919.c @@ -0,0 +1,26 @@ +void _IO_vfprintf_internal ( char *f ) +{ + static const void *const step0_jumps[] = { &&do_form_unknown, &&do_flag_plus, &&do_form_float }; + const void * ptr = step0_jumps[0]; + do { + char spec; + spec = (*++f); + goto *ptr; +do_flag_plus: + read_int (&f); +do_number: + _itoa_word (spec); +do_form_float: + if (ptr != ((void *)0)) + { + spec = 'x'; + goto do_number; + } + if (spec != 'S') + __strnlen (); + return; + do_form_unknown:; + } + while (*f != '\0'); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32920.c b/gcc/testsuite/gcc.c-torture/compile/pr32920.c new file mode 100644 index 000000000..c9b627b12 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32920.c @@ -0,0 +1,7 @@ +int a; +void +foo(void) +{ + char buf[10]; + a = a < sizeof(buf) ? a : sizeof (buf); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32988.c b/gcc/testsuite/gcc.c-torture/compile/pr32988.c new file mode 100644 index 000000000..b62004c6a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr32988.c @@ -0,0 +1,20 @@ +enum zone_type { + ZONE_DMA, + ZONE_NORMAL, + ZONE_MOVABLE, + MAX_NR_ZONES +}; +static unsigned long arch_zone_lowest_possible_pfn[MAX_NR_ZONES]; +static unsigned long arch_zone_highest_possible_pfn[MAX_NR_ZONES]; +void free_area_init_nodes(unsigned long *max_zone_pfn) +{ + enum zone_type i; + for (i = 1; i < MAX_NR_ZONES; i++) + { + if (i == ZONE_MOVABLE) + continue; + unsigned long _x = max_zone_pfn[i]; + unsigned long _y = arch_zone_lowest_possible_pfn[i]; + arch_zone_highest_possible_pfn[i] = _x > _y ? _x : _y; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33122.c b/gcc/testsuite/gcc.c-torture/compile/pr33122.c new file mode 100644 index 000000000..e86254030 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr33122.c @@ -0,0 +1,14 @@ +struct dis386 { + const char *x; +}; + +static const struct dis386 float_reg[][2] = { + { { "fadd" }, { "fadd" } }, +}; + +void foo(int i, int j) +{ + const struct dis386 *dp; + + dp = &float_reg[i - 1][j]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33133.c b/gcc/testsuite/gcc.c-torture/compile/pr33133.c new file mode 100644 index 000000000..d1b09640e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr33133.c @@ -0,0 +1,50 @@ +static char newshuffle[256 + 16] = { + 0x0f, 0x08, 0x05, 0x07, 0x0c, 0x02, 0x0e, 0x09, 0x00, 0x01, 0x06, 0x0d, + 0x03, 0x04, 0x0b, 0x0a, 0x02, 0x0c, 0x0e, 0x06, 0x0f, 0x00, 0x01, 0x08, + 0x0d, 0x03, 0x0a, 0x04, 0x09, 0x0b, 0x05, 0x07, 0x05, 0x02, 0x09, 0x0f, + 0x0c, 0x04, 0x0d, 0x00, 0x0e, 0x0a, 0x06, 0x08, 0x0b, 0x01, 0x03, 0x07, + 0x0f, 0x0d, 0x02, 0x06, 0x07, 0x08, 0x05, 0x09, 0x00, 0x04, 0x0c, 0x03, + 0x01, 0x0a, 0x0b, 0x0e, 0x05, 0x0e, 0x02, 0x0b, 0x0d, 0x0a, 0x07, 0x00, + 0x08, 0x06, 0x04, 0x01, 0x0f, 0x0c, 0x03, 0x09, 0x08, 0x02, 0x0f, 0x0a, + 0x05, 0x09, 0x06, 0x0c, 0x00, 0x0b, 0x01, 0x0d, 0x07, 0x03, 0x04, 0x0e, + 0x0e, 0x08, 0x00, 0x09, 0x04, 0x0b, 0x02, 0x07, 0x0c, 0x03, 0x0a, 0x05, + 0x0d, 0x01, 0x06, 0x0f, 0x01, 0x04, 0x08, 0x0a, 0x0d, 0x0b, 0x07, 0x0e, + 0x05, 0x0f, 0x03, 0x09, 0x00, 0x02, 0x06, 0x0c, 0x05, 0x03, 0x0c, 0x08, + 0x0b, 0x02, 0x0e, 0x0a, 0x04, 0x01, 0x0d, 0x00, 0x06, 0x07, 0x0f, 0x09, + 0x06, 0x00, 0x0b, 0x0e, 0x0d, 0x04, 0x0c, 0x0f, 0x07, 0x02, 0x08, 0x0a, + 0x01, 0x05, 0x03, 0x09, 0x0b, 0x05, 0x0a, 0x0e, 0x0f, 0x01, 0x0c, 0x00, + 0x06, 0x04, 0x02, 0x09, 0x03, 0x0d, 0x07, 0x08, 0x07, 0x02, 0x0a, 0x00, + 0x0e, 0x08, 0x0f, 0x04, 0x0c, 0x0b, 0x09, 0x01, 0x05, 0x0d, 0x03, 0x06, + 0x07, 0x04, 0x0f, 0x09, 0x05, 0x01, 0x0c, 0x0b, 0x00, 0x03, 0x08, 0x0e, + 0x02, 0x0a, 0x06, 0x0d, 0x09, 0x04, 0x08, 0x00, 0x0a, 0x03, 0x01, 0x0c, + 0x05, 0x0f, 0x07, 0x02, 0x0b, 0x0e, 0x06, 0x0d, 0x09, 0x05, 0x04, 0x07, + 0x0e, 0x08, 0x03, 0x01, 0x0d, 0x0b, 0x0c, 0x02, 0x00, 0x0f, 0x06, 0x0a, + 0x09, 0x0a, 0x0b, 0x0d, 0x05, 0x03, 0x0f, 0x00, 0x01, 0x0c, 0x08, 0x07, + 0x06, 0x04, 0x0e, 0x02, 0x03, 0x0e, 0x0f, 0x02, 0x0d, 0x0c, 0x04, 0x05, + 0x09, 0x06, 0x00, 0x01, 0x0b, 0x07, 0x0a, 0x08, +}; +void newpassencrypt (char *, char *, char *); +void +newpassencrypt (char *old, char *new, char *out) +{ + char *p, *bx; + char copy[8]; + int i, di, ax; + char cl, dl, ch; + for (i = 0; i < 16; i++) + { + for (bx = old + 7; bx > old; bx--) + { + *bx = ((bx[-1] >> 4) & 0x0f) | ((*bx) << 4); + } + for (di = 0; di < 16; di++) + { + if (newshuffle[di + 0x100] & 1) + ch = ((copy[newshuffle[di + 0x100] / 2] >> 4) & 0x0f); + else + ch = copy[newshuffle[di + 0x100] / 2] & 0x0f; + out[di / 2] |= ((di & 1) ? ch << 4 : ch); + } + memcpy (copy, out, 8); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33146.c b/gcc/testsuite/gcc.c-torture/compile/pr33146.c new file mode 100644 index 000000000..6741fcf5d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr33146.c @@ -0,0 +1,19 @@ +typedef struct +{ + int end; + int term; +} +jpc_enc_pass_t; +void foo(int numpasses, jpc_enc_pass_t *p) +{ + jpc_enc_pass_t *pass; + jpc_enc_pass_t *termpass; + for (pass = p; pass != termpass; ++pass) + if (!pass->term) + { + termpass = pass; + while (termpass - pass < numpasses && !termpass->term) + ++termpass; + pass->end = termpass->end; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33166.c b/gcc/testsuite/gcc.c-torture/compile/pr33166.c new file mode 100644 index 000000000..a48c529c3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr33166.c @@ -0,0 +1,10 @@ +static void ConvertAddr (char *saddr, void **addr) +{ + *addr = (void *) &saddr; +} +void DefineSelf (char *addr) +{ + ConvertAddr (addr, (void **) &addr); + if (addr[0] == 127 && addr[3] == 1) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33173.c b/gcc/testsuite/gcc.c-torture/compile/pr33173.c new file mode 100644 index 000000000..f599297e7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr33173.c @@ -0,0 +1,102 @@ +typedef __SIZE_TYPE__ size_t; +typedef struct +{ +} +_G_fpos_t; +extern int printf (__const char *__restrict __format, ...); +extern size_t strlen (__const char *__s) __attribute__ ((__nothrow__)) + __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +typedef struct rend_service_descriptor_t +{ + int patchlevel; + char status_tag[32]; +} +tor_version_t; +test_dir_format (void) +{ + tor_version_t ver1; + { + long v2 = (long) (ver1.patchlevel); + } + { + const char *v1 = (""), *v2 = (ver1.status_tag); + if (!__extension__ ( + { + size_t __s1_len, __s2_len; + (__builtin_constant_p (v1) + && (__s1_len = strlen (v1), __s2_len = + (!((size_t) (const void *) ((v1) + 1) - + (size_t) (const void *) (v1) == 1) + || __s1_len >= 4) + && + (!((size_t) (const void *) ((v2) + 1) - + (size_t) (const void *) (v2) == 1) + || __s2_len >= 4)) ? __builtin_strcmp (v1, + v2) + : (__builtin_constant_p (v1) + && ((size_t) (const void *) ((v1) + 1) - + __s1_len < 4) ? (__builtin_constant_p (v2) + && + ((size_t) (const void *) + (size_t) (const void + *) (v2) == + 1) ? __builtin_strcmp (v1, + v2) + : (__extension__ ( + { + __const + char + *__s2 + = + (__const + char + *) + (v2); + register + __result + = + (((__const unsigned char *) (__const char *) (v1))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) + { + } + __result;} + ))): + (__builtin_constant_p (v2) + && ((size_t) (const void *) ((v2) + 1) - + __s2_len < 4) ? (__builtin_constant_p (v1) + && ((size_t) (const void *) + 1) ? + __builtin_strcmp (v1, + v2) + : (__extension__ ( + { + __const + char + *__s1 + = + (__const + char + *) + (__const + *) + (v1); + register + __result + = + ((__const unsigned char *) (__const char *) (v2))[0]; if (__s2_len > 0 && __result == 0) + { + if + (__s2_len + == + 0) + { + } + } + __result;} + ))): __builtin_strcmp (v1, + v2))));} + )) + { + printf ("."); + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33382.c b/gcc/testsuite/gcc.c-torture/compile/pr33382.c new file mode 100644 index 000000000..c939cf7b7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr33382.c @@ -0,0 +1,95 @@ +typedef __SIZE_TYPE__ size_t; +typedef struct { + int disable; + char *searchconfig[]; +} config_t; +typedef struct { + void *lng; +} arglist_t; +config_t config = { + .searchconfig = { + ((void *) 0)} +}; + +arglist_t arglist[] = { + { + &config.searchconfig[0]} +}; +const int arglistsize = ((int) (sizeof(arglist) / sizeof(arglist_t))); +void show_configuration(char *arg) +{ + int i; + + if (!__extension__( { + size_t + __s1_len, + __s2_len; (__builtin_constant_p(arglist[i].lng) + && (__s1_len = (!((size_t) + (const void *) + 1) + || __s2_len >= 4)) + ? : (__builtin_constant_p(arglist[i].lng) + && ((size_t) + (const void *) + 4) + ? (__builtin_constant_p(arg) + && ((size_t) (const void *) 1) ? + : (__extension__( { + __const * __s2 = + (__const *) + (arg); + register + __result = + (((__const + *) (arglist + [i]. + lng))[0] + - __s2[0]); + if (__s1_len == + 0) { + if (__s1_len == + 0) { + __result = + (((__const + unsigned char + *) (__const + char + *) + (arglist[i]. + lng))[3] - + __s2[3]);} + } + __result;} + ))): + (__builtin_constant_p(arg) + ? + (__builtin_constant_p + (arglist[i].lng) + ? : (__extension__( { + char + __result + = + ((__const + unsigned *) + (arg))[0]; + if + (__s2_len + > 0 + && __result == + 0) { + if (__s2_len > + 1 + && __result + == 0) { + } + } + __result;} + ))): + + + + __builtin_strcmp(arglist[i].lng, + arg))));} + )) + return; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33614.c b/gcc/testsuite/gcc.c-torture/compile/pr33614.c new file mode 100644 index 000000000..2b835b9dd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr33614.c @@ -0,0 +1,9 @@ +typedef float V2SF __attribute__ ((vector_size (8))); + +V2SF +foo (int x, V2SF a) +{ + while (x--) + a += (V2SF) {1.0f/0.0f - 1.0f/0.0f, 1.0f/0.0f - 1.0f/0.0f}; + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33617.c b/gcc/testsuite/gcc.c-torture/compile/pr33617.c new file mode 100644 index 000000000..51c6f1443 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr33617.c @@ -0,0 +1,9 @@ +/* { dg-options "-w -Wno-psabi" { target { i?86-*-* x86_64-*-* } } } */ + +typedef float V8SF __attribute__ ((vector_size (32))); +void bar (V8SF); +void +foo (float x) +{ + bar ((V8SF) { x, x, x, x, x, x, x, x }); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33641.c b/gcc/testsuite/gcc.c-torture/compile/pr33641.c new file mode 100644 index 000000000..112f70327 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr33641.c @@ -0,0 +1,12 @@ +/* This failed with type checking enabled. */ + +typedef enum { one, two } exp; +extern exp pe; +extern char pt[256]; +void psd (void (*f) (void *), void *p); +static void rle (void *e) { } +void +foo (void) +{ + psd ((void (*)(void *)) (rle), (void *) (pt + pe)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33855.c b/gcc/testsuite/gcc.c-torture/compile/pr33855.c new file mode 100644 index 000000000..e678cb341 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr33855.c @@ -0,0 +1,27 @@ +/* Testcase by Martin Michlmayr */ +/* Used to segfault due to cselim not marking the complex temp var + as GIMPLE reg. */ + +typedef struct { + int nsant, nvqd; + _Complex long double *vqd; +} vsorc_t; +vsorc_t vsorc; + +void foo(int next_job, int ain_num, int iped, long t) { + long double zpnorm; + + while (!next_job) + if (ain_num) + { + if (iped == 1) + zpnorm = 0.0; + int indx = vsorc.nvqd-1; + vsorc.vqd[indx] = t*1.0fj; + if (cabsl(vsorc.vqd[indx]) < 1.e-20) + vsorc.vqd[indx] = 0.0fj; + zpnorm = t; + if (zpnorm > 0.0) + iped = vsorc.nsant; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34029-1.c b/gcc/testsuite/gcc.c-torture/compile/pr34029-1.c new file mode 100644 index 000000000..526112974 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34029-1.c @@ -0,0 +1,22 @@ +static const char s[] = "ab.cd.efghijk"; + +int +foo (const char *x) +{ + const char *a; + int b = 0; + + a = __builtin_strchr (s, '.'); + if (a == 0) + b = 1; + else if ((a = __builtin_strchr (a + 1, '.')) == 0) + b = 1; + else if (__builtin_strncmp (s, x, a - s)) + b = 1; + else if (__builtin_strncmp (a + 1, x + (a - s + 1), 4) < 0) + b = 1; + + if (b) + return 4; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34029-2.c b/gcc/testsuite/gcc.c-torture/compile/pr34029-2.c new file mode 100644 index 000000000..9ec49ec97 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34029-2.c @@ -0,0 +1,12 @@ +static const char s[] = "ab.cd.efghijk"; +static const char t[] = "abcde"; + +long +foo (const char *x) +{ + const char *a; + long b = 0; + + a = __builtin_strchr (s, '.'); + return ((long) a) + (1 - (long) t); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34030.c b/gcc/testsuite/gcc.c-torture/compile/pr34030.c new file mode 100644 index 000000000..f4f9e176d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34030.c @@ -0,0 +1,8 @@ +int myvar; + +int foo(int mynum) +{ + if ((((void *)0) == (myvar & ((1U<<0) << mynum))) && (mynum > 0)) + return 1; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34091.c b/gcc/testsuite/gcc.c-torture/compile/pr34091.c new file mode 100644 index 000000000..0b8549132 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34091.c @@ -0,0 +1,175 @@ +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef int GLint; +typedef unsigned short GLushort; +typedef unsigned int GLuint; +typedef float GLfloat; +typedef GLushort GLchan; +struct gl_texture_image; +typedef struct __GLcontextRec GLcontext; +typedef void (*FetchTexelFuncC) (const struct gl_texture_image * texImage, + GLint col, GLint row, GLint img, + GLchan * texelOut); +struct gl_texture_format +{ +}; +struct gl_texture_image +{ + GLenum _BaseFormat; + GLboolean _IsPowerOfTwo; + FetchTexelFuncC FetchTexelc; +}; +struct gl_texture_object +{ + GLenum Target; + GLenum WrapS; + GLenum MinFilter; + GLenum MagFilter; + GLint BaseLevel; + GLint _MaxLevel; + struct gl_texture_image *Image[6][12]; +}; +enum _format +{ + MESA_FORMAT_RGBA_DXT3, MESA_FORMAT_RGBA_DXT5, MESA_FORMAT_RGBA, + MESA_FORMAT_RGB, MESA_FORMAT_ALPHA, MESA_FORMAT_LUMINANCE, +}; +typedef void (*texture_sample_func) (GLcontext * ctx, + const struct gl_texture_object * tObj, + GLuint n, const GLfloat texcoords[][4], + const GLfloat lambda[], + GLchan rgba[][4]); +lerp_2d (GLfloat a, GLfloat b, GLfloat v00, GLfloat v10, GLfloat v01, + GLfloat v11) +{ + const GLfloat temp0 = ((v00) + (a) * ((v10) - (v00))); + const GLfloat temp1 = ((v01) + (a) * ((v11) - (v01))); + return ((temp0) + (b) * ((temp1) - (temp0))); +} +static __inline__ void +lerp_rgba (GLchan result[4], GLfloat t, const GLchan a[4], const GLchan b[4]) +{ + result[0] = (GLchan) (((a[0]) + (t) * ((b[0]) - (a[0]))) + 0.5); + result[1] = (GLchan) (((a[1]) + (t) * ((b[1]) - (a[1]))) + 0.5); + result[2] = (GLchan) (((a[2]) + (t) * ((b[2]) - (a[2]))) + 0.5); +} +static __inline__ void +lerp_rgba_2d (GLchan result[4], GLfloat a, GLfloat b, const GLchan t00[4], + const GLchan t10[4], const GLchan t01[4], const GLchan t11[4]) +{ + result[0] = (GLchan) (lerp_2d (a, b, t00[0], t10[0], t01[0], t11[0]) + 0.5); + result[1] = (GLchan) (lerp_2d (a, b, t00[1], t10[1], t01[1], t11[1]) + 0.5); + result[2] = (GLchan) (lerp_2d (a, b, t00[2], t10[2], t01[2], t11[2]) + 0.5); +} +static __inline__ void +sample_2d_linear_repeat (GLcontext * ctx, + const struct gl_texture_object *tObj, + const struct gl_texture_image *img, + const GLfloat texcoord[4], GLchan rgba[]) +{ + GLint i0, j0, i1, j1; + GLfloat a, b; + GLchan t00[4], t10[4], t01[4], t11[4]; + { + }; + img->FetchTexelc (img, i1, j1, 0, t11); + lerp_rgba_2d (rgba, a, b, t00, t10, t01, t11); +} +sample_2d_nearest_mipmap_linear (GLcontext * ctx, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) +{ + GLuint i; + GLint level = linear_mipmap_level (tObj, lambda[i]); + sample_2d_nearest (ctx, tObj, tObj->Image[0][tObj->_MaxLevel], texcoord[i], rgba[i]); + GLchan t0[4], t1[4]; + sample_2d_nearest (ctx, tObj, tObj->Image[0][level], texcoord[i], t0); + sample_2d_nearest (ctx, tObj, tObj->Image[0][level + 1], texcoord[i], t1); +} +static void +sample_2d_linear_mipmap_linear_repeat (GLcontext * ctx, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoord[][4], + const GLfloat lambda[], + GLchan rgba[][4]) +{ + GLuint i; + for (i = 0; i < n; i++) + { + GLint level = linear_mipmap_level (tObj, lambda[i]); + if (level >= tObj->_MaxLevel) + { + GLchan t0[4], t1[4]; + const GLfloat f = ((lambda[i]) - ifloor (lambda[i])); + sample_2d_linear_repeat (ctx, tObj, tObj->Image[0][level], + texcoord[i], t0); + sample_2d_linear_repeat (ctx, tObj, tObj->Image[0][level + 1], + texcoord[i], t1); + lerp_rgba (rgba[i], f, t0, t1); + } + } +} +static void +sample_lambda_2d (GLcontext * ctx, const struct gl_texture_object *tObj, + GLuint n, const GLfloat texcoords[][4], + const GLfloat lambda[], GLchan rgba[][4]) +{ + const struct gl_texture_image *tImg = tObj->Image[0][tObj->BaseLevel]; + GLuint minStart, minEnd; + GLuint magStart, magEnd; + const GLboolean repeatNoBorderPOT = (tObj->WrapS == 0x2901) + && (tImg->_BaseFormat != 0x1900) && tImg->_IsPowerOfTwo; + compute_min_mag_ranges (tObj, n, lambda, &minStart, &minEnd, &magStart, + &magEnd); + if (minStart < minEnd) + { + const GLuint m = minEnd - minStart; + switch (tObj->MinFilter) + { + case 0x2600: + if (repeatNoBorderPOT) + { + case MESA_FORMAT_RGB: + opt_sample_rgb_2d (ctx, tObj, m, texcoords + minStart, + ((void *) 0), rgba + minStart); + case MESA_FORMAT_RGBA: + opt_sample_rgba_2d (ctx, tObj, m, texcoords + minStart, + ((void *) 0), rgba + minStart); + } + { + sample_nearest_2d (ctx, tObj, m, texcoords + minStart, + ((void *) 0), rgba + minStart); + } + break; + sample_2d_nearest_mipmap_linear (ctx, tObj, m, texcoords + minStart, + lambda + minStart, + rgba + minStart); + case 0x2703: + if (repeatNoBorderPOT) + sample_2d_linear_mipmap_linear_repeat (ctx, tObj, m, + texcoords + minStart, + lambda + minStart, + rgba + minStart); + } + switch (tObj->MagFilter) + { + case MESA_FORMAT_RGB: + opt_sample_rgb_2d (ctx, tObj, m, texcoords + magStart, + ((void *) 0), rgba + magStart); + opt_sample_rgba_2d (ctx, tObj, m, texcoords + magStart, + ((void *) 0), rgba + magStart); + sample_nearest_2d (ctx, tObj, m, texcoords + magStart, + ((void *) 0), rgba + magStart); + } + } +} +texture_sample_func +_swrast_choose_texture_sample_func (const struct gl_texture_object *t) +{ + switch (t->Target) + { + case 0x0DE0: + return &sample_lambda_2d; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34093.c b/gcc/testsuite/gcc.c-torture/compile/pr34093.c new file mode 100644 index 000000000..4f6934380 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34093.c @@ -0,0 +1,39 @@ +struct X { int i; int j; }; +#define FOO struct X +#define FOO10(x) FOO x ## 0; FOO x ## 1; FOO x ## 2; FOO x ## 3; FOO x ## 4; FOO x ## 5; FOO x ## 6; FOO x ## 7; FOO x ## 8; FOO x ## 9; +#define FOO100(x) FOO10(x ## 0) FOO10(x ## 1) FOO10(x ## 2) FOO10(x ## 3) FOO10(x ## 4) FOO10(x ## 5) FOO10(x ## 6) FOO10(x ## 7) FOO10(x ## 8) FOO10(x ## 9) + FOO100(x0) + FOO100(x1) + FOO100(x2) + FOO100(x3) + FOO100(x4) + FOO100(x5) + FOO100(x6) + FOO100(x7) + FOO100(x8) + FOO100(x9) + +#define COO(n,f) case n: p = &f; break; +#define COO10(n,f) COO(n ## 0, f ## 0) COO(n ## 1, f ## 1) COO(n ## 2, f ## 2) COO(n ## 3, f ## 3) COO(n ## 4, f ## 4) COO(n ## 5, f ## 5) COO(n ## 6, f ## 6) COO(n ## 7, f ## 7) COO(n ## 8, f ## 8) COO(n ## 9, f ## 9) +#define COO100(n,f) COO10(n ## 0, f ## 0) COO10(n ## 1, f ## 1) COO10(n ## 2, f ## 2) COO10(n ## 3, f ## 3) COO10(n ## 4, f ## 4) COO10(n ## 5, f ## 5) COO10(n ## 6, f ## 6) COO10(n ## 7, f ## 7) COO10(n ## 8, f ## 8) COO10(n ## 9, f ## 9) + +int foo(int i) +{ + struct X *p = 0; + x000.i = 0; + x599.j = 0; + switch (i) + { + COO100(1, x0) + COO100(2, x1) + COO100(3, x2) + COO100(4, x3) + COO100(5, x4) + COO100(6, x5) + COO100(7, x6) + COO100(8, x7) + COO100(9, x8) + COO100(10, x9) + } + return p->j; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34113.c b/gcc/testsuite/gcc.c-torture/compile/pr34113.c new file mode 100644 index 000000000..7694b8260 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34113.c @@ -0,0 +1,11 @@ +struct sockaddr_in { int sin_addr; }; +static void ConvertAddr (struct sockaddr_in *saddr, void **addr) +{ + *addr = (void *) &saddr->sin_addr; +} +unsigned char EnableLocalHost (struct sockaddr_in *ifa_addr) +{ + unsigned char * addr; + ConvertAddr(ifa_addr, (void **)&addr); + return addr[0]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34127.c b/gcc/testsuite/gcc.c-torture/compile/pr34127.c new file mode 100644 index 000000000..10d41acaf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34127.c @@ -0,0 +1,9 @@ +static void +whichtable(char **pfmt) +{ + --*pfmt; +} +void prepare_s(const char *fmt) +{ + whichtable((char **)&fmt); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34138.c b/gcc/testsuite/gcc.c-torture/compile/pr34138.c new file mode 100644 index 000000000..85e8863cd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34138.c @@ -0,0 +1,21 @@ +extern void free (void *__ptr); +struct shparam +{ + char **p; + int foo; +}; +static struct shparam shellparam; +inline void freeparam (volatile struct shparam *param, char **ap) +{ + free ((void *) (*ap)); + free ((void *) (param->p)); +} +void dotcmd (char **p) +{ + freeparam (&shellparam, p); +} +void evaltree (void) +{ + void (*evalfn) (char **); + evalfn = dotcmd; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34334.c b/gcc/testsuite/gcc.c-torture/compile/pr34334.c new file mode 100644 index 000000000..30bb78262 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34334.c @@ -0,0 +1,140 @@ +__extension__ typedef __SIZE_TYPE__ size_t; +__extension__ typedef long long int __quad_t; +__extension__ typedef unsigned int __mode_t; +__extension__ typedef __quad_t __off64_t; +typedef __mode_t mode_t; +typedef __off64_t off_t; +struct timeval {}; +typedef struct {} fd_set; +typedef union {} __pthread_slist_t; +typedef union { + struct __pthread_mutex_s { __extension__ union { }; } __data; +}; +extern int stat64 (__const char *__restrict __file, struct stat64 *__restrict __buf) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); +extern int fstatat64 (int __fd, __const char *__restrict __file, struct stat64 *__restrict __buf, int __flag) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 3))); +enum __socket_type { SOCK_STREAM = 1, }; +enum { SI_ASYNCNL = -60, }; +enum { CLD_EXITED = 1, }; +typedef struct sigaltstack { } stack_t; +enum __rlimit_resource { __RLIMIT_SIGPENDING = 11, }; +struct rlimit { }; +enum __priority_which { PRIO_PROCESS = 0, }; +typedef union { } __WAIT_STATUS __attribute__ ((__transparent_union__)); +union wait { + struct { } __wait_stopped; +}; +typedef enum { P_ALL, } idtype_t; +struct utsname { }; +enum { IPPROTO_IP = 0, }; +enum { IPPORT_ECHO = 7, }; +struct in_addr { }; +struct in6_addr { + union { } in6_u; +}; +typedef long int wchar_t; +typedef unsigned char guint8; +typedef signed int gint32; +typedef unsigned int guint32; +typedef signed int gssize; +typedef unsigned int gsize; +struct _GStaticMutex { + union { } static_mutex; +}; +union _GSystemThread { }; +typedef int GPid; +typedef char gchar; +typedef int gint; +typedef gint gboolean; +typedef unsigned short gushort; +typedef unsigned long gulong; +typedef unsigned int guint; +typedef void* gpointer; +typedef const void *gconstpointer; +typedef gboolean (*GEqualFunc) (gconstpointer a, gconstpointer b); +typedef void (*GFunc) (gpointer data, gpointer user_data); +typedef void (*GHFunc) (gpointer key, gpointer user_data); +struct _GTimeVal { }; +typedef struct _GByteArray GByteArray; +guint8* g_byte_array_free (GByteArray *array, guint index_); +typedef guint32 GQuark; +typedef struct _GError GError; +GError* g_error_new (GQuark domain, const gchar *message); +gboolean g_error_matches (const GError *error, gint code); +typedef __builtin_va_list __gnuc_va_list; +typedef __gnuc_va_list va_list; +typedef enum { G_USER_DIRECTORY_DESKTOP, } GUserDirectory; +typedef enum { G_THREAD_PRIORITY_URGENT } GThreadPriority; +struct _GThread { }; +typedef struct _GCond GCond; +struct _GThreadFunctions { + void (*cond_wait) (GCond *cond, GError **error); + gboolean (*thread_equal) (gpointer thread1, gpointer thread2); +}; +typedef struct _GAsyncQueue GAsyncQueue; +void g_async_queue_sort (GAsyncQueue *queue, guint *save); +struct tm { }; +typedef struct __locale_struct { } *__locale_t; +extern int getaddrinfo (__const char *__restrict __name, struct addrinfo **__restrict __pai); +typedef struct _IO_FILE FILE; +__strsep_1c (char **__s, char __reject) { } +__strsep_2c (char **__s, char __reject1, char __reject2) { } +typedef struct stack_st { } STACK; +typedef struct asn1_string_st ASN1_BIT_STRING; +typedef struct bn_mont_ctx_st BN_MONT_CTX; +typedef struct evp_cipher_st EVP_CIPHER; +typedef struct EDIPartyName_st { + union { } d; +} GENERAL_NAME; +typedef struct DIST_POINT_NAME_st { + union { } name; +} DIST_POINT_NAME; +typedef struct SXNET_st { } NOTICEREF; +typedef struct GENERAL_SUBTREE_st { } X509_PURPOSE; +int X509V3_add_value(const char *name, const char *value, STACK **extlist); +int X509_PURPOSE_add(int id, int trust, int flags, char *name, char *sname, void *arg); +extern char *dcgettext (__const char *__domainname, __const char *__msgid, int __category) __attribute__ ((__nothrow__)) __attribute__ ((__format_arg__ (2))); +enum { __LC_CTYPE = 0, }; +struct lconv { }; +typedef enum gftp_logging_level_tag { gftp_logging_send, } gftp_logging_level; +struct gftp_file_tag { + char *file, *destfile; + unsigned int selected : 1, + is_fd : 1; + gint32 ipv4_network_address, ipv4_netmask; +} gftp_proxy_hosts; +typedef enum { gftp_option_type_text = 0, } gftp_option_type_enum; +typedef struct gftp_config_list_vars_tag { } gftp_config_list_vars; +typedef struct gftp_config_vars_tag { } gftp_config_vars; +typedef struct gftp_option_type_tag { + int (*read_function) (char *str, gftp_config_vars * cv, int line); + int (*write_function) (gftp_config_vars * cv, char *buf, size_t buflen, int to_config_file); +} gftp_option_type_var; +typedef struct gftp_request_tag gftp_request; +typedef void (*gftp_logging_func) ( gftp_logging_level level, const char *string, ... ); +typedef struct gftp_transfer_tag { + gftp_request * fromreq, * toreq; + unsigned int cancel : 1, + skip_file : 1; + long numfiles, resumed_bytes; +} gftp_transfer; +typedef struct gftp_log_tag { + unsigned int shown : 1, + use_threads : 1; +} supported_gftp_protocols; +void +gftp_config_parse_args (char *str, int numargs, int lineno, char **first, ...) +{ + char *curpos, *endpos, *pos, **dest, tempchar; + va_list argp; + dest = first; + while (numargs > 0) + { + if (numargs > 1) + { + dest = __builtin_va_arg(argp,char **); + *dest = ((void *)0); + } + numargs--; + **dest = '\0'; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34448.c b/gcc/testsuite/gcc.c-torture/compile/pr34448.c new file mode 100644 index 000000000..625f6f8cc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34448.c @@ -0,0 +1,31 @@ +typedef struct chunk_t chunk_t; +struct chunk_t +{ + unsigned char *ptr; + long unsigned int len; +}; +extern chunk_t asn1_wrap (chunk_t c, ...); +typedef struct linked_list_t linked_list_t; +chunk_t ietfAttr_list_encode (linked_list_t * list); +extern linked_list_t *groups; +static unsigned char ASN1_group_oid_str[] = { + 0x06 +}; +static const chunk_t ASN1_group_oid = { + ASN1_group_oid_str, sizeof (ASN1_group_oid_str) +}; +static chunk_t +build_attribute_type (const chunk_t type, chunk_t content) +{ + return type; +} +static chunk_t +build_attributes (void) +{ + return asn1_wrap (build_attribute_type (ASN1_group_oid, + ietfAttr_list_encode (groups))); +} +void build_attr_cert (void) +{ + asn1_wrap (build_attributes ()); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34458.c b/gcc/testsuite/gcc.c-torture/compile/pr34458.c new file mode 100644 index 000000000..096cc0c9b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34458.c @@ -0,0 +1,16 @@ +/* Testcase by Martin Michlmayr */ + +typedef struct +{ + int data[1024]; +} +Lint; +Lint lint_operate (Lint a, long long ammount) +{ + int index; + Lint ret; + for (index = 0; index < 24; index++) + ret.data[index] = + a.data[index + ammount / 32 + 1] << a.data[index + ammount / 32]; + return ret; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34648.c b/gcc/testsuite/gcc.c-torture/compile/pr34648.c new file mode 100644 index 000000000..8bcdae050 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34648.c @@ -0,0 +1,38 @@ +/* PR tree-optimization/34648 */ + +/* { dg-options "-fexceptions" } */ + +extern const unsigned short int **bar (void) __attribute__ ((const)); +const char *a; +int b; +char c; + +char +foo (int *x) +{ + char r; + + c = '\0'; + if (!b) + { + while (((*bar ())[a[*x]] & 0x2000) != 0) + (*x)++; + if (a[++(*x)] == '-') + { + (*x)++; + if (a[*x] && !((*bar ())[a[*x]] & 0x2000)) + return '?'; + } + if (!a[*x] || ((*bar ())[a[*x]] & 0x2000)) + { + while (((*bar ())[a[*x]] & 0x2000)) + ++(*x); + return '\0'; + } + } + + r = a[*x]; + b = a[*x] && !((*bar ())[a[*x]] & 0x2000); + return r; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34688.c b/gcc/testsuite/gcc.c-torture/compile/pr34688.c new file mode 100644 index 000000000..60e0f3c9f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34688.c @@ -0,0 +1,147 @@ +typedef __SIZE_TYPE__ size_t; + typedef struct { + } + HashTable; + typedef struct _zval_struct zval; + typedef struct _zend_guard { + HashTable *ht; + } + zvalue_value; + struct _zval_struct { + zvalue_value value; + } + php_output_globals; + typedef struct _php_stream php_stream; + typedef struct _php_stream_filter php_stream_filter; + typedef struct _php_stream_bucket_brigade php_stream_bucket_brigade; + typedef enum { + PSFS_ERR_FATAL, PSFS_FEED_ME, PSFS_PASS_ON, } + php_stream_filter_status_t; + typedef struct _php_stream_filter_ops { + php_stream_filter_status_t (*filter)( php_stream *stream, php_stream_filter *thisfilter, php_stream_bucket_brigade *buckets_in, php_stream_bucket_brigade *buckets_out, size_t *bytes_consumed, int flags ); + void (*dtor)(php_stream_filter *thisfilter ); + const char *label; + } + php_stream_filter_ops; + struct _php_stream_filter { + }; + typedef struct _php_stream_filter_factory { + php_stream_filter *(*create_filter)(const char *filtername, zval *filterparams, int persistent ); + } + php_stream_filter_factory; + typedef enum _php_conv_err_t { + PHP_CONV_ERR_SUCCESS = 0, PHP_CONV_ERR_UNKNOWN, PHP_CONV_ERR_TOO_BIG, PHP_CONV_ERR_INVALID_SEQ, PHP_CONV_ERR_UNEXPECTED_EOS, PHP_CONV_ERR_EXISTS, PHP_CONV_ERR_MORE, PHP_CONV_ERR_ALLOC, PHP_CONV_ERR_NOT_FOUND } + php_conv_err_t; + typedef struct _php_conv php_conv; + typedef php_conv_err_t (*php_conv_convert_func)(php_conv *, const char **, size_t *, char **, size_t *); + struct _php_conv { + php_conv_convert_func convert_op; + } + php_conv_base64_decode; + typedef struct _php_conv_qprint_decode { + php_conv _super; + const char *lbchars; + } + php_conv_qprint_decode; + static php_conv_err_t php_conv_qprint_decode_convert(php_conv_qprint_decode *inst, const char **in_pp, size_t *in_left_p, char **out_pp, size_t *out_left_p) { + size_t icnt, ocnt; + unsigned char *ps, *pd; + unsigned int scan_stat; + unsigned int lb_ptr, lb_cnt; + for (; + ; + ) { + switch (scan_stat) { + case 0: { + if (*ps == '=') { + scan_stat = 1; + } + else { + if (ocnt < 1) { + goto out; + } + *(pd++) = *ps; + ocnt--; + } + } + break; + case 1: { + if (*ps == ' ' || *ps == '\t') { + } + else if (!inst->lbchars && lb_cnt == 0 && *ps == '\r') { + lb_cnt++; + scan_stat = 5; + break; + } + else if (!inst->lbchars && lb_cnt == 0 && *ps == '\n') { + scan_stat = 0; + break; + } + } + case 2: { + if (icnt <= 0) { + goto out; + } + } + case 3: { + } + case 4: { + ps++, icnt--; + } + } + } + out: *in_pp = (const char *)ps; + } + static php_conv_err_t php_conv_qprint_decode_ctor(php_conv_qprint_decode *inst, const char *lbchars, size_t lbchars_len, int lbchars_dup, int persistent) { + inst->_super.convert_op = (php_conv_convert_func) php_conv_qprint_decode_convert; + } + typedef struct _php_convert_filter { + php_conv *cd; + } + php_convert_filter; + static php_conv *php_conv_open(int conv_mode, const HashTable *options, int persistent) { + php_conv *retval = ((void *)0); + switch (conv_mode) { + case 4: { + char *lbchars = ((void *)0); + size_t lbchars_len; + if (lbchars != ((void *)0)) { + if (php_conv_qprint_decode_ctor((php_conv_qprint_decode *)retval, lbchars, lbchars_len, 1, persistent)) { + } + } + } + } + } + static int php_convert_filter_ctor(php_convert_filter *inst, int conv_mode, HashTable *conv_opts, const char *filtername, int persistent) { + if ((inst->cd = php_conv_open(conv_mode, conv_opts, persistent)) == ((void *)0)) { + } + } + static php_stream_filter_status_t strfilter_convert_filter( php_stream *stream, php_stream_filter *thisfilter, php_stream_bucket_brigade *buckets_in, php_stream_bucket_brigade *buckets_out, size_t *bytes_consumed, int flags ) { + } + static void strfilter_convert_dtor(php_stream_filter *thisfilter ) { + } + static php_stream_filter_ops strfilter_convert_ops = { + strfilter_convert_filter, strfilter_convert_dtor, "convert.*" }; + static php_stream_filter *strfilter_convert_create(const char *filtername, zval *filterparams, int persistent ) { + php_convert_filter *inst; + int conv_mode = 0; + if (php_convert_filter_ctor(inst, conv_mode, (filterparams != ((void *)0) ? (*filterparams).value.ht : ((void *)0)), filtername, persistent) != 0) { + } + } + static php_stream_filter_factory strfilter_convert_factory = { + strfilter_convert_create }; + static const struct { + php_stream_filter_ops *ops; + php_stream_filter_factory *factory; + } + standard_filters[] = { + { + &strfilter_convert_ops, &strfilter_convert_factory } + }; + int zm_startup_standard_filters(int type, int module_number ) { + int i; + for (i = 0; + standard_filters[i].ops; + i++) { + } + } diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34808.c b/gcc/testsuite/gcc.c-torture/compile/pr34808.c new file mode 100644 index 000000000..8224061e6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34808.c @@ -0,0 +1,29 @@ +/* PR 34808 */ +/* { dg-do compile } +/* { dg-options "-fno-tree-dominator-opts" } */ + +extern int flags; + +struct r { int code; int val;}; + +int +foo (struct r *home) +{ + int n = 0; + int regno = -1; + + if (home->code == 0) + regno = home->val; + + if (home->code == 1) + bar (); + else if (regno >= 0) + n = (regno == 16 + ? 16 + : (regno - (unsigned long long) (flags != 0 ? 63 : 15) + ? regno - 128 + : -1)); + + baz (); + return n; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34856.c b/gcc/testsuite/gcc.c-torture/compile/pr34856.c new file mode 100644 index 000000000..7b0d5962a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34856.c @@ -0,0 +1,18 @@ +/* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */ +#undef __vector +#define __vector __attribute__((vector_size(16) )) +typedef __vector signed char qword; +typedef __vector unsigned int VU32; +extern short g[192 +16]; +void f(qword); +void f1 (unsigned ctr) +{ + VU32 pin; + pin = (VU32){(__SIZE_TYPE__)&g[16]}; + do { + f((qword)pin); + ctr--; + } +while(ctr); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34885.c b/gcc/testsuite/gcc.c-torture/compile/pr34885.c new file mode 100644 index 000000000..f5a3c13b5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34885.c @@ -0,0 +1,14 @@ +typedef union { + __const struct sockaddr *__restrict __sockaddr__; +} __CONST_SOCKADDR_ARG __attribute__ ((__transparent_union__)); +extern int _pure_socketcall (const struct sockaddr *); +extern int sendto (__CONST_SOCKADDR_ARG __addr); +int send(void) +{ + return sendto((void *)0); +} +int sendto(const struct sockaddr *to) +{ + return _pure_socketcall(to); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34966.c b/gcc/testsuite/gcc.c-torture/compile/pr34966.c new file mode 100644 index 000000000..6c36fb1e4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34966.c @@ -0,0 +1,21 @@ +extern double sin (double), cos (double); + +__inline double +atan (double __x) +{ + register double __result; +#if defined(__i386__) || defined(__x86_64__) + __asm __volatile__ ("" : "=t" (__result) : "0" (__x)); +#else + __result = __x; +#endif + return __result; +} + +double +f(double x) +{ + double t = atan (x); + return cos (t) + sin (t); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34993.c b/gcc/testsuite/gcc.c-torture/compile/pr34993.c new file mode 100644 index 000000000..ced4d5646 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34993.c @@ -0,0 +1,5 @@ +/* PR c/34993 */ + +/* { dg-do compile } */ + +typedef int x[] __attribute((may_alias)); diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35006.c b/gcc/testsuite/gcc.c-torture/compile/pr35006.c new file mode 100644 index 000000000..53de05cdb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35006.c @@ -0,0 +1,29 @@ +typedef unsigned long grub_uint64_t; +typedef grub_uint64_t grub_size_t; +grub_cmdline_get (unsigned max_len, int echo_char) +{ + unsigned xpos, ypos, ystart; + grub_size_t lpos, llen; + char buf[max_len]; + void cl_print (int pos, int c) + { + char *p; + for (p = buf + pos; *p; p++) + { + if (xpos++ > 78) + grub_putchar ('\n'); + grub_putchar (*p); + } + } + void cl_delete (unsigned len) + { + cl_set_pos (); + cl_print (lpos, ' '); + grub_memmove (); + cl_print (lpos, echo_char); + cl_set_pos (); + } + cl_delete (llen); + grub_size_t n = lpos; + cl_delete (n); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35043.c b/gcc/testsuite/gcc.c-torture/compile/pr35043.c new file mode 100644 index 000000000..a14379dc1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35043.c @@ -0,0 +1,20 @@ +typedef __SIZE_TYPE__ size_t; +typedef struct { + long double dat[2]; +} gsl_complex_long_double; +typedef struct { + size_t size; + size_t stride; + long double *data; +} gsl_vector_complex_long_double; +void gsl_vector_complex_long_double_set_zero (gsl_vector_complex_long_double * v) +{ + long double * const data = v->data; + const size_t n = v->size; + const size_t stride = v->stride; + const gsl_complex_long_double zero = { { 0.0L,0.0L} } ; + size_t i; + for (i = 0; i < n; i++) + *(gsl_complex_long_double *) (data + 2 * i * stride) = zero; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35171.c b/gcc/testsuite/gcc.c-torture/compile/pr35171.c new file mode 100644 index 000000000..3f7ef2cca --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35171.c @@ -0,0 +1,10 @@ +int f(int a, int b, short c, int d, short e) +{ + int i; + for (i = 1; i <= 2 ; i++) { + c -= 4; + a = c; + d = d + (b?b:e); + } + return a + d; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35318.c b/gcc/testsuite/gcc.c-torture/compile/pr35318.c new file mode 100644 index 000000000..6837d2d83 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35318.c @@ -0,0 +1,9 @@ +/* { dg-skip-if "" { pdp11-*-* } { "*" } { "" } } */ +/* PR target/35318 */ + +void +foo () +{ + double x = 4, y; + __asm__ volatile ("" : "=r,r" (x), "=r,r" (y) : "%0,0" (x), "m,r" (8)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35431.c b/gcc/testsuite/gcc.c-torture/compile/pr35431.c new file mode 100644 index 000000000..ffe9d068a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35431.c @@ -0,0 +1,15 @@ +void bar(); + +void foo(int i) +{ + __complex__ int k = 0; + + if (i) + k = 1; + + for (i = 0; i < 1; ++i) + ; + + if (k) + bar(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35432.c b/gcc/testsuite/gcc.c-torture/compile/pr35432.c new file mode 100644 index 000000000..6a0c92177 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35432.c @@ -0,0 +1,11 @@ +/* PR middle-end/35432 */ + +struct A +{ + char c[0]; +}; + +void foo(struct A a) +{ + (a = a).c; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35468.c b/gcc/testsuite/gcc.c-torture/compile/pr35468.c new file mode 100644 index 000000000..16d064b62 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35468.c @@ -0,0 +1,7 @@ +/* PR tree-optimization/35468 */ + +void +foo (void) +{ + *(char *) "c" = 'x'; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35492.c b/gcc/testsuite/gcc.c-torture/compile/pr35492.c new file mode 100644 index 000000000..a1681f0a0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35492.c @@ -0,0 +1,26 @@ +void prepare_to_wait (void *, void *, int); +void finish_wait (void *, void *); +extern signed long schedule_timeout (signed long); +struct sock +{ + unsigned char skc_state; + void *sk_sleep; + int sk_err; +}; + +void +sk_stream_wait_connect (struct sock *sk, long *timeo_p) +{ + int done; + int wait; + do + { + if ((1 << sk->skc_state) & ~12) + return; + prepare_to_wait (sk->sk_sleep, &wait, 1); + *(timeo_p) = schedule_timeout (0); + done = !sk->sk_err; + finish_wait (sk->sk_sleep, &wait); + } + while (!done); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35595.c b/gcc/testsuite/gcc.c-torture/compile/pr35595.c new file mode 100644 index 000000000..d88cedc56 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35595.c @@ -0,0 +1,59 @@ +/* { dg-require-effective-target int32plus } */ +typedef signed int __int32_t; +typedef unsigned int __uint32_t; +typedef union +{ + float value; + __uint32_t word; +} +ieee_float_shape_type; +static const float two23 = 8.3886080000e+06; +static const float pi = 3.1415927410e+00; +static const float zero = 0.0000000000e+00; +static float +sin_pif (float x) +{ + float y = 0; + float z = 0; + __int32_t n = 0; + __int32_t ix = 0; + do + { + ieee_float_shape_type gf_u = { 0 }; + (ix) = gf_u.word; + } + while (0); + if (z == y) + { + if (ix < 0x4b800000) + { + if (ix < 0x4b000000) + z = y + two23; + do + { + ieee_float_shape_type gf_u; + gf_u.value = (z); + (n) = gf_u.word; + } + while (0); + } + } + if (n == 0) + y = __kernel_sinf (pi * y, zero, 0); +} + +float +__ieee754_lgammaf_r (float x, int *signgamp) +{ + float t = 0; + __int32_t hx = 0; + do + { + ieee_float_shape_type gf_u = { 0 }; + (hx) = gf_u.word; + } + while (0); + if (hx < 0) + t = sin_pif (x); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35607.c b/gcc/testsuite/gcc.c-torture/compile/pr35607.c new file mode 100644 index 000000000..7f5aa7a2b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35607.c @@ -0,0 +1,9 @@ +extern void (*__fini_array_start []) (void); +extern void (*__fini_array_end []) (void); +void +__libc_csu_fini (void) +{ + __SIZE_TYPE__ i = __fini_array_end - __fini_array_start; + while (i-- > 0) + (*__fini_array_start [i]) (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35760.c b/gcc/testsuite/gcc.c-torture/compile/pr35760.c new file mode 100644 index 000000000..9b972f6b1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35760.c @@ -0,0 +1,7 @@ +/* PR target/35760 */ + +void +foo (void) +{ + __complex__ float i = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35869.c b/gcc/testsuite/gcc.c-torture/compile/pr35869.c new file mode 100644 index 000000000..e83c0e86b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35869.c @@ -0,0 +1,47 @@ +struct texture_stage_op +{ + unsigned int carg1, carg2, carg0; + unsigned int aarg1, aarg2, aarg0; + unsigned int dst; +}; + +static const char *debug_register(unsigned int reg) { + switch(reg) { + case 0x8921: return "GL_REG_0_ATI"; + case 0x8923: return "GL_REG_2_ATI"; + case 0x0: return "GL_ZERO"; + case 0x1: return "GL_ONE"; + default: return "Unknown register\n"; + } +} + +static unsigned int find_tmpreg(struct texture_stage_op op[8]) { + int i; + int tex_used[8]; + + for(i = 0; i < 8; i++) { + if(op[i].carg1 == 0x00000002 ) { + tex_used[i] = 1; + } + } + + for(i = 1; i < 6; i++) { + if(!tex_used[i]) { + return 0x8921 + i; + } + } + return 0; +} + +extern f(const char*); + +void g() { + struct texture_stage_op op[8]; + unsigned int tmparg = find_tmpreg(op); + unsigned int dstreg; + + if(tmparg == 0x0) return; + dstreg = tmparg; + f(debug_register(dstreg)); + return; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr36125.c b/gcc/testsuite/gcc.c-torture/compile/pr36125.c new file mode 100644 index 000000000..9257e8468 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr36125.c @@ -0,0 +1,10 @@ +/* PR middle-end/36125 */ + +extern void bar (long double *); + +int +foo (long double x) +{ + bar (&x); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr36141.c b/gcc/testsuite/gcc.c-torture/compile/pr36141.c new file mode 100644 index 000000000..82756199b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr36141.c @@ -0,0 +1,17 @@ +extern void ffi_closure_unix (void); +ffi_prep_closure_loc (void) +{ + struct ia64_fd + { + unsigned long long code_pointer; + unsigned long long gp; + }; + struct ffi_ia64_trampoline_struct + { + unsigned long long code_pointer; + }; + struct ffi_ia64_trampoline_struct *tramp; + struct ia64_fd *fd; + fd = (struct ia64_fd *)(void *)ffi_closure_unix; + tramp->code_pointer = fd->code_pointer; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr36154.c b/gcc/testsuite/gcc.c-torture/compile/pr36154.c new file mode 100644 index 000000000..ae3eb83fa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr36154.c @@ -0,0 +1,11 @@ +struct eth_test_pkt { + unsigned short len; + unsigned short ctr; + unsigned char packet[]; +} __attribute__ ((packed)); +struct eth_test_pkt pkt_unaligned = { .packet = { 0xFC } }; +int cmd_unaligned(const void *p) +{ + return memcmp(p, pkt_unaligned.packet, 1); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr36172.c b/gcc/testsuite/gcc.c-torture/compile/pr36172.c new file mode 100644 index 000000000..aaee377f5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr36172.c @@ -0,0 +1,17 @@ +int f(float * ); +__SIZE_TYPE__ FcCharSetFreeze (int *fcs, int b) +{ + int i; + int a = 0; + for (i = 0; i < *fcs; i++) + { + float *leaf = (float *)fcs; + int hash = f (leaf); + if (hash) + a = b; + if (!a) + return; + } + return (__SIZE_TYPE__) fcs; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr36238.c b/gcc/testsuite/gcc.c-torture/compile/pr36238.c new file mode 100644 index 000000000..358e1ff5e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr36238.c @@ -0,0 +1,27 @@ +typedef signed char int8_t; +typedef int int32_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +int32_t g_19 = 0x67F5AEE0L; +uint16_t g_169 = 0x89E3L; +const volatile uint32_t g_258 = 0x63AFEBCAL; +int32_t func_11; +int32_t func_29; +int32_t +func_5 (int32_t p_6, int32_t p_8, uint16_t p_10) +{ + if (lshift_s_s (func_11, p_8)) + { + int8_t l_18 = 0x6FL; + if (l_18) + for (p_6 = -14;; g_19 += 6) + { + int32_t l_283 = -1L; + if (((0x45L / 1L) > 0x07414511L * 1L / 1L > func_29) / 1L) + for (p_8 = 6;; p_8 -= 5) + l_283 = 0xC90541F7L; + } + } + else + g_169 = g_258; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr36245.c b/gcc/testsuite/gcc.c-torture/compile/pr36245.c new file mode 100644 index 000000000..375987539 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr36245.c @@ -0,0 +1,21 @@ +extern char buf1[10]; +extern char buf2[10]; +extern void b(int i, int j, int w); + +void a() { + int i,j; + char *p; + int w; + + p = buf1; + for(j = 0;j < 10; j++) { + for(i = 0;i < 10; i++) { + w = *p; + if(w != 1) { + w = buf2[p - buf1]; + b(i*2+1, j, w); + } + p++; + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr36666.c b/gcc/testsuite/gcc.c-torture/compile/pr36666.c new file mode 100644 index 000000000..9eb132cd0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr36666.c @@ -0,0 +1,22 @@ +struct Foo { + int *p; + struct X { + int a,b,c,d,e,*f; + } x; +} *init, *init2; + +struct X __attribute__((const)) foo(struct X); +struct Foo __attribute__((const)) foo2(struct Foo); + +void bar1 (void) +{ + init->x = foo (init2->x); +} +void bar2 (void) +{ + init->x = foo (init->x); +} +void bar3 (void) +{ + *init = foo2 (*init2); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr36817.c b/gcc/testsuite/gcc.c-torture/compile/pr36817.c new file mode 100644 index 000000000..396f491ec --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr36817.c @@ -0,0 +1,10 @@ +void xxx() +{ + unsigned i; + unsigned *p=0; + for(i=0; i<4; ++i) + *p++=0; + for(i=0; i<4; ++i) + *p++=0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr36988.c b/gcc/testsuite/gcc.c-torture/compile/pr36988.c new file mode 100644 index 000000000..44118d5dd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr36988.c @@ -0,0 +1,11 @@ +typedef struct { + unsigned char mbxCommand; +} MAILBOX_t; +void lpfc_sli_brdrestart(void) +{ + volatile unsigned int word0; + MAILBOX_t *mb; + mb = (MAILBOX_t *) &word0; + mb->mbxCommand = 0x1A; + __writel((*(unsigned int *) mb)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37026.c b/gcc/testsuite/gcc.c-torture/compile/pr37026.c new file mode 100644 index 000000000..694e2ca2a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37026.c @@ -0,0 +1,12 @@ +struct a { + long a1; + long a2; +}; +struct b { + struct a b1; + struct a b2; +}; +void bar (struct b *c) +{ + c->b1 = c->b2 = ((struct a) { foo(), 0 }); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37056.c b/gcc/testsuite/gcc.c-torture/compile/pr37056.c new file mode 100644 index 000000000..f9285e2c7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37056.c @@ -0,0 +1,28 @@ +extern void abort (void); + +static union { + char buf[12 * sizeof (long long)]; +} u; + +int main () +{ + int off, len, i; + char *p, *q; + + for (off = 0; off < (sizeof (long long)); off++) + for (len = 1; len < (10 * sizeof (long long)); len++) + { + for (i = 0; i < (12 * sizeof (long long)); i++) + u.buf[i] = 'a'; + p = (__extension__ (__builtin_constant_p ('\0') && ('\0') == '\0' + ? ({void *__s = (u.buf + off); __s;}) + : __builtin_memset (u.buf + off, '\0', len))); + if (p != u.buf + off) + abort (); + for (i = 0; i < off; i++, q++) + if (*q != 'a') + abort (); + } + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37078.c b/gcc/testsuite/gcc.c-torture/compile/pr37078.c new file mode 100644 index 000000000..1cc1659f1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37078.c @@ -0,0 +1,6 @@ +int foo (int b) +{ + if (b == (int)0x80000000) + return __builtin_abs (b); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37207.c b/gcc/testsuite/gcc.c-torture/compile/pr37207.c new file mode 100644 index 000000000..72333d26f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37207.c @@ -0,0 +1,21 @@ +void +func_18 ( int t ) +{ + unsigned l_889; + int l_895 = 1; + for (0; 1; ++l_889) + { + int t1 = 0; + if (func_81 (1)) + { + int rhs = l_895; + if (rhs == 0) + rhs = 1; + if (1 & (t % rhs)) + t1 = 1; + } + func_98 (t1); + l_895 = 0; + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37258.c b/gcc/testsuite/gcc.c-torture/compile/pr37258.c new file mode 100644 index 000000000..5091d980b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37258.c @@ -0,0 +1,58 @@ +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; +__extension__ typedef long long int int64_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +static inline unsigned int +lshift_u_s (unsigned int left, int right) +{ + if ((right) || (right >= sizeof (unsigned int) * 8) + || (left > (4294967295U >> right))) + return left; +} +static inline unsigned long int +div_rhs (long int rhs) +{ + if (rhs == 0) + return 1; + return rhs; +} + +uint32_t g_230; +int8_t g_294; +uint16_t g_316; +uint32_t g_334; +int32_t g_375; +int64_t g_380; +int32_t func_99 (int16_t p_100, int32_t p_101, int32_t p_102, int32_t p_103, + int64_t p_105, int32_t p_106, int32_t p_107, int16_t p_108, + int16_t p_109); +int32_t +func_77 (int64_t p_79) +{ + int16_t l_397; + if (mod_rhs (p_79)) + p_79 = 1; + else + for (p_79 = 0; 0; p_79 += 1) + { + } + if (lshift_s_s (1, func_112 (2L, (lshift_u_s (g_334, p_79))))) + { + int8_t l_384; + int64_t l_414; + if (lshift_u_s (g_375, 1)) + { + func_23 (func_99 (1, 1, 1, 1, g_230, p_79, 1, g_334, 1), 1); + for (p_79 = 0; 0; ++p_79) + { + } + } + if (div_rhs (func_82 (1, 1, g_380, 1, l_397, 1, 1))) + func_99 ((func_82 + (1, g_334, g_294, func_112 (1, (p_79 & 1)), g_316, 1, 1)), + 1, (0xFBA25CA382A8CA74LL), l_384, l_414, 0L, 1, 1, 1); + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37285.c b/gcc/testsuite/gcc.c-torture/compile/pr37285.c new file mode 100644 index 000000000..972478b18 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37285.c @@ -0,0 +1,15 @@ +_bfd_xcoff_canonicalize_dynamic_reloc (unsigned long long l_symndx) +{ + if (l_symndx < 3) + { + switch (l_symndx) + { + case 0: + case 1: + break; + case 2: + _bfd_abort ("HI"); + } + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37305.c b/gcc/testsuite/gcc.c-torture/compile/pr37305.c new file mode 100644 index 000000000..7c0673609 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37305.c @@ -0,0 +1,19 @@ +typedef int int32_t; +typedef unsigned int uint32_t; +static inline int +safe_add_s_s (int si1, int si2) +{ + if ((si1 > 0) && (si2 > 0) && (si1 > (si2)) || (si1 < 0) && (si2 < 0) + && (si1 < ((-__INT_MAX__ - 1) - si2))) + return si1; +} + +uint32_t g_8; +uint32_t +func_24 (int32_t p_25) +{ + uint32_t l_30 = -1L; + if ((safe_mod_u_u (1, 1)) | (safe_add_s_s (g_8, l_30))) + return 1; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37327.c b/gcc/testsuite/gcc.c-torture/compile/pr37327.c new file mode 100644 index 000000000..7041d834e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37327.c @@ -0,0 +1,48 @@ +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +static inline uint32_t +safe_add_int8_t_s_s (int8_t si1, int16_t si2) +{ + if ((si1) && (si2) && (si1 > (1 - si2)) || (si1) && (si2 < 0) + && (si1 < (-128 - si2))) + return si1; + return si1 + si2; +} + +uint32_t g_2; +uint32_t g_113; +uint32_t g_145; +int32_t +func_17 (int32_t p_18, uint32_t p_19, uint32_t p_21) +{ + uint32_t l_23 = -1L; + return l_23; +} + +uint32_t +func_26 (uint16_t p_27) +{ + uint32_t l_424; + if (func_93 (func_59 (safe_add_int8_t_s_s (p_27, 1))), + func_124 (l_424, -7L, 1, g_145, 1, (safe_add_int8_t_s_s (1, 1)), 1), 1, + 1, 1) + func_117 (1, 1, + (safe_add_uint64_t_u_u + (1, (safe_add_int8_t_s_s (1, 0xCDF4BE7A1B7E4629LL)))), 1); + uint32_t l_210; + if (func_17 + ((safe_add_int8_t_s_s (g_2, (0x6C79A83AL | func_17 (1, 1, 1)))), + 0x4C9FL, 1)) + { + uint32_t l_212; + if (safe_mul_int32_t_s_s + ((1, 1, l_212, (1, (safe_add_int8_t_s_s (l_210, 1)), 1, 1)), 1)) + if (func_59 (1, (safe_add_int8_t_s_s (g_113, 1)))) + { + } + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37341.c b/gcc/testsuite/gcc.c-torture/compile/pr37341.c new file mode 100644 index 000000000..adbf0c7e4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37341.c @@ -0,0 +1,35 @@ +/* PR rtl-optimization/37341 */ + +short int a; +int b; + +static inline int +f1 (int x, int y) +{ + if (x < 0 || y < 0 || y >= sizeof (int) * 8 || x > (1 >> y)) + return x; +} + +static inline unsigned int +f2 (int x, int y) +{ + if (y <= 0 && x && y < __INT_MAX__ / x) + return x; + return x * y; +} + +int +f3 (void) +{ + return (signed char) 0xb6; +} + +unsigned int +f4 (unsigned int x) +{ + while (1) + { + if ((f2 (f3 (), (f1 (a, b)))) < x) + return 1; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37380.c b/gcc/testsuite/gcc.c-torture/compile/pr37380.c new file mode 100644 index 000000000..d757e0245 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37380.c @@ -0,0 +1,51 @@ +typedef struct basic_block_def *basic_block; +typedef struct gimple_seq_node_d *gimple_seq_node; +typedef struct gimple_seq_d *gimple_seq; +typedef struct +{ + gimple_seq_node ptr; + gimple_seq seq; + basic_block bb; +} gimple_stmt_iterator; +typedef void *gimple; +extern void exit(int); +struct gimple_seq_node_d +{ + gimple stmt; + struct gimple_seq_node_d *next; +}; +struct gimple_seq_d +{ +}; +static __inline__ gimple_stmt_iterator +gsi_start (gimple_seq seq) +{ + gimple_stmt_iterator i; + i.seq = seq; + return i; +} +static __inline__ unsigned char +gsi_end_p (gimple_stmt_iterator i) +{ + return i.ptr == ((void *)0); +} +static __inline__ void +gsi_next (gimple_stmt_iterator *i) +{ + i->ptr = i->ptr->next; +} +static __inline__ gimple +gsi_stmt (gimple_stmt_iterator i) +{ + return i.ptr->stmt; +} +void +c_warn_unused_result (gimple_seq seq) +{ + gimple_stmt_iterator i; + for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i)) + { + gimple g = gsi_stmt (i); + if (!g) exit(0); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37381.c b/gcc/testsuite/gcc.c-torture/compile/pr37381.c new file mode 100644 index 000000000..a2fed66c4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37381.c @@ -0,0 +1,97 @@ +extern unsigned int __invalid_size_argument_for_IOC; +typedef unsigned int __u32; +struct video_window +{ + __u32 x, y; + __u32 width, height; +}; +typedef unsigned long XID; +typedef XID Window; +typedef struct _XExtData +{ + Window root; +} +Screen; +typedef struct +{ + int border_width; +} +XWindowAttributes; +typedef struct _XDisplay Display; +typedef struct +{ + int default_screen; + Screen *screens; +} + *_XPrivDisplay; +typedef struct +{ + int x, y; +} +XSizeHints; +typedef struct +{ + unsigned short hdisplay; + unsigned short vdisplay; +} +XF86VidModeModeInfo; +Display *display; +int tfd; +int ccapt; +int tml; +int fswidth = 0; +int fsheight = 0; +Window fmwin; +XF86VidModeModeInfo **modelines, *fullscreenmode = ((void *) 0); +struct video_window vswin; +DoFullScreen (void) +{ + int i; + int rx, ry; + Window junkwin; + XSizeHints fmsizehints; + XWindowAttributes fmwinattr; + if (ioctl + (tfd, + (((1U) << (((0 + 8) + 8) + 14)) | ((('v')) << (0 + 8)) | (((8)) << 0) | + (((((sizeof (int) == sizeof (int[1]) + && sizeof (int) < + (1 << 14)) ? sizeof (int) : __invalid_size_argument_for_IOC))) << + ((0 + 8) + 8))), &ccapt) < 0) + { + perror ("ioctl VIDIOCCAPTURE"); + } + if (!XTranslateCoordinates + (display, fmwin, + ((&((_XPrivDisplay) display)-> + screens[(((_XPrivDisplay) display)->default_screen)])->root), + -fmwinattr.border_width, -fmwinattr.border_width, &rx, &ry, &junkwin)) + { + } + vswin.width = fswidth; + vswin.height = fsheight; + vswin.x = fmsizehints.x + rx; + vswin.y = fmsizehints.y + ry; + if (ioctl + (tfd, + (((1U) << (((0 + 8) + 8) + 14)) | ((('v')) << (0 + 8)) | (((8)) << 0) | + (((((sizeof (int) == sizeof (int[1]) + && sizeof (int) < + (1 << 14)) ? sizeof (int) : __invalid_size_argument_for_IOC))) << + ((0 + 8) + 8))), &ccapt) < 0) + { + XF86VidModeGetAllModeLines (display, XDefaultScreen (display), &tml, + &modelines); + { + if ((modelines[i]->hdisplay == fswidth) + && (modelines[i]->vdisplay == fsheight)) + { + fullscreenmode = modelines[i]; + } + } + { + XF86VidModeSetViewPort (display, XDefaultScreen (display), vswin.x, + vswin.y); + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37382.c b/gcc/testsuite/gcc.c-torture/compile/pr37382.c new file mode 100644 index 000000000..47525bcf9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37382.c @@ -0,0 +1,16 @@ +/* PR target/37382 */ + +void baz (char *); +int c; + +void +bar (void) +{ + char a[2]; + int *ip = &c; + char *p = a, *q = (char *) &ip; + const char *r = q + 2; + for (; q != r; p++, q++) + *p = *q; + baz (a); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37387.c b/gcc/testsuite/gcc.c-torture/compile/pr37387.c new file mode 100644 index 000000000..d338933e6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37387.c @@ -0,0 +1,11 @@ +typedef long int Int; +void FuncMakeConsequencesPres (long *objDefs1) +{ + long a = (long)objDefs1; + int c = a & 0x01; + int b = 0; + if (! ( 13 <= ( c ? 0 : (((int) objDefs1 & 0x02) ? 0 : *objDefs1 )) + && b <= 0)) + ErrorQuit (); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37395.c b/gcc/testsuite/gcc.c-torture/compile/pr37395.c new file mode 100644 index 000000000..e15b1543f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37395.c @@ -0,0 +1,11 @@ +/* PR target/37395 */ + +int +f (int j) +{ + int i; + asm volatile ("" : "=r"(i)); + if (i >= 0) + j = 0; + return j; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37418-1.c b/gcc/testsuite/gcc.c-torture/compile/pr37418-1.c new file mode 100644 index 000000000..dbb1a651d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37418-1.c @@ -0,0 +1,6 @@ +typedef void ft(int); +void f(int args)__attribute__((noreturn)); +void f2(ft *p __attribute__((noreturn))) +{ + p = f; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37418-2.c b/gcc/testsuite/gcc.c-torture/compile/pr37418-2.c new file mode 100644 index 000000000..dcc003984 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37418-2.c @@ -0,0 +1,6 @@ +typedef void ft(int); +volatile ft f; +void f2(ft *p __attribute__((noreturn))) +{ + p = f; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37418-3.c b/gcc/testsuite/gcc.c-torture/compile/pr37418-3.c new file mode 100644 index 000000000..5a2c2e81e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37418-3.c @@ -0,0 +1,6 @@ +typedef void ft(int); +void f(int args)__attribute__((const)); +void f2(ft *p __attribute__((const))) +{ + p = f; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37418-4.c b/gcc/testsuite/gcc.c-torture/compile/pr37418-4.c new file mode 100644 index 000000000..bc8727890 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37418-4.c @@ -0,0 +1,6 @@ +typedef void ft(int); +const ft f; +void f2(ft *p __attribute__((const))) +{ + p = f; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37432.c b/gcc/testsuite/gcc.c-torture/compile/pr37432.c new file mode 100644 index 000000000..747ec34c8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37432.c @@ -0,0 +1,9 @@ +static void print_wkb_byte(unsigned char val) { + print_wkb_bytes((unsigned char *)&val, 1, 1); +} +void InsertMultiPoint(int b) { + char a = 1; + if (b) a = 0; + print_wkb_byte(a); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37433.c b/gcc/testsuite/gcc.c-torture/compile/pr37433.c new file mode 100644 index 000000000..0ba117988 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37433.c @@ -0,0 +1,11 @@ +int regex_subst(void) +{ + const void *subst = ""; + return (*(int (*)(int))subst) (0); +} + +int foobar (void) +{ + int x; + return (*(int (*)(void))&x) (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37483.c b/gcc/testsuite/gcc.c-torture/compile/pr37483.c new file mode 100644 index 000000000..b09489250 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37483.c @@ -0,0 +1,10 @@ +/* PR target/37483 */ + +unsigned long long +foo (unsigned count, int i) +{ + unsigned long long value; + if (i == 0) + value = (value & 0xFFFFFFFF) >> count; + return value; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37617.c b/gcc/testsuite/gcc.c-torture/compile/pr37617.c new file mode 100644 index 000000000..901b8cabf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37617.c @@ -0,0 +1,19 @@ +typedef union +{ + char *string; + double dval; + float fval; +} yystype; +char *f(void) +{ + yystype tok; + tok.dval = 0; + return (tok.string); +} +char *f1(void) +{ + yystype tok; + tok.fval = 0; + return (tok.string); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37662.c b/gcc/testsuite/gcc.c-torture/compile/pr37662.c new file mode 100644 index 000000000..f6977438e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37662.c @@ -0,0 +1,15 @@ +/* PR tree-optimization/37662 */ + +extern int baz (void); + +static int +foo (void) +{ + return 1; +} + +int +bar (void) +{ + return foo () >= 1 ^ (baz () || 0) || 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37664.c b/gcc/testsuite/gcc.c-torture/compile/pr37664.c new file mode 100644 index 000000000..cf5c83d7b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37664.c @@ -0,0 +1,14 @@ +/* PR tree-optimization/37664 */ + +int v; + +int +foo () +{ + int a = 0x8899A862; + int b = 0x8E * a; + int c = (b % b); + if (v > (4294967295U >> c)) + return v; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37669-2.c b/gcc/testsuite/gcc.c-torture/compile/pr37669-2.c new file mode 100644 index 000000000..abeae7a2f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37669-2.c @@ -0,0 +1,14 @@ +/* PR middle-end/37669 */ + +#define FMT10 "%d%d%d%d%d%d%d%d%d%d" +#define FMT100 FMT10 FMT10 FMT10 FMT10 FMT10 FMT10 FMT10 FMT10 FMT10 FMT10 +#define FMT1000 FMT100 FMT100 FMT100 FMT100 FMT100 \ + FMT100 FMT100 FMT100 FMT100 FMT100 +#define ARG10 , i, i, i, i, i, i, i, i, i, i +#define ARG100 ARG10 ARG10 ARG10 ARG10 ARG10 ARG10 ARG10 ARG10 ARG10 ARG10 +#define ARG1000 ARG100 ARG100 ARG100 ARG100 ARG100 \ + ARG100 ARG100 ARG100 ARG100 ARG100 +void foo (char *s, int i, int j) +{ + __builtin___snprintf_chk (s, i, 1, j, FMT1000 ARG1000); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37669.c b/gcc/testsuite/gcc.c-torture/compile/pr37669.c new file mode 100644 index 000000000..68e96c621 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37669.c @@ -0,0 +1,35 @@ +/* This testcase used to fail because a miscompiled execute_fold_all_builtins. */ + +typedef __SIZE_TYPE__ size_t; +extern __inline __attribute__ ((__always_inline__)) int __attribute__ +((__nothrow__)) snprintf (char *__restrict __s, size_t __n, __const char +*__restrict __fmt, ...) { + return __builtin___snprintf_chk (__s, __n, 2 - 1, +__builtin_object_size (__s, 2 > 1), __fmt, __builtin_va_arg_pack ()); +} +int n1, n2, n3, n4, f5, f6; +char * BackgroundGetUniqueString(void) +{ + char s[256]; + const char *chmap = +"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_"; + snprintf(s, sizeof(s), +"%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", + chmap[(n1 >> 0) & 0x3f], chmap[(n1 >> 6) & 0x3f], + chmap[(n1 >> 12) & 0x3f], chmap[(n1 >> 18) & 0x3f], + chmap[(n1 >> 24) & 0x3f], chmap[(n1 >> 28) & 0x3f], + chmap[(n2 >> 0) & 0x3f], chmap[(n2 >> 6) & 0x3f], + chmap[(n2 >> 12) & 0x3f], chmap[(n2 >> 18) & 0x3f], + chmap[(n2 >> 24) & 0x3f], chmap[(n2 >> 28) & 0x3f], + chmap[(n3 >> 0) & 0x3f], chmap[(n3 >> 6) & 0x3f], + chmap[(n3 >> 12) & 0x3f], chmap[(n3 >> 18) & 0x3f], + chmap[(n3 >> 24) & 0x3f], chmap[(n3 >> 28) & 0x3f], + chmap[(n4 >> 0) & 0x3f], chmap[(n4 >> 6) & 0x3f], + chmap[(n4 >> 12) & 0x3f], chmap[(n4 >> 18) & 0x3f], + chmap[(n4 >> 24) & 0x3f], chmap[(n4 >> 28) & 0x3f], + chmap[(f5 >> 12) & 0x3f], chmap[(f5 >> 18) & 0x3f], + chmap[(f5 >> 24) & 0x3f], chmap[(f5 >> 28) & 0x3f], + chmap[(f6 >> 0) & 0x3f], chmap[(f6 >> 6) & 0x3f] + ); + return __builtin_strdup(s); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37713.c b/gcc/testsuite/gcc.c-torture/compile/pr37713.c new file mode 100644 index 000000000..04b4394dc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37713.c @@ -0,0 +1,10 @@ +void add_opush(void) +{ + unsigned char formats[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0xff }; + void *dtds[sizeof(formats)]; + unsigned int i; + unsigned char dtd = 0x08; + for (i = 0; i < sizeof(formats); i++) + dtds[i] = &dtd; + sdp_seq_alloc(dtds); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37742-3.c b/gcc/testsuite/gcc.c-torture/compile/pr37742-3.c new file mode 100644 index 000000000..541bd42ad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37742-3.c @@ -0,0 +1,17 @@ +void matmul_i4 (int * __restrict dest_y, + const int * __restrict abase, + const int * __restrict bbase_y, + int count, int xcount, int ycount, int aystride) +{ + int x, y, n; + const int * __restrict abase_n; + int bbase_yn; + for (y = 0; y < ycount; y++) + for (n = 0; n < count; n++) { + abase_n = abase + n*aystride; + bbase_yn = bbase_y[n]; + for (x = 0; x < xcount; x++) + dest_y[x] += abase_n[x] * bbase_yn; + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37742.c b/gcc/testsuite/gcc.c-torture/compile/pr37742.c new file mode 100644 index 000000000..4ef00be4a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37742.c @@ -0,0 +1,21 @@ +void foo(int* __restrict__ p, int* q, int* p1, int *q1) +{ + int i; + + p = p1; + q = q1; + + for (i = 0; i < 4; ++i) + *++q = *++p + 1; +} + +void bar(int* p, int* __restrict__ q, int* p1, int *q1) +{ + int i; + + p = p1; + q = q1; + + for (i = 0; i < 4; ++i) + *++q = *++p + 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37878.c b/gcc/testsuite/gcc.c-torture/compile/pr37878.c new file mode 100644 index 000000000..aa18e6d32 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37878.c @@ -0,0 +1,9 @@ +/* PR target/37878 */ + +double y, z; +void foo (long x) +{ + y = *(double *) ((long *) (x - 1) + 1); + z = *(double *) ((long *) (x - 1) + 1); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37913.c b/gcc/testsuite/gcc.c-torture/compile/pr37913.c new file mode 100644 index 000000000..98b8f6478 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37913.c @@ -0,0 +1,15 @@ +/* PR middle-end/37913 */ + +void foo (void) __attribute__ ((noreturn)); + +static int __attribute__ ((noreturn)) +bar (void) +{ + foo (); +} + +void +baz (void) +{ + int i = bar (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37955.c b/gcc/testsuite/gcc.c-torture/compile/pr37955.c new file mode 100644 index 000000000..1ac0246f5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37955.c @@ -0,0 +1,19 @@ +typedef struct +{ + enum { NotConnected = 0 } conn_state; + unsigned int conn_hndl; +} AEP_CONNECTION_ENTRY; + +static AEP_CONNECTION_ENTRY aep_app_conn_table[256]; + +void aep_mod_exp (void) +{ + int count; + + for (count = 0; count < 256; count++) + { + aep_app_conn_table[count].conn_state = NotConnected; + aep_app_conn_table[count].conn_hndl = 0; + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37976.c b/gcc/testsuite/gcc.c-torture/compile/pr37976.c new file mode 100644 index 000000000..6b2ba63c0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37976.c @@ -0,0 +1,6 @@ +void percent_x(int ch, char *p, char* ok_chars) +{ + char *cp = ch == 'a' ? p : ""; + for (;*(cp += __builtin_strspn (cp, ok_chars));) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37991.c b/gcc/testsuite/gcc.c-torture/compile/pr37991.c new file mode 100644 index 000000000..f374ea985 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37991.c @@ -0,0 +1,14 @@ +typedef int Int32; +void use_it(int); +void FindAndReadSignature(int processedSize) +{ + int numPrevBytes = 1; + for (;;) + { + int numBytesInBuffer = numPrevBytes + processedSize; + Int32 numTests = numBytesInBuffer - 1; + use_it (numTests); + numPrevBytes = numBytesInBuffer - numTests; + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38123.c b/gcc/testsuite/gcc.c-torture/compile/pr38123.c new file mode 100644 index 000000000..b36ad118f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38123.c @@ -0,0 +1,13 @@ +/* PR target/38123 */ + +#include + +struct S { int i; double d; }; + +struct S +test (char *x, va_list ap) +{ + struct S s; + s = va_arg (ap, struct S); + return s; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38343-2.c b/gcc/testsuite/gcc.c-torture/compile/pr38343-2.c new file mode 100644 index 000000000..8444cc78f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38343-2.c @@ -0,0 +1,12 @@ +/* PR middle-end/38343 */ + +static struct S +{ + char f[6]; +} s[] = { {"01000"} }; + +char * +foo (void) +{ + return __builtin_stpcpy (s[0].f, "S0022"); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38343.c b/gcc/testsuite/gcc.c-torture/compile/pr38343.c new file mode 100644 index 000000000..589ba33a2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38343.c @@ -0,0 +1,12 @@ +/* PR middle-end/38343 */ + +static struct A +{ + char f[6]; +} a[] = { {"01000"} }; + +void +foo (void) +{ + __builtin_stpcpy (a[0].f, "S0022"); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38359.c b/gcc/testsuite/gcc.c-torture/compile/pr38359.c new file mode 100644 index 000000000..cb77b71dd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38359.c @@ -0,0 +1,17 @@ +unsigned _ov_64_seek_lap (_Bool x1, _Bool x2, _Bool x3) +{ + unsigned ltmp_3978_7__PHI_TEMPORARY; + signed ltmp_4011_7; + + if (!x1 || !x2) + while (1) ; + + if (x3) + ltmp_3978_7__PHI_TEMPORARY = 0xffffff7e; + else + ltmp_3978_7__PHI_TEMPORARY = 1; + + ltmp_4011_7 = -1; + return ltmp_4011_7 >> ltmp_3978_7__PHI_TEMPORARY; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38360.c b/gcc/testsuite/gcc.c-torture/compile/pr38360.c new file mode 100644 index 000000000..463218d11 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38360.c @@ -0,0 +1,9 @@ +/* PR middle-end/38360 */ + +int +main () +{ + fputs (""); + fputs_unlocked (""); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38428.c b/gcc/testsuite/gcc.c-torture/compile/pr38428.c new file mode 100644 index 000000000..aa32fc149 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38428.c @@ -0,0 +1,20 @@ +/* PR middle-end/38428 */ + +struct S +{ + volatile struct + { + unsigned int t : 1; + } s; +}; + +int +foo (struct S *x) +{ + int ret; + if (x->s.t) + ret = 0; + else + ret = 10; + return ret; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38505.c b/gcc/testsuite/gcc.c-torture/compile/pr38505.c new file mode 100644 index 000000000..b3b4a10c7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38505.c @@ -0,0 +1,23 @@ +/* PR middle-end/38505 */ +/* { dg-do compile } */ + +struct S +{ + unsigned short a[50]; + unsigned short b[20]; +}; +extern void bar (struct S *); +extern void baz (unsigned short *); +extern unsigned short d[]; + +void +foo (void) +{ + struct S s; + unsigned short g[50]; + + baz (g); + __builtin_memcpy (&s, g, sizeof (g)); + __builtin_memcpy (s.b, d, sizeof (s.b)); + bar (&s); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38554.c b/gcc/testsuite/gcc.c-torture/compile/pr38554.c new file mode 100644 index 000000000..7d40a223b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38554.c @@ -0,0 +1,45 @@ +typedef unsigned long sample; +struct pam +{ + sample maxval; +}; +typedef sample *tuple; +enum function + { + FN_MULTIPLY, FN_DIVIDE, FN_ADD, FN_SUBTRACT, FN_MIN, FN_MAX, FN_AND, FN_OR, + FN_XOR, FN_NOT, FN_SHIFTLEFT, FN_SHIFTRIGHT + }; +struct cmdlineInfo +{ + enum function function; + union + { + float divisor; + unsigned int shiftCount; + } + u; +}; +applyFunction (struct cmdlineInfo const cmdline, struct pam const inpam, + struct pam const outpam, tuple * const inputRow, + tuple * const outputRow) +{ + float const oneOverDivisor = 1 / cmdline.u.divisor; + int col; + { + int plane; + { + sample const inSample = inputRow[col][plane]; + sample outSample; + switch (cmdline.function) + { + case FN_DIVIDE: + outSample = ((unsigned int) ((inSample * oneOverDivisor) + 0.5)); + break; + case FN_SHIFTLEFT: + outSample = (inSample << cmdline.u.shiftCount) & outpam.maxval; + } + outputRow[col][plane] = + ((outpam.maxval) < (outSample) ? (outpam.maxval) : (outSample)); + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38564.c b/gcc/testsuite/gcc.c-torture/compile/pr38564.c new file mode 100644 index 000000000..de365cc1f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38564.c @@ -0,0 +1,22 @@ +struct S +{ + struct S *n, *p; +} *s; + +void bar (void *); + +int +foo (int x) +{ + struct S p = { &p, &p }; + int i; + for (i = 0; i < x; i++) + bar (s); + return p.n == &p; +} + +int dialog_calendar(int state) +{ + int *obj = (state == 1 ? &state : 0); + return (obj == &state); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38590-1.c b/gcc/testsuite/gcc.c-torture/compile/pr38590-1.c new file mode 100644 index 000000000..87976546e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38590-1.c @@ -0,0 +1,6 @@ + +int func_75 (int p_76) +{ + return (1 / (int) -(unsigned int)p_76); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38590-2.c b/gcc/testsuite/gcc.c-torture/compile/pr38590-2.c new file mode 100644 index 000000000..076359d74 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38590-2.c @@ -0,0 +1,6 @@ + +int func_75 (int p_76) +{ + return (1 / (int) -(unsigned int)p_76) ? 1 : p_76; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38661-1.c b/gcc/testsuite/gcc.c-torture/compile/pr38661-1.c new file mode 100644 index 000000000..065f12010 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38661-1.c @@ -0,0 +1,9 @@ +/* We used to ICE because we would wrap INT_MAX + into INT_MIN while doing the switch converison. */ + +const char *func(int val) { + switch (val) { + case - __INT_MAX__ -1 : return "foo"; + default: return ""; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38661.c b/gcc/testsuite/gcc.c-torture/compile/pr38661.c new file mode 100644 index 000000000..5d243c6be --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38661.c @@ -0,0 +1,9 @@ +/* We used to ICE because we would wrap INT_MAX + into INT_MIN while doing the switch converison. */ + +const char *func(int val) { + switch (val) { + case __INT_MAX__: return "foo"; + default: return ""; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38752.c b/gcc/testsuite/gcc.c-torture/compile/pr38752.c new file mode 100644 index 000000000..3d409bf96 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38752.c @@ -0,0 +1,25 @@ +typedef struct +{ + int baddr; +} mstruct_t; + +static struct +{ + unsigned int mapnum; + mstruct_t unused; +} mtab; + +static mstruct_t *mactab = &mtab.unused; + +int +main(void) +{ + int i; + int addr; + + for (i=1; i <= mtab.mapnum; i++) + if (addr < mactab[i].baddr) + break; + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38771.c b/gcc/testsuite/gcc.c-torture/compile/pr38771.c new file mode 100644 index 000000000..7988680dd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38771.c @@ -0,0 +1,7 @@ +/* PR middle-end/38771 */ + +unsigned long long +foo (long long x) +{ + return -(unsigned long long) (x ? : x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38789.c b/gcc/testsuite/gcc.c-torture/compile/pr38789.c new file mode 100644 index 000000000..1a26b8055 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38789.c @@ -0,0 +1,19 @@ +/* PR tree-optimization/38789 */ +/* { dg-do compile } */ + +void +baz (int v) +{ + unsigned a = (v == 1) ? 1 : 2; + + if (__builtin_constant_p (a)) + asm volatile ("# constant %0" :: "i" (a)); + else + asm volatile ("# register %0" :: "r" (a)); + + a = 6; + if (__builtin_constant_p (a)) + asm volatile ("# constant %0" :: "i" (a)); + else + asm volatile ("# register %0" :: "r" (a)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38807.c b/gcc/testsuite/gcc.c-torture/compile/pr38807.c new file mode 100644 index 000000000..8b05d08aa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38807.c @@ -0,0 +1,23 @@ +/* PR tree-optimization/38807 */ + +int +baz (short x) +{ + return x; +} + +int a, b; + +int +bar (int x) +{ + if (baz (a ^ x ^ a)) + return b; + return 0; +} + +int +foo (void) +{ + return bar (a == 0 || 1 == 1 - a) ? 1 : bar (1 && a); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38857.c b/gcc/testsuite/gcc.c-torture/compile/pr38857.c new file mode 100644 index 000000000..2492b77a1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38857.c @@ -0,0 +1,22 @@ +static const int vs_total_ac_bits = 2680; +typedef struct EncBlockInfo { + short mb[64]; + unsigned char next[64]; +} EncBlockInfo; +inline void dv_guess_qnos(EncBlockInfo* blks, int* qnos) { + int size[5]; + int j, k, a, prev; + EncBlockInfo* b; + for(a=2; a==2 || vs_total_ac_bits < size[0]; a+=a){ + for (j=0; j<6*5; j++, b++) { + for (k= b->next[prev]; k<64; k= b->next[k]) { + if(b->mb[k] < a && b->mb[k] > -a){ + b->next[prev] = b->next[k]; + } + else{ + prev = k; + } + } + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38926.c b/gcc/testsuite/gcc.c-torture/compile/pr38926.c new file mode 100644 index 000000000..9c71a798c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38926.c @@ -0,0 +1,41 @@ +static inline int foo (unsigned _si1) +{ + if (_si1 != 0) + if (_si1 > 2147483647) + return 1; + return 0; +} + +static inline unsigned bar (unsigned _left, int _right) +{ + return (unsigned) _right >= 8 ? 1 : _left >> _right; +} + +unsigned g_2; +unsigned g_67; +volatile unsigned g_162; + +static inline int func_62 (unsigned p_63) +{ + p_63 = g_2 & g_67; + if (g_2) + ; + else if (p_63) + return 1; + g_67 = bar (p_63, g_2); + return 0; +} + +unsigned baz (void) +{ + if (g_2) + for (; g_2 <= -16; g_2 = foo (g_2)) + { + for (; g_162; g_162) + func_62 (func_62 (0)); + if (g_67) + break; + } + return g_2; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39041.c b/gcc/testsuite/gcc.c-torture/compile/pr39041.c new file mode 100644 index 000000000..cc58a8a37 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39041.c @@ -0,0 +1,28 @@ +int test_bit(int nr, void *addr) +{ + int *a = (int *)addr; + int mask; + a += nr; + mask = 1 << nr; + return mask & *a; +} +struct { + struct { + int disabled; + } *data[1]; +} trace; +struct { + unsigned bits[1]; +} cpumask; +void inc(int *); +void dec(int *); +int foo(void) +{ + int cpu; + for (cpu = 0; cpu < 1; cpu++) { + if (test_bit(cpu, cpumask.bits)) + inc(&trace.data[cpu]->disabled); + if (!test_bit(cpu, cpumask.bits)) + dec(&trace.data[cpu]->disabled); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39202.c b/gcc/testsuite/gcc.c-torture/compile/pr39202.c new file mode 100644 index 000000000..f79b83194 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39202.c @@ -0,0 +1,33 @@ +typedef struct +{ + union + { + int * aaa; + } u; +} t_a; + +typedef struct +{ + unsigned bbb : 1; +} t_b; + +typedef struct +{ + int ccc; + t_a ddd; + t_b eee; + int fff; +} t_c; + +typedef struct t_d +{ + t_c f1; + t_c f2; +} t_d; + +void foo (void) +{ + t_d ggg; + ggg.f1 = ggg.f2; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39360.c b/gcc/testsuite/gcc.c-torture/compile/pr39360.c new file mode 100644 index 000000000..0bd631144 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39360.c @@ -0,0 +1,16 @@ +/* PR middle-end/39360 */ + +static int a[] = { 1 }; + +static inline void +bar (int **x) +{ + static int *c[2] = { 0, a }; + *x = c[1]; +} + +int +foo (int **x) +{ + bar (x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39394.c b/gcc/testsuite/gcc.c-torture/compile/pr39394.c new file mode 100644 index 000000000..325a08ff4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39394.c @@ -0,0 +1,28 @@ +/* PR tree-optimization/39394 */ + +char *p; +int x; + +static inline void +f1 (int n) +{ + asm volatile ("" : "=m" (*(struct { char x[n]; } *) p)); +} + +static inline void +f2 (void) +{ + x ? f1 (1) : f1 (2); +} + +static inline void +f3 (void) +{ + f2 (); +} + +void +f4 (void) +{ + f3 (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39614-1.c b/gcc/testsuite/gcc.c-torture/compile/pr39614-1.c new file mode 100644 index 000000000..a9559c73a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39614-1.c @@ -0,0 +1,7 @@ +typedef struct page { + unsigned long flags; +} mem_map_t; +static inline void set_page_zone(struct page *page, unsigned long zone_num) +{ + page->flags &= ~(~0UL << (64 - 8)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39614-2.c b/gcc/testsuite/gcc.c-torture/compile/pr39614-2.c new file mode 100644 index 000000000..e3cefb7a9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39614-2.c @@ -0,0 +1,6 @@ +int i; +void +f (void) +{ + i = (1 / 0) / 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39614-3.c b/gcc/testsuite/gcc.c-torture/compile/pr39614-3.c new file mode 100644 index 000000000..f9fa3b9d4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39614-3.c @@ -0,0 +1,6 @@ +int i; +void +f (void) +{ + i = (1 ? 1 / 0 : 1 / 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39614-4.c b/gcc/testsuite/gcc.c-torture/compile/pr39614-4.c new file mode 100644 index 000000000..2426ee28f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39614-4.c @@ -0,0 +1,6 @@ +int i; +void +f (void) +{ + i = (1 / 0 ? 1 : 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39614-5.c b/gcc/testsuite/gcc.c-torture/compile/pr39614-5.c new file mode 100644 index 000000000..0cae4de94 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39614-5.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-w -std=c99" } */ +int i; +void +f (void) +{ + i = (1 / 0, 1 / 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39636.c b/gcc/testsuite/gcc.c-torture/compile/pr39636.c new file mode 100644 index 000000000..ceddbb3ef --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39636.c @@ -0,0 +1,11 @@ +typedef float real; +typedef real rvec[3]; +void calc_dx2dx(real *, real *); +void phi_sr(int nj,rvec x[],int k) +{ + int i,j; + for(i=0; (i>= 0xdebecced; + return v1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39824.c b/gcc/testsuite/gcc.c-torture/compile/pr39824.c new file mode 100644 index 000000000..362fb17b8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39824.c @@ -0,0 +1,26 @@ +static const double internalEndianMagic = 7.949928895127363e-275; +static const unsigned char ieee_754_mantissa_mask[] = { 0x00, 0x0F, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF }; +static inline int +trio_isnan (double number) +{ + int has_mantissa = 0; + unsigned int i; + unsigned char current; + for (i = 0; i < (unsigned int)sizeof(double); i++) + { + current = ((unsigned char *)&number)[(((unsigned char + *)&internalEndianMagic)[7-(i)])]; + has_mantissa |= (current & ieee_754_mantissa_mask[i]); + } + return has_mantissa; +} +void +xmlXPathEqualNodeSetFloat(int nodeNr, double v) +{ + int i; + for (i=0; ifunction_decl.function_code)) + { + case BUILT_IN_ISFINITE: + case BUILT_IN_FPCLASSIFY: + type_generic_remove_excess_precision = 1; + } + for (parmnum = 0;; ++parmnum) + if (((enum tree_code) (val)->base.code) == EXCESS_PRECISION_EXPR + && !type_generic_remove_excess_precision) + val = ((val)->exp.operands[0]); + return val; +} +tree +build_function_call_vec (tree function) +{ + return convert_arguments (function); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39886.c b/gcc/testsuite/gcc.c-torture/compile/pr39886.c new file mode 100644 index 000000000..e85dbb341 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39886.c @@ -0,0 +1,12 @@ +/* PR middle-end/39886 */ + +int foo (int); + +volatile unsigned char g; + +void bar (int p) +{ + char l = 0xE1; + func ((foo ((p & g) <= l), 1)); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39928-1.c b/gcc/testsuite/gcc.c-torture/compile/pr39928-1.c new file mode 100644 index 000000000..1abb5ccb5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39928-1.c @@ -0,0 +1,9 @@ +/* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */ +typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__)); +extern __m128 _mm_sub_ps (__m128 __A, __m128 __B); +extern __m128 _mm_mul_ps (__m128 __A, __m128 __B); +__m128 +vq_nbest(const __m128 *codebook, __m128 d, __m128 in) +{ + return _mm_sub_ps(d, _mm_mul_ps(in, *codebook++)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39928-2.c b/gcc/testsuite/gcc.c-torture/compile/pr39928-2.c new file mode 100644 index 000000000..6f0d30cc0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39928-2.c @@ -0,0 +1,8 @@ +typedef _Complex float __m128; +extern __m128 _mm_sub_ps (__m128 __A, __m128 __B); +extern __m128 _mm_mul_ps (__m128 __A, __m128 __B); +__m128 +vq_nbest(const __m128 *codebook, __m128 d, __m128 in) +{ + return _mm_sub_ps(d, _mm_mul_ps(in, *codebook++)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39937.c b/gcc/testsuite/gcc.c-torture/compile/pr39937.c new file mode 100644 index 000000000..d02310532 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39937.c @@ -0,0 +1,12 @@ +int foo (__const char *__restrict __s); +static void +read_anisou(char line[]) +{ + foo (line+1); +} +void +read_pdbfile(void) +{ + char line[4096]; + read_anisou (line); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39941.c b/gcc/testsuite/gcc.c-torture/compile/pr39941.c new file mode 100644 index 000000000..b6209086b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39941.c @@ -0,0 +1,12 @@ +typedef void (*entry_func) (void) __attribute__ ((noreturn)); +extern entry_func entry_addr; +static void bsd_boot_entry (void) +{ + stop (); +} +void bsd_boot (void) +{ + entry_addr = (entry_func) bsd_boot_entry; + (*entry_addr) (); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39943.c b/gcc/testsuite/gcc.c-torture/compile/pr39943.c new file mode 100644 index 000000000..537ba4370 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39943.c @@ -0,0 +1,7 @@ +void gl_fog_index_pixels(float f, unsigned int n, unsigned int index[]) +{ + unsigned int i; + for (i=0; ip = (int*)c[0]; + y->p = (int*)a; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39999.c b/gcc/testsuite/gcc.c-torture/compile/pr39999.c new file mode 100644 index 000000000..c46a651a1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39999.c @@ -0,0 +1,18 @@ +void foo(void *); +void +MMAPGCD (int *A1, int *A2) +{ + int *t; + + do + { + t = A1; + A1 = A2; + A2 = t; + } + while (A2[-1]); + + foo (A1-1); + foo (A2-1); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40023.c b/gcc/testsuite/gcc.c-torture/compile/pr40023.c new file mode 100644 index 000000000..93d8f68a5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40023.c @@ -0,0 +1,11 @@ +typedef __builtin_va_list va_list; +typedef struct { + va_list ap; +} ScanfState; +void +GetInt(ScanfState *state, long llval) +{ + *__builtin_va_arg(state->ap,long *) = llval; + __builtin_va_end(state->ap); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40026.c b/gcc/testsuite/gcc.c-torture/compile/pr40026.c new file mode 100644 index 000000000..0d08f0dc8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40026.c @@ -0,0 +1,15 @@ +typedef struct { + unsigned long bits; +} S; +struct T { + S span; + int flags; +}; + +struct T f(int x) +{ + return (struct T) { + .span = (S) { 0UL }, + .flags = (x ? 256 : 0), + }; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40035.c b/gcc/testsuite/gcc.c-torture/compile/pr40035.c new file mode 100644 index 000000000..1bf1a7c4c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40035.c @@ -0,0 +1,20 @@ +typedef __SIZE_TYPE__ size_t; +void *memmove (void *dest, const void *src, size_t count); +size_t strlen (const char *s); + +int +foo (char *param, char *val) +{ + if (val) + { + if (val == param + strlen (param) + 1) + val[-1] = '='; + else if (val == param + strlen (param) + 2) + { + val[-2] = '='; + memmove (val - 1, val, strlen (val) + 1); + val--; + } + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40080.c b/gcc/testsuite/gcc.c-torture/compile/pr40080.c new file mode 100644 index 000000000..e36f14273 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40080.c @@ -0,0 +1,44 @@ +extern void *ff(void*,int); + +struct lpgl { struct lpgl *next; }; +struct lpgd { struct lpgl *first; }; + +typedef int (*xfn)( ); +static void xDP_IF_EnumGroupsInGroup ( void *a, int b, xfn fn) +{ + struct lpgd *lpGData; + struct lpgl *lpGList; + + if( ( lpGData = ff( a, b ) ) == ((void *)0) ) + return; + + if( lpGData->first == ((void *)0) ) + return; + lpGList = lpGData->first; + + for( ;; ) { + if( !(*fn)( ) ) + return; + if( lpGList->next == ((void *)0) ) + break; + lpGList = lpGList->next; + } + return; +} + + +static int +xcbDeletePlayerFromAllGroups() { + xDP_IF_EnumGroupsInGroup(0, 0, 0); + return 1; +} + +void xDP_IF_EnumGroups( xfn fn) { + xDP_IF_EnumGroupsInGroup( 0, 0, fn); +} + +static void xDP_IF_DestroyPlayer () { + xDP_IF_EnumGroups( xcbDeletePlayerFromAllGroups); +} + +void* foo=xDP_IF_DestroyPlayer; diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40204.c b/gcc/testsuite/gcc.c-torture/compile/pr40204.c new file mode 100644 index 000000000..149302a83 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40204.c @@ -0,0 +1,15 @@ +/* { dg-require-effective-target int32plus } */ +/* PR middle-end/40204 */ + +struct S +{ + unsigned int a : 4; + unsigned int b : 28; +} s; +char c; + +void +f (void) +{ + s.a = (c >> 4) & ~(1 << 4); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40233.c b/gcc/testsuite/gcc.c-torture/compile/pr40233.c new file mode 100644 index 000000000..b3487edde --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40233.c @@ -0,0 +1,10 @@ +typedef int aligned __attribute__((aligned(64))); +struct Frame { + aligned i; +}; + +void foo(struct Frame *p) +{ + aligned *q = &p->i; + *q = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40252.c b/gcc/testsuite/gcc.c-torture/compile/pr40252.c new file mode 100644 index 000000000..f58e799b0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40252.c @@ -0,0 +1,6 @@ +typedef unsigned int uint32_t; +static void IP(uint32_t v[2]) +{ + v[0] = ((v[0] << 1) | ((v[0] >> 31) & 1L)) & 0xffffffffL; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40291.c b/gcc/testsuite/gcc.c-torture/compile/pr40291.c new file mode 100644 index 000000000..d50bbee66 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40291.c @@ -0,0 +1,7 @@ +/* PR middle-end/40291 */ + +int +foo (void *x, char *y, unsigned long long z) +{ + return memcmp (x, y, z); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40321.c b/gcc/testsuite/gcc.c-torture/compile/pr40321.c new file mode 100644 index 000000000..a2f83ed8d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40321.c @@ -0,0 +1,12 @@ +struct X { int flag; int pos; }; +int foo(struct X *a, struct X *b) +{ + while (1) + { + if (a->flag) + break; + ({ struct X *tmp = a; a = b; b = tmp; }); + } + + return a->pos + b->pos; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40351.c b/gcc/testsuite/gcc.c-torture/compile/pr40351.c new file mode 100644 index 000000000..9b7e0ccfa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40351.c @@ -0,0 +1,22 @@ +/* PR tree-optimizations/40351 */ + +struct IO_APIC_route_entry { + unsigned int vector : 8; + unsigned int delivery_mode : 1; + unsigned int mask : 1; + unsigned int __reserved_2 : 15; + unsigned int __reserved_3 : 8; +} __attribute__ ((packed)); +union entry_union { + struct { + unsigned int w1, w2; + }; + struct IO_APIC_route_entry entry; +}; +unsigned int io_apic_read(void); +struct IO_APIC_route_entry ioapic_read_entry(void) +{ + union entry_union eu; + eu.w1 = io_apic_read(); + return eu.entry; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40432.c b/gcc/testsuite/gcc.c-torture/compile/pr40432.c new file mode 100644 index 000000000..767f59498 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40432.c @@ -0,0 +1,17 @@ +/* Test that SRA produces valid gimple when handling both type punning by means + of VCE and creating an access to a union. */ + +union U { + struct something *sth; + void *nothing; +}; + +void +foo (union U *target, void *p) +{ + union U u; + + u.nothing = p; + *target = u; + return; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40556.c b/gcc/testsuite/gcc.c-torture/compile/pr40556.c new file mode 100644 index 000000000..625175d77 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40556.c @@ -0,0 +1,11 @@ +struct A {}; + +struct A foo() +{ + return foo(); +} + +void bar() +{ + foo(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40570.c b/gcc/testsuite/gcc.c-torture/compile/pr40570.c new file mode 100644 index 000000000..7c3f4d83b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40570.c @@ -0,0 +1,22 @@ +extern void anything(int); + +static int foo(int i); + +static int bar(int i) { foo(i); } + +extern int j; + +static int foo(int i) +{ + if (j) + anything(j); + return bar(i); +} + +int baz() +{ + foo(0); + if (baz()) + return 1; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40582.c b/gcc/testsuite/gcc.c-torture/compile/pr40582.c new file mode 100644 index 000000000..51234da40 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40582.c @@ -0,0 +1,18 @@ +struct A +{ + void* q; + short i; +}; + +union U +{ + char* p; + struct A a; +}; + +struct A foo(union U u) +{ + struct A a = { 0, 0 }; + a = u.a; + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40640.c b/gcc/testsuite/gcc.c-torture/compile/pr40640.c new file mode 100644 index 000000000..7dae7ca81 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40640.c @@ -0,0 +1,15 @@ +void decode_opic_address(int *); +void sim_io_printf_filtered2 (int, unsigned); +void +hw_opic_io_read_buffer(int index) +{ + unsigned reg = 0; + decode_opic_address(&index); + switch (index) + { + case 0: + reg = 1; + } + sim_io_printf_filtered2 (index, reg); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40676.c b/gcc/testsuite/gcc.c-torture/compile/pr40676.c new file mode 100644 index 000000000..b04262882 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40676.c @@ -0,0 +1,33 @@ +extern int f1(); +extern int f2(void*); +extern void* f3(int); +int xmsih; +typedef unsigned short XWCHAR; + +inline unsigned int xstrlenW( const XWCHAR *str ) +{ + const XWCHAR *s = str; + while (*s) s++; + return s - str; +} + + +static int msi_dialog_register_class( void ) +{ + int cls; + + if( !f2( &cls ) ) + return 0; + if( !f2( &cls ) ) + return 0; + xmsih = f1(); + if( !xmsih ) + return 0; + return 1; +} + +void *xmsi_dialog_create(const XWCHAR* szDialogName) +{ + msi_dialog_register_class(); + return f3(xstrlenW(szDialogName)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40692.c b/gcc/testsuite/gcc.c-torture/compile/pr40692.c new file mode 100644 index 000000000..567516e69 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40692.c @@ -0,0 +1,15 @@ +/* PR middle-end/40692 */ + +#define M1(x) (((x) & 0x00000002) ? 0x2 : ((x) & 0x1)) +#define M2(x) (((x) & 0x0000000c) ? M1 ((x) >> 2) << 2 : M1 (x)) +#define M3(x) (((x) & 0x000000f0) ? M2 ((x) >> 4) << 4 : M2 (x)) +#define M4(x) (((x) & 0x0000ff00) ? M3 ((x) >> 8) << 8 : M3 (x)) +#define M5(x) (((x) & 0xffff0000) ? M4 ((x) >> 16) << 16 : M4 (x)) + +struct A { char e; char f; }; + +long +foo (void) +{ + return M5 (4096UL - (long) &((struct A *) 0)->f); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40753.c b/gcc/testsuite/gcc.c-torture/compile/pr40753.c new file mode 100644 index 000000000..507303dac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40753.c @@ -0,0 +1,20 @@ +typedef struct { + unsigned nargs; +} ffi_cif; +typedef struct { + char tramp[24]; + ffi_cif *cif; +} ffi_closure; +extern void *memcpy (void *, const void *, __SIZE_TYPE__); +extern void ffi_closure_LINUX64 (void); + +int +ffi_prep_closure_loc (ffi_closure *closure, ffi_cif *cif) +{ + void **tramp = (void **) &closure->tramp[0]; + + memcpy (tramp, (char *) ffi_closure_LINUX64, 16); + closure->cif = cif; + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40964.c b/gcc/testsuite/gcc.c-torture/compile/pr40964.c new file mode 100644 index 000000000..51639940e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40964.c @@ -0,0 +1,10 @@ +struct alloc2 { + int bla; + char * __restrict data; + char * __restrict data2; +}; +struct alloc2 b; +void * f (void) +{ + return b.data; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41006-1.c b/gcc/testsuite/gcc.c-torture/compile/pr41006-1.c new file mode 100644 index 000000000..8aef66dbd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41006-1.c @@ -0,0 +1,17 @@ +typedef int (*FARPROC)(); + +typedef int (*LPFN_ACCEPTEX)(void*); +static LPFN_ACCEPTEX acceptex_fn; + +int xWSAIoctl(void*); +static void get_fn(FARPROC* fn) +{ + FARPROC func; + if (!xWSAIoctl( &func)) + *fn = func; +} + +void get_fn_pointers() +{ + get_fn((FARPROC*)&acceptex_fn); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41006-2.c b/gcc/testsuite/gcc.c-torture/compile/pr41006-2.c new file mode 100644 index 000000000..766778d41 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41006-2.c @@ -0,0 +1,15 @@ +typedef int *FARPROC; +static int * __restrict__ acceptex_fn; + +int xWSAIoctl(void*); +static void get_fn(FARPROC* fn) +{ + FARPROC func; + if (!xWSAIoctl( &func)) + *fn = func; +} + +void get_fn_pointers() +{ + get_fn((FARPROC*)&acceptex_fn); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41016.c b/gcc/testsuite/gcc.c-torture/compile/pr41016.c new file mode 100644 index 000000000..57bddb49d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41016.c @@ -0,0 +1,17 @@ +typedef struct _IO_FILE FILE; +void +CompareRNAStructures (FILE * ofp, int start, int L, char *ss_true, char *ss) +{ + int i; + float agree = 0.; + float pairs = 0.; + float pairs_true = 0.; + for (i = 0; i < L; i++) + { + pairs_true += 1.; + agree += 1.; + } + if (((int) pairs % 2 != 0) || ((int) pairs_true % 2 != 0) + || ((int) agree % 2 != 0)) + Die ("Error in CompareRNAStrutures(); odd number of paired nucleotides\n"); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41101.c b/gcc/testsuite/gcc.c-torture/compile/pr41101.c new file mode 100644 index 000000000..8d21a00ce --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41101.c @@ -0,0 +1,19 @@ +int func(int); + +void +bug(int* x, int* y, unsigned long int N) +{ + unsigned long int i; + int* t; + + while (1) + { + for (i=1; i<=N; i++) + { + y[i] = func(x[i] - x[1]); + if (y[i]) + return; + } + t=x; x=y; y=t; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41163.c b/gcc/testsuite/gcc.c-torture/compile/pr41163.c new file mode 100644 index 000000000..c22483783 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41163.c @@ -0,0 +1,10 @@ +struct option { + void *value; +}; +void parse_options (struct option *); +void cmd_grep(void) +{ + struct option options[] = { { &options } }; + parse_options(options); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41181.c b/gcc/testsuite/gcc.c-torture/compile/pr41181.c new file mode 100644 index 000000000..5fafb020e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41181.c @@ -0,0 +1,11 @@ +/* { dg-skip-if "The array is too big" { "avr-*-*" "pdp11-*-*" } { "*" } { "" } } */ +char paths[1024]; +static void x264_slicetype_path(char (*best_paths)[250], int n, int length) +{ + __builtin_memcpy (best_paths[n], paths, length); +} +void x264_slicetype_analyse(int n, int length) +{ + char best_paths[250][250]; + x264_slicetype_path (best_paths, n, length); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41182-1.c b/gcc/testsuite/gcc.c-torture/compile/pr41182-1.c new file mode 100644 index 000000000..017174938 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41182-1.c @@ -0,0 +1,6 @@ +typedef long unsigned int size_t; +int _lae_process_opts(char *pr, char *pe) +{ + return (strlen ("on") < ((size_t) ((pe-&pr[2])>(strlen("on")) + ? (pe-&pr[2]) : (strlen("on"))))); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41282.c b/gcc/testsuite/gcc.c-torture/compile/pr41282.c new file mode 100644 index 000000000..3a0f02d63 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41282.c @@ -0,0 +1,20 @@ +struct S +{ + unsigned int iu; +}; + +union U +{ + struct S s; + signed int is; +}; + +extern signed int bar (); + +struct S foo (void) +{ + union U u; + + u.is = bar (); + return u.s; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41469.c b/gcc/testsuite/gcc.c-torture/compile/pr41469.c new file mode 100644 index 000000000..b89ee6391 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41469.c @@ -0,0 +1,14 @@ +/* { dg-options "-fexceptions" } */ + +void +af (void *a) +{ +} +void +bf (void) +{ + int i = 1; + char v[i]; + af (v); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41634.c b/gcc/testsuite/gcc.c-torture/compile/pr41634.c new file mode 100644 index 000000000..976e463e2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41634.c @@ -0,0 +1,19 @@ +extern int _xgetw(); +extern int foo(char*); + +void test_readmode( int ascii_mode ) +{ + static const char outbuffer[] + = "0,1,2,3,4,5,6,7,8,9\r\n\r\nA,B,C,D,E\r\nX,Y,Z"; + char buffer[2*512 +256]; + int i, j, ao; + unsigned int fp; + + foo(buffer); + + for (i=0, j=0; i<6; i++) { + if (ao==0 || outbuffer[fp-3+i] != '\r') + buffer[j++] = outbuffer[fp-3+i]; + } + _xgetw(); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41646.c b/gcc/testsuite/gcc.c-torture/compile/pr41646.c new file mode 100644 index 000000000..f07b6ba19 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41646.c @@ -0,0 +1,28 @@ +/* PR rtl-optimization/41646 */ + +struct A { unsigned long a; }; +struct B { unsigned short b, c, d; }; +struct B bar (unsigned long); + +char * +foo (char *a, struct A *x) +{ + struct B b = bar (x->a); + unsigned char c; + unsigned short d; + a[3] = ((unsigned char) (b.b % 10) + 48); + d = b.b / 10; + a[2] = ((unsigned char) (d % 10) + 48); + d = d / 10; + a[1] = ((unsigned char) (d % 10) + 48); + a[0] = ((unsigned char) ((d / 10) % 10) + 48); + a[4] = 46; + c = (unsigned char) b.c; + a[6] = (c % 10 + 48); + a[5] = ((c / 10) % 10 + 48); + a[7] = 46; + c = b.d; + a[9] = (c % 10 + 48); + a[8] = ((c / 10) % 10 + 48); + return a + 10; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41661.c b/gcc/testsuite/gcc.c-torture/compile/pr41661.c new file mode 100644 index 000000000..658e4288b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41661.c @@ -0,0 +1,20 @@ +/* PR tree-optimization/41661 */ +/* { dg-do compile } */ +/* { dg-options "-fno-early-inlining" } */ + +int g; + +void foo (int x) +{ + g = x; +} + +void bar (double d) +{ + foo (d == 1); +} + +void baz (int a) +{ + bar (1); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41679.c b/gcc/testsuite/gcc.c-torture/compile/pr41679.c new file mode 100644 index 000000000..aa10cb612 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41679.c @@ -0,0 +1,15 @@ +/* { dg-options "-g" } */ + +extern int a; +extern char b; +extern int foo (void); + +void +test (void) +{ + int c; + b = foo () ? '~' : '\0'; + while ((c = foo ())) + if (c == '7') + a = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41728.c b/gcc/testsuite/gcc.c-torture/compile/pr41728.c new file mode 100644 index 000000000..df379d930 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41728.c @@ -0,0 +1,12 @@ +int a[8]; +int s244(void) +{ + int lrc, j; + lrc = 0; + for (j=0; j<7; j++) + if(a[j] != a[j+1]) + lrc = 1; + if (lrc != 0) + return 0; + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41987.c b/gcc/testsuite/gcc.c-torture/compile/pr41987.c new file mode 100644 index 000000000..7bb49192c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41987.c @@ -0,0 +1,22 @@ +/* PR tree-optimization/41987 */ + +#define TESTIT(TYPE) do { \ + _Complex TYPE ylm; \ + TYPE nbond; \ + ylm = 0; \ + nbond = 0; \ + ylm = ylm / nbond; \ +} while (0) + +void qparm_colvar(void) +{ + TESTIT (float); + TESTIT (double); + TESTIT (long double); + + TESTIT (char); + TESTIT (short); + TESTIT (int); + TESTIT (long); + TESTIT (long long); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42025-1.c b/gcc/testsuite/gcc.c-torture/compile/pr42025-1.c new file mode 100644 index 000000000..f19123eaf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42025-1.c @@ -0,0 +1,24 @@ +typedef void* Ptr; + +struct A +{ + int i; + union + { + Ptr p; + char *q; + } u; +}; + +static void foo(struct A *p, char *q) +{ + if (p->i) + p->u.p = 0; + else + p->u.q = q; +} + +void bar(struct A *p, char *q) +{ + foo(p, q); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42025-2.c b/gcc/testsuite/gcc.c-torture/compile/pr42025-2.c new file mode 100644 index 000000000..14cb36d1c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42025-2.c @@ -0,0 +1,32 @@ +typedef struct +{ + void *p; +} Ptr; + +struct A +{ + int i; + union + { + Ptr p; + char *q; + } u; +}; + +extern Ptr get_stuff (void); +extern void use_stuff (char *); + +static void foo(struct A p, char *q) +{ + if (p.i) + p.u.p = get_stuff (); + else + p.u.q = q; + + use_stuff (p.u.q); +} + +void bar(struct A *p, char *q) +{ + foo(*p, q); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42049.c b/gcc/testsuite/gcc.c-torture/compile/pr42049.c new file mode 100644 index 000000000..b2ebe52ef --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42049.c @@ -0,0 +1,27 @@ +/* PR middle-end/42049 */ + +extern char *strcpy (char *s1, const char *s2); +struct S { char s[4]; }; + +int +foo (int x, char **y) +{ + char const *a; + char const *b; + struct S s[9]; + long i; + if (x > 1) + a = y[1]; + else + a = "abc"; + if (x > 2) + b = y[2]; + else + b = "def"; + strcpy (s[0].s, a); + strcpy (s[1].s, b); + for (i = 2; i < x - 2 && i < 8; i++) + strcpy (s[i].s, y[i + 1]); + s[i].s[0] = '\0'; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42164.c b/gcc/testsuite/gcc.c-torture/compile/pr42164.c new file mode 100644 index 000000000..7b94aefe7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42164.c @@ -0,0 +1,25 @@ +typedef struct +{ + unsigned long long pte; +} pte_t; +pte_t mk_swap_pte (unsigned long offset) +{ + pte_t pte; + pte.pte = (offset << 40); + return pte; +} +int pte_file (pte_t pte) +{ + return pte.pte & (1 << 4); +} +typedef struct +{ + unsigned long val; +} swp_entry_t; +pte_t swp_entry_to_pte (swp_entry_t entry) +{ + swp_entry_t arch_entry; + arch_entry = (swp_entry_t){mk_swap_pte (swp_offset (entry)).pte}; + __BUG_ON ((unsigned long) pte_file ((pte_t) {arch_entry.val})); + return (pte_t) {arch_entry.val}; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42196-1.c b/gcc/testsuite/gcc.c-torture/compile/pr42196-1.c new file mode 100644 index 000000000..96936c5e5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42196-1.c @@ -0,0 +1,28 @@ +union U +{ + double d; + __complex__ int c; +}; + +double gd; +extern double bar (union U); + +double foo (int b, double d, int c1, int c2) +{ + union U u; + double r; + + if (b) + { + u.d = d; + r = u.d; + } + else + { + __real__ u.c = c1; + __imag__ u.c = c2; + r = bar (u); + } + + return r; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42196-2.c b/gcc/testsuite/gcc.c-torture/compile/pr42196-2.c new file mode 100644 index 000000000..40ae077f6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42196-2.c @@ -0,0 +1,28 @@ +union U +{ + __complex__ int ci; + __complex__ float cf; +}; + +float gd; +extern float bar (union U); + +float foo (int b, double f1, double f2, int c1, int c2) +{ + union U u; + double r; + + if (b) + { + __real__ u.cf = f1; + __imag__ u.cf = f2; + } + else + { + __real__ u.ci = c1; + __imag__ u.ci = c2; + } + + r = bar (u); + return r; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42196-3.c b/gcc/testsuite/gcc.c-torture/compile/pr42196-3.c new file mode 100644 index 000000000..ccc0d7a19 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42196-3.c @@ -0,0 +1,27 @@ +union U +{ + __complex__ int ci; + __complex__ float cf; +}; + +float gd; +extern float bar (float, float); + +float foo (int b, union U u) +{ + float f1, f2, r; + + if (b) + { + f1 = __real__ u.cf; + f1 = __imag__ u.cf; + } + else + { + f1 = __real__ u.ci; + f1 = __imag__ u.ci; + } + + r = bar (f1, f2); + return r; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42234.c b/gcc/testsuite/gcc.c-torture/compile/pr42234.c new file mode 100644 index 000000000..81bec9db8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42234.c @@ -0,0 +1,14 @@ +/* { dg-options "-g" } */ + +void +foo (int x) +{ + struct S { int s; } d = { 1 }; + unsigned int e = 1; + if (x) + e = x && d.s; + else + for (e = 0; e <= 3; e--) + ; + e++; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42237.c b/gcc/testsuite/gcc.c-torture/compile/pr42237.c new file mode 100644 index 000000000..58db8660c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42237.c @@ -0,0 +1,32 @@ +struct A +{ + int p; +}; + +struct B +{ + struct A n; + struct A m; + int x; + int y; + int z; +}; + +extern int g1, g2; + +static void __attribute__((noinline)) foo (struct B *b) +{ + int t; + + t = b->n.p; + g1 = t; + b->n.p = t+1; + g2 = b->m.p; + + b->m = b->n; +} + +void bar (struct B *b) +{ + foo (b); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42299.c b/gcc/testsuite/gcc.c-torture/compile/pr42299.c new file mode 100644 index 000000000..5a9199f27 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42299.c @@ -0,0 +1,23 @@ +/* { dg-options "-g" } */ + +static int +foo (int x, int y) +{ + if (y) + goto lab; + if (x) + y = 0; + if (y) + goto lab; + y = 0; +lab: + return y; +} + +void +baz (int x, int y) +{ + y = foo (x, y); + if (y != 0) + bar (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42347.c b/gcc/testsuite/gcc.c-torture/compile/pr42347.c new file mode 100644 index 000000000..e98b86984 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42347.c @@ -0,0 +1,16 @@ +/* PR bootstrap/42347 */ + +long +foo (long x, long y) +{ + x = x & y; + switch (y) + { + case 63L: x >>= 0; break; + case 4032L: x >>= 6; break; + case 258048L: x >>= 12; break; + case 16515072L: x >>= 18; break; + default: __builtin_unreachable (); + } + return x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42398.c b/gcc/testsuite/gcc.c-torture/compile/pr42398.c new file mode 100644 index 000000000..a33bebf79 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42398.c @@ -0,0 +1,6 @@ +int ptrace_setregs(void) +{ + union { unsigned int l; int t; } __gu_tmp; + __asm__ __volatile__("" : "=r" (__gu_tmp.l)); + return __gu_tmp.t; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42559.c b/gcc/testsuite/gcc.c-torture/compile/pr42559.c new file mode 100644 index 000000000..25f7fd6e8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42559.c @@ -0,0 +1,8 @@ +void jumpfunc(int copy, void *p) +{ + void *l = &&jumplabel; + if (copy) + __builtin___memcpy_chk (p, l, 128, __builtin_object_size (p, 0)); +jumplabel: + return; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42632.c b/gcc/testsuite/gcc.c-torture/compile/pr42632.c new file mode 100644 index 000000000..a6778537a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42632.c @@ -0,0 +1,16 @@ +static inline __attribute__((always_inline)) int +__pskb_trim(void) +{ + return ___pskb_trim(); +} +static inline __attribute__((always_inline)) +int pskb_trim(void) +{ + return __pskb_trim(); +} +int ___pskb_trim(void) +{ + pskb_trim(); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42703.c b/gcc/testsuite/gcc.c-torture/compile/pr42703.c new file mode 100644 index 000000000..4805b17b0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42703.c @@ -0,0 +1,12 @@ +__extension__ typedef unsigned long long int uint64_t; +typedef uint64_t ScmUInt64; +void swapb64(ScmUInt64 *loc) +{ + union { + ScmUInt64 l; + unsigned char c[4]; + } dd; + unsigned char t; + dd.l = *loc; + (t = dd.c[3], dd.c[3] = dd.c[4], dd.c[4] = t); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42705.c b/gcc/testsuite/gcc.c-torture/compile/pr42705.c new file mode 100644 index 000000000..3d7b22da8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42705.c @@ -0,0 +1,58 @@ +typedef int GLint; +typedef unsigned char GLubyte; +typedef unsigned int uint32_t; +struct radeon_bo { + void *ptr; + uint32_t flags; +}; +struct radeon_renderbuffer { + struct radeon_bo *bo; + unsigned int cpp; + int has_surface; +}; +static inline +GLint r600_1d_tile_helper(const struct radeon_renderbuffer * rrb, + GLint x, GLint y, GLint is_depth, GLint is_stencil) +{ + GLint element_bytes = rrb->cpp; + GLint num_samples = 1; + GLint tile_width = 8; + GLint tile_height = 8; + GLint tile_thickness = 1; + GLint tile_bytes; + GLint tiles_per_row; + GLint slice_offset; + GLint tile_row_index; + GLint tile_column_index; + GLint tile_offset; + GLint pixel_number = 0; + GLint element_offset; + GLint offset = 0; + tile_bytes = tile_width * tile_height * tile_thickness + * element_bytes * num_samples; + tile_column_index = x / tile_width; + tile_offset = ((tile_row_index * tiles_per_row) + + tile_column_index) * tile_bytes; + if (is_depth) { + } + else { + GLint sample_offset; + switch (element_bytes) { + case 1: pixel_number |= ((x >> 0) & 1) << 0; + } + element_offset = sample_offset + (pixel_number * element_bytes); + } + offset = slice_offset + tile_offset + element_offset; + return offset; +} +GLubyte *r600_ptr_color(const struct radeon_renderbuffer * rrb, + GLint x, GLint y) +{ + GLubyte *ptr = rrb->bo->ptr; + uint32_t mask = 1 | 2; + GLint offset; + if (rrb->has_surface || !(rrb->bo->flags & mask)) { + offset = r600_1d_tile_helper(rrb, x, y, 0, 0); + } + return &ptr[offset]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42708-1.c b/gcc/testsuite/gcc.c-torture/compile/pr42708-1.c new file mode 100644 index 000000000..9124a85b9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42708-1.c @@ -0,0 +1,10 @@ +typedef __SIZE_TYPE__ size_t; +void *malloc(size_t); +typedef union YYSTYPE { + char *id; +} YYSTYPE; +extern YYSTYPE yylval; +void yylex (int b) +{ + yylval = (YYSTYPE) (b ? 0 : (char *) malloc (4)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42716.c b/gcc/testsuite/gcc.c-torture/compile/pr42716.c new file mode 100644 index 000000000..e52df0f4a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42716.c @@ -0,0 +1,18 @@ +static short foo (long long si1, short si2) +{ + return si1 > 0 && si2 > 0 || si1 < 0 + && si2 < 0 && si1 < 1 - si2 ? : si1 + si2; +} + +int g_13; +unsigned g_17; + +int safe (int, int); + +void bar (short p_51, short * p_52) +{ + int *const l_55 = &g_13; + if (safe (*p_52, g_13 != foo (*p_52 & *l_55 == g_13 && g_17 >= 1, 0))) + { + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42717.c b/gcc/testsuite/gcc.c-torture/compile/pr42717.c new file mode 100644 index 000000000..4fe6f93e7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42717.c @@ -0,0 +1,30 @@ +static signed char +foo (signed char si1, unsigned char si2) +{ + return (si1 ^ si2) & (-si2 ^ si2) ? : si1 - si2; +} + +struct S0 +{ +}; + +unsigned char g_21; + +struct S0 g_34; + +void +bar (unsigned char p_20) +{ + unsigned char *l_22 = &g_21; + unsigned char l_23 = 0; + struct S0 *l = &g_34; + goto lbl_42; + for (; l_23; l_23 = foo (l_23, 1)) + { + for (p_20 = 0; 0; p_20 = foo (p_20, 1)) + lbl_42:; + (l == &g_34) ? 0 : ""; +lbl_85:*l_22 = p_20; + } + goto lbl_85; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42730.c b/gcc/testsuite/gcc.c-torture/compile/pr42730.c new file mode 100644 index 000000000..89aaafe87 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42730.c @@ -0,0 +1,14 @@ +union bzz +{ + unsigned *pa; + void *pv; +}; + +void foo (void) +{ + union bzz u; + void **x; + void *y = 0; + x = &u.pv; + *x = y; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42749.c b/gcc/testsuite/gcc.c-torture/compile/pr42749.c new file mode 100644 index 000000000..508c08720 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42749.c @@ -0,0 +1,5 @@ +struct pdf_object { int val; }; +int pdf_count_size_object (struct pdf_object * p_obj) +{ + return pdf_count_size_object(p_obj) + 2 * sizeof(struct pdf_object); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42927.c b/gcc/testsuite/gcc.c-torture/compile/pr42927.c new file mode 100644 index 000000000..ada919f70 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42927.c @@ -0,0 +1,32 @@ +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef enum { READ_SHARED = 0, WRITE_EXCLUSIVE = 1, + READ_EXCLUSIVE = 2, EXCLUSIVE_ACCESS = 3 } scsires_access_mode; +struct scsires_extent_elem { + scsires_access_mode mode; + unsigned relative_address; + u_int32_t first_block; + u_int32_t length; +}; +typedef struct scsires_extent_elem scsires_extent_elem_t; +struct scsires_extent { + u_int8_t num_elements; + scsires_extent_elem_t *elements; +}; +typedef struct scsires_extent scsires_extent_t; +unsigned char buf[512]; +void scsires_issue_reservation(scsires_extent_t * new_extent) +{ + int i; + for (i = 0; i < new_extent->num_elements; i++) + { + buf[(i * 8)] = new_extent->elements[i].mode; + buf[(i * 8) + 1] = ((new_extent->elements[i].length >> 16) & 0xff); + buf[(i * 8) + 2] = ((new_extent->elements[i].length >> 8) & 0xff); + buf[(i * 8) + 3] = (new_extent->elements[i].length & 0xff); + buf[(i * 8) + 4] = ((new_extent->elements[i].first_block >> 24) & 0xff); + buf[(i * 8) + 5] = ((new_extent->elements[i].first_block >> 16) & 0xff); + buf[(i * 8) + 6] = ((new_extent->elements[i].first_block >> 8) & 0xff); + buf[(i * 8) + 7] = (new_extent->elements[i].first_block & 0xff); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42956.c b/gcc/testsuite/gcc.c-torture/compile/pr42956.c new file mode 100644 index 000000000..f592d4be4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42956.c @@ -0,0 +1,33 @@ +typedef const int cint; +typedef struct { +} Bounds; +int ndim_, ncomp_, selectedcomp_, nregions_; +void *voidregion_; +typedef struct { + double diff, err, spread; +} Errors; +typedef const Errors cErrors; +void Split(int iregion, int depth, int xregion) +{ + typedef struct { + double avg, err, spread, chisq; + double xmin[ndim_], xmax[ndim_]; + } Result; + typedef struct region { + Result result[ncomp_]; + } Region; + Errors errors[ncomp_]; + int comp, ireg, xreg; + for( ireg = iregion, xreg = xregion; ireg < nregions_; ireg = xreg++ ) + { + Result *result = ((Region *)voidregion_)[ireg].result; + for( comp = 0; comp < ncomp_; ++comp ) + { + Result *r = &result[comp]; + cErrors *e = &errors[comp]; + double c = e->diff; + if( r->err > 0 ) r->err = r->err*e->err + c; + } + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42998.c b/gcc/testsuite/gcc.c-torture/compile/pr42998.c new file mode 100644 index 000000000..7506d1581 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42998.c @@ -0,0 +1,15 @@ +void foo(void *); +void bar(void *); +void ndisc_fill_addr_option(unsigned char *opt, int data_len, + unsigned short addr_type) +{ + int pad; + if (addr_type == 32) + pad = 2; + else + pad = 0; + __builtin_memset(opt + 2, 0, pad); + opt += pad; + __builtin_constant_p(data_len) ? foo (opt+2) : bar (opt+2); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43066.c b/gcc/testsuite/gcc.c-torture/compile/pr43066.c new file mode 100644 index 000000000..2ded9123e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43066.c @@ -0,0 +1,14 @@ +struct S { + struct { } empty[1]; + int i; +}; + +int foo(int i, ...) +{ + struct S s; + __builtin_va_list va; + __builtin_va_start(va, i); + s = __builtin_va_arg(va, struct S); + __builtin_va_end(va); + return s.i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43164.c b/gcc/testsuite/gcc.c-torture/compile/pr43164.c new file mode 100644 index 000000000..7e3e074bb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43164.c @@ -0,0 +1,16 @@ +struct S0 +{ + unsigned char f0; + int:0; +}; + +struct S1 +{ + struct S0 f0; +}; + +struct S1 func_34 (void) +{ + struct S1 l_221 = { { 1 } }; + return l_221; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43186.c b/gcc/testsuite/gcc.c-torture/compile/pr43186.c new file mode 100644 index 000000000..7171e6ac0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43186.c @@ -0,0 +1,15 @@ +int n; + +void foo (int i) +{ + int a, b; + + if (!i) + for (a = 1; a < 4; a++) + if (a) + for (b = 1; b < 3; b++) + foo (b); + + n++; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43188.c b/gcc/testsuite/gcc.c-torture/compile/pr43188.c new file mode 100644 index 000000000..bbc6f422f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43188.c @@ -0,0 +1,6 @@ +int *__attribute__((__aligned__(16))) *p; + +int main (void) +{ + return **p; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43191.c b/gcc/testsuite/gcc.c-torture/compile/pr43191.c new file mode 100644 index 000000000..f4ec0b477 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43191.c @@ -0,0 +1,47 @@ +/* { dg-skip-if "Ints are 16 bits" { "pdp11-*-*" } { "*" } { "" } } */ +struct S0 +{ +}; + +struct S1 +{ + unsigned f0:27; + const unsigned:0; +}; + +struct S2 +{ + unsigned f2:1; +}; + +unsigned char g_4[1][8][3][1][1][1]; +unsigned char *g_17; +unsigned char **g_16[1][10][7]; + +struct S2 g_35 = { + 0 +}; + +struct S2 *g_34 = &g_35; + +struct S1 func_86 (unsigned char p_87, struct S2 **p_89) +{ + struct S1 l_92[6][8][1][1] = { + 16143586 + } + ; + return l_92[0][0][0][0]; +} + +void func_28 (struct S1 p_30, const struct S1 p_32) +{ +} + +void func_70 (unsigned char p_72) +{ + unsigned char *const *l_93 = &g_17; + struct S2 **l_94; + unsigned char *const *l_97 = &g_17; + func_28 (func_86 (p_72, 0), + func_86 (p_72, &g_34)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43255.c b/gcc/testsuite/gcc.c-torture/compile/pr43255.c new file mode 100644 index 000000000..1b5384684 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43255.c @@ -0,0 +1,33 @@ +int safe (int); + +static unsigned foo (unsigned ui1, unsigned ui2) +{ + return ui1 + ui2; +} + +int g_22; +int *volatile g_23 = &g_22; +int **g_282[8][10][1]; +int *g_330 = &g_22; +volatile unsigned g_348; +int g_397; + +void int32func (const unsigned char p_10) +{ + if (foo + (~ + (p_10 | + (*g_282[(unsigned long) g_397 % 8][(unsigned) g_22 % 10][g_348 % 1]) == + (*g_282[(unsigned long) g_397 % 8][(unsigned) g_22 % 10][g_348 % 1])), + 1)) + { + } + else if (*g_330 >= + safe (*g_23 ^ + (**g_282[(unsigned long) g_397 % 8][(unsigned) g_22 % 10] + [g_348 % 1])) & **g_282[8][10][1], 1) + { + } +} + + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43288.c b/gcc/testsuite/gcc.c-torture/compile/pr43288.c new file mode 100644 index 000000000..73af0d9ec --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43288.c @@ -0,0 +1 @@ +static int a __attribute__ ((common)); diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43367.c b/gcc/testsuite/gcc.c-torture/compile/pr43367.c new file mode 100644 index 000000000..5c620c13c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43367.c @@ -0,0 +1,30 @@ +unsigned char g_17; + +const unsigned char func_39 (unsigned char p_40, unsigned char * p_41) +{ + return 0; +} + +void int327 (const unsigned char p_48, unsigned char p_49) +{ + unsigned l_52; + unsigned char l_58[2]; + int i, j; + if (func_39 (l_52, &p_49), p_48) { + unsigned char *l_60; + unsigned char *l = &l_58[1]; + for (j; j; j++) { +lbl_59: + break; + } + for (l = 0; 1; l += 1) { + for (p_49 = 1; p_49; p_49 += 0) { + unsigned char **l_61[1][6]; + for (j = 0; j < 1; j++) + l_61[i][j] = &l_60; + goto lbl_59; + } + } + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43415.c b/gcc/testsuite/gcc.c-torture/compile/pr43415.c new file mode 100644 index 000000000..c00e1c41c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43415.c @@ -0,0 +1,36 @@ +int main() +{ + unsigned long long table[256]; + unsigned int i; + for (i=0; i<256; ++i) { + unsigned long long j; + unsigned char x=i; + for (j=0; j<5; ++j) { + x += x<<1; + x ^= x>>1; + } + for (j=0; j<5; ++j) { + x += x<<1; + x ^= x>>1; + } + for (j=0; j<5; ++j) { + x += x<<1; + x ^= x>>1; + } + for (j=0; j<5; ++j) { + x += x<<1; + x ^= x>>1; + } + for (j=0; j<5; ++j) { + x += x<<1; + x ^= x>>1; + } + table[i] ^= (((unsigned long long)x)<<16); + } + for (i=0; i<256; ++i) { + if ((table[i]&0xff)==i) + return 1; + } + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43614.c b/gcc/testsuite/gcc.c-torture/compile/pr43614.c new file mode 100644 index 000000000..411b25dac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43614.c @@ -0,0 +1,27 @@ +volatile int g_2[7]; + +void foo (unsigned); + +int main (void) +{ + int i_459 = 0; + int t2818; + int t2819; + volatile char *t2820; + int t2821; + volatile char *t2822; + int *t2823; + unsigned t2824; +LL655: + t2822 = (volatile char *)g_2; + t2821 = i_459; + t2820 = t2822 + t2821; + t2823 = (int *)t2820; + t2824 = *t2823; + foo (t2824); + t2818 = i_459; + t2819 = t2818 + 1; + i_459 = t2819; + goto LL655; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43635.c b/gcc/testsuite/gcc.c-torture/compile/pr43635.c new file mode 100644 index 000000000..4039fa7a5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43635.c @@ -0,0 +1,7 @@ +extern void d (void); + +void (*foo (void)) (float) +{ + void (*(*x) (void)) (float) = d; + return (*x) (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43636.c b/gcc/testsuite/gcc.c-torture/compile/pr43636.c new file mode 100644 index 000000000..ebf50edf3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43636.c @@ -0,0 +1,10 @@ +/* PR target/43636 */ + +extern char a[], *b[]; + +char * +foo (char *x, int y) +{ + x = __builtin_stpcpy (x, b[a[y]]); + return x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43661.c b/gcc/testsuite/gcc.c-torture/compile/pr43661.c new file mode 100644 index 000000000..1337e1df3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43661.c @@ -0,0 +1,5 @@ +int +func (int x) +{ + return 0 ? (unsigned short) (0 ? : 1 * (signed char) (x ^ x) >= 0) : 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43679.c b/gcc/testsuite/gcc.c-torture/compile/pr43679.c new file mode 100644 index 000000000..c45ef9f96 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43679.c @@ -0,0 +1,33 @@ +unsigned g_5; +int g_7; +int g_23[2]; +int *g_29 = &g_23[0]; +int **g_59; +unsigned long g_186; + +int foo (int, int); +int bar (int); + +void func_37 (long p_38) +{ + int *l_39 = &g_7; + *l_39 = (*l_39 + || + (foo + (((*g_29 != *l_39, ((bar (g_59 != &l_39), 0), 0))), + 0))); + foo (*l_39, 0); + int **l_256 = &l_39; + { + for (0; g_186; 0) + { + *l_256 = *l_256; + if (g_5) + goto lbl_270; + *l_39 &= 0; + } + } +lbl_270: + ; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43791.c b/gcc/testsuite/gcc.c-torture/compile/pr43791.c new file mode 100644 index 000000000..38cb3c8e0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43791.c @@ -0,0 +1,21 @@ +int owner(); +int clear(); + +static void fixup() { + clear(); +} + +inline __attribute__ ((always_inline)) +void slowtrylock(void) { + if (owner()) + fixup(); +} + +void fasttrylock(void (*slowfn)()) { + slowfn(); +} + +void trylock(void) { + fasttrylock(slowtrylock); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43845.c b/gcc/testsuite/gcc.c-torture/compile/pr43845.c new file mode 100644 index 000000000..bdb45e7d2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr43845.c @@ -0,0 +1,12 @@ +typedef int __attribute__ ((const)) (*x264_pixel_cmp_t)(void); + +typedef struct { + x264_pixel_cmp_t ssd; +} x264_pixel_function_t; + +int x264_pixel_ssd_wxh (x264_pixel_function_t *pf, int i_width) { + int i_ssd = 0, x; + for (x = 0; x < i_width; x++) + i_ssd += pf->ssd(); + return i_ssd; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44030.c b/gcc/testsuite/gcc.c-torture/compile/pr44030.c new file mode 100644 index 000000000..cd5d5f616 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44030.c @@ -0,0 +1,28 @@ +typedef int int32_t; +typedef unsigned int uint32_t; +static uint32_t +safe_sub_func_uint32_t_u_u (uint32_t ui1, uint32_t ui2) +{ + return ui1 - ui2; +} + +int32_t l_105[7]; + +int32_t g_4; +int32_t *g_54 = &g_4; +int32_t * +func (int32_t p_73, int32_t * p_74, int32_t p_75, int32_t * *p_76, + int32_t * *p_77) +{ +lbl_110:for (g_4 = 0; g_4; g_4 = 1) + { + } + for (p_75 = -28; p_75; p_75 = safe_sub_func_uint32_t_u_u (p_75, 1)) + { + if (g_4) + goto lbl_110; + *g_54 = 0; + } + return &l_105[5]; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44038.c b/gcc/testsuite/gcc.c-torture/compile/pr44038.c new file mode 100644 index 000000000..574ff398b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44038.c @@ -0,0 +1,13 @@ +struct Ustr { + char data[1]; +}; +int ustr_xi__embed_val_get(char *); +inline static int ustr_len(struct Ustr *s1) +{ + return ustr_xi__embed_val_get(s1->data); +} +static struct Ustr *s1 = ((struct Ustr *) ""); +int tst(char *cstr) +{ + return ustr_len(s1); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44043.c b/gcc/testsuite/gcc.c-torture/compile/pr44043.c new file mode 100644 index 000000000..943501b40 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44043.c @@ -0,0 +1,87 @@ +typedef unsigned char __u8; +typedef unsigned short __u16; +typedef unsigned int __u32; +typedef unsigned long __kernel_size_t; +typedef __kernel_size_t size_t; +typedef __u8 uint8_t; +typedef __u16 __be16; +typedef __u32 __be32; +struct msghdr { + struct iovec * msg_iov; + unsigned msg_flags; +}; +enum { IPPROTO_ICMP = 1 }; +struct sk_buff { }; +static inline __attribute__((always_inline)) struct dst_entry * +skb_dst(const struct sk_buff *skb) +{ +}; +enum nf_inet_hooks { NF_INET_LOCAL_OUT }; +struct net_device { + unsigned mtu; +}; +static inline __attribute__((always_inline)) int +NF_HOOK_THRESH(uint8_t pf, unsigned int hook, struct sk_buff *skb, + struct net_device *in, struct net_device *out, + int (*okfn)(struct sk_buff *), int thresh) +{ + int ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, thresh); + if (ret == 1) + ret = okfn(skb); + return ret; +} +static inline __attribute__((always_inline)) int +NF_HOOK(uint8_t pf, unsigned int hook, struct sk_buff *skb, + struct net_device *in, struct net_device *out, + int (*okfn)(struct sk_buff *)) +{ + return NF_HOOK_THRESH(pf, hook, skb, in, out, okfn, (-((int)(~0U>>1)) - 1)); +} +struct dst_entry { + struct net_device *dev; + int (*output)(struct sk_buff*); +}; +static inline __attribute__((always_inline)) int dst_output(struct sk_buff *skb) { + return skb_dst(skb)->output(skb); +}; +struct iphdr { + __u8 protocol; +}; +struct inet_sock { + __be16 inet_dport; + __u8 recverr: 1, hdrincl: 1; + struct { } cork; +}; +struct icmphdr { + __u8 type; +}; +struct rtable { + union { struct dst_entry dst; } u; + __be32 rt_dst; +}; +struct sock; +struct inet_sock *inet_sk (struct sock *); +struct net *sock_net (struct sock *); +void *skb_transport_header (struct sk_buff *); +static int raw_send_hdrinc(struct sock *sk, void *from, size_t length, + struct rtable *rt, unsigned int flags) +{ + struct inet_sock *inet = inet_sk(sk); + struct net *net = sock_net(sk); + struct iphdr *iph; + struct sk_buff *skb; + if (length > rt->u.dst.dev->mtu) + ip_local_error(sk, 90, rt->rt_dst, inet->inet_dport, rt->u.dst.dev->mtu); + if (flags&0x10) + goto out; + if (iph->protocol == IPPROTO_ICMP) + icmp_out_count(net, ((struct icmphdr *)skb_transport_header(skb))->type); + NF_HOOK(2, NF_INET_LOCAL_OUT, skb, ((void *)0), rt->u.dst.dev, + dst_output); +out: + while (0); +} +int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) +{ + raw_send_hdrinc(sk, msg->msg_iov, len, (void *)0, msg->msg_flags); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44063.c b/gcc/testsuite/gcc.c-torture/compile/pr44063.c new file mode 100644 index 000000000..596e1dc99 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44063.c @@ -0,0 +1,38 @@ +typedef signed char int8_t; +typedef short int16_t; +typedef unsigned char uint8_t; +typedef unsigned int uint32_t; + +union unaligned_32 {uint32_t l;} __attribute__((packed)) __attribute__((may_alias)); +static inline uint32_t NEG_USR32(uint32_t a, int8_t s){return a << (32 - s);} +typedef struct GetBitContext { const uint8_t *buffer, *buffer_end; int index;}GetBitContext; +typedef struct VLC {int16_t (*table)[2];} VLC; +static __attribute__((always_inline)) inline int get_vlc2(GetBitContext *s, int16_t (*table)[2], int bits, int max_depth) { + unsigned int re_index= (s)->index; + int re_cache= 0; + { + int n, nb_bits; + unsigned int index; + index= NEG_USR32(re_cache, bits); + n = table[index][1]; + if(max_depth > 1 && n < 0){ + re_cache= bswap_32((((const union unaligned_32 *) (((const uint8_t *)(s)->buffer)+(re_index>>3)))->l)) << (re_index&0x07); + } + } +} +typedef struct HYuvContext{GetBitContext gb; int decorrelate; int bitstream_bpp; uint8_t *temp[3]; VLC vlc[6];} HYuvContext; +static __attribute__((always_inline)) inline void decode_bgr_1(HYuvContext *s, int count, int decorrelate, int alpha){ + int i; + int code = get_vlc2(&s->gb, s->vlc[3].table, 11, 1); + if(code != -1){ + s->temp[0][4*i+0] = get_vlc2(&s->gb, s->vlc[0].table, 11, 3); + s->temp[0][4*i+1] = get_vlc2(&s->gb, s->vlc[1].table, 11, 3); + s->temp[0][4*i+2] = get_vlc2(&s->gb, s->vlc[2].table, 11, 3); + } +} +void decode_bgr_bitstream(HYuvContext *s, int count){ + if(s->decorrelate){ + if(s->bitstream_bpp==24) decode_bgr_1(s, count, 1, 0); + else decode_bgr_1(s, count, 1, 1); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44119.c b/gcc/testsuite/gcc.c-torture/compile/pr44119.c new file mode 100644 index 000000000..ef6ca4533 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44119.c @@ -0,0 +1,46 @@ +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; +typedef unsigned int uint32_t; +static int8_t +safe_mul_func_int16_t_s_s (int16_t si1, int8_t si2) +{ + return si1 && si2 && si1 > +si2 || si1 && si2 && si2 < +si1 || si1 && si2 + && si1 < +si2 || si1 && si2 && si1 && si2 < +si1 ? : si1 * si2; +} + +struct S0 +{ +}; +int32_t g_72[7][4][1]; +int32_t *g_184 = &g_72[1][2][0]; +int32_t **g_224 = &g_184; +struct S0 g_244 = { +}; + +int8_t * +func_96 (int8_t p_97, uint32_t p_98, uint32_t p_99) +{ + struct S0 *l_243 = &g_244; + int i; + for (i = 0; i < 1; p_98 = 1) + { + int32_t *l_202[3]; + int i; + for (i = 0; i < 1; i++) + l_202[i] = &g_72[2][2][0]; + if (safe_mul_func_int16_t_s_s (0xCAF0, **g_224)) + { + if (p_98 && &l_243) + { + } + else + *g_224 = l_202[0]; + for (0;; 1) + { + } + } + } + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44197.c b/gcc/testsuite/gcc.c-torture/compile/pr44197.c new file mode 100644 index 000000000..9c2912ffc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44197.c @@ -0,0 +1,33 @@ +/* { dg-require-alias "" } */ +/* { dg-require-visibility "" } */ + +#ifndef __USER_LABEL_PREFIX__ +#define PREFIX "" +#else +#define xstr(s) str(s) +#define str(s) #s +#define PREFIX xstr(__USER_LABEL_PREFIX__) +#endif + +typedef unsigned short int __uint16_t; +enum +{ + _ISupper = (1 << (0)), _ISlower = (1 << (1)), _ISalpha = + (1 << (2)), _ISdigit = (1 << (3)), _ISxdigit = (1 << (4)), _ISspace = + (1 << (5)), _ISprint = (1 << (6)), _ISgraph = (1 << (7)), _ISblank = + (1 << (8)), _IScntrl = (1 << (9)), _ISpunct = (1 << (10)), _ISalnum = + (1 << (11)) +}; +typedef __uint16_t __ctype_mask_t; +extern const __ctype_mask_t *__C_ctype_b; +extern +__typeof (__C_ctype_b) + __C_ctype_b __asm__ (PREFIX "__GI___C_ctype_b") + __attribute__ ((visibility ("hidden"))); + static const __ctype_mask_t __C_ctype_b_data[] = { + }; + +const __ctype_mask_t *__C_ctype_b = __C_ctype_b_data + 128; +extern +__typeof (__C_ctype_b) + __EI___C_ctype_b __attribute__ ((alias ("" "__GI___C_ctype_b"))); diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44246.c b/gcc/testsuite/gcc.c-torture/compile/pr44246.c new file mode 100644 index 000000000..6e4786903 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44246.c @@ -0,0 +1,5 @@ +int main(int argc, char *argv[]) +{ + strcat(argv[0], "X"); + return strlen(argv[0]); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44686.c b/gcc/testsuite/gcc.c-torture/compile/pr44686.c new file mode 100644 index 000000000..eacd83d31 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44686.c @@ -0,0 +1,7 @@ +/* { dg-options "-O2 -fipa-pta -fprofile-generate" } */ +void * +memcpy (void *a, const void *b, __SIZE_TYPE__ len) +{ + if (a == b) + __builtin_abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44687.c b/gcc/testsuite/gcc.c-torture/compile/pr44687.c new file mode 100644 index 000000000..f59c2efd0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44687.c @@ -0,0 +1,32 @@ +typedef int int32_t; +typedef unsigned char uint8_t; +struct S0 +{ + uint8_t f0; +}; +struct S0 *g_18[7][5][1][1] = { +}; + +struct S0 **g_17 = &g_18[0][3][0][0]; +int32_t g_86; +struct S0 func_72 (uint8_t p_73, struct S0 p_74); + +void int326 (struct S0 **p_67, int32_t p_68, int32_t * *const p_69, + struct S0 *p_70) +{ + struct S0 l_95 = { + -1L + }; + func_72 (1L, func_72 (0, l_95)); +} + +struct S0 +func_72 (uint8_t p_73, struct S0 p_74) +{ + int32_t *l_85 = &g_86; + if (*l_85) + lbl_94:*l_85 ^= 0; + if (g_86) + goto lbl_94; + return **g_17; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44707.c b/gcc/testsuite/gcc.c-torture/compile/pr44707.c new file mode 100644 index 000000000..9031f0042 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44707.c @@ -0,0 +1,14 @@ +extern struct { int a, b, c, d; } v; +extern int w; + +void +foo (void) +{ + int e1 = v.a; + int e2 = w; + int e3 = v.b; + int e4 = v.c; + int e5 = v.d; + __asm__ volatile ("/* %0 %1 %2 %3 %4 */" : : "nro" (e1), "nro" (e2), "nro" (e3), "nro" (e4), "nro" (e5)); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44784.c b/gcc/testsuite/gcc.c-torture/compile/pr44784.c new file mode 100644 index 000000000..54d531a3d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44784.c @@ -0,0 +1,47 @@ +typedef struct rtx_def *rtx; +enum rtx_code { SUBREG }; +typedef union rtunion_def { + long rtint; + unsigned long rtuint; + rtx rtx; +} rtunion; +struct rtx_def { + enum rtx_code code: 8; + rtunion fld[1]; +}; +typedef struct simple_bitmap_def { + unsigned long long elms[1]; +} *sbitmap; +struct df_link { + struct df_link *next; + rtx reg; +}; +typedef enum { UNDEFINED, CONSTANT, VARYING } latticevalue; +typedef struct { + latticevalue lattice_val; +} value; +static value *values; +static sbitmap ssa_edges; +void defs_to_varying (struct df_link *start) +{ + struct df_link *currdef; + for (currdef = start; + currdef; + currdef = currdef->next) + { + rtx reg = currdef->reg; + if (values[(reg->code == SUBREG + ? reg->fld[0].rtx + : reg)->fld[0].rtuint].lattice_val != VARYING) + ssa_edges->elms [(reg->code == SUBREG + ? reg->fld[0].rtx + : reg)->fld[0].rtuint / 64] + |= ((unsigned long long) 1 + << (reg->code == SUBREG + ? reg->fld[0].rtx + : reg)->fld[0].rtuint % 64); + values[(reg->code == SUBREG + ? reg->fld[0].rtx + : reg)->fld[0].rtuint].lattice_val = VARYING; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44788.c b/gcc/testsuite/gcc.c-torture/compile/pr44788.c new file mode 100644 index 000000000..99dc79823 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44788.c @@ -0,0 +1,8 @@ +void joint_decode(float* mlt_buffer1, int t) { + int i; + float decode_buffer[1060]; + foo(decode_buffer); + for (i=0; i<10 ; i++) { + mlt_buffer1[i] = i * decode_buffer[t]; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44831.c b/gcc/testsuite/gcc.c-torture/compile/pr44831.c new file mode 100644 index 000000000..5539583de --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44831.c @@ -0,0 +1,15 @@ +typedef unsigned char UCHAR, *PUCHAR; +typedef void *HANDLE; +typedef struct _NCB { + UCHAR ncb_reserve[10]; +} NCB, *PNCB; +struct NBCmdQueue { + PNCB head; +}; +PNCB *NBCmdQueueFindNBC(struct NBCmdQueue *queue, PNCB ncb) +{ + PNCB *ret = &queue->head; + while (ret && *ret != ncb) + ret = (PNCB *)((*ret)->ncb_reserve + sizeof(HANDLE)); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44891.c b/gcc/testsuite/gcc.c-torture/compile/pr44891.c new file mode 100644 index 000000000..145b14469 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44891.c @@ -0,0 +1,26 @@ +struct S +{ + float f; + long l; +}; + +extern int gi; +extern float gf; + +long foo (long p) +{ + struct S s; + float *pf; + + s.l = p; + + pf = &s.f; + + pf++; + pf--; + + gf = *pf + 3.3; + gi = *((int *)pf) + 2; + + return s.l + 6; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44937.c b/gcc/testsuite/gcc.c-torture/compile/pr44937.c new file mode 100644 index 000000000..3bb711d7b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44937.c @@ -0,0 +1,30 @@ +int g_19; +int *g_42; +int **volatile g = &g_42; +int g_67[5][9][2][1] = { +}; + +int +func_4 (int p_5, unsigned char p_6, unsigned char p_7) +{ + unsigned char l_8[1]; + if (p_6) + goto lbl_13; + for (p_6 = 0; p_6; p_6 = (p_6, 0)) + if (0) + { + } + else + lbl_13:for (p_6 = 0; p_6 < 1; p_6 += 1) + l_8[p_6] = 0; + return 0; +} + +int * +func_45 (unsigned long p_46, unsigned char p_47) +{ + int *l_56 = &g_19; + (void *)&l_56 != (void *)&g | !1 == func_4 (0, g_67[2][6][1][0], 0) ^ func_4 (1, 0, 0); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44941.c b/gcc/testsuite/gcc.c-torture/compile/pr44941.c new file mode 100644 index 000000000..7d9cc8372 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44941.c @@ -0,0 +1,8 @@ +struct S { }; + +extern void bar(struct S); + +void foo (int i) +{ + bar (*(struct S *)&i); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44946.c b/gcc/testsuite/gcc.c-torture/compile/pr44946.c new file mode 100644 index 000000000..7b2301245 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44946.c @@ -0,0 +1,27 @@ +struct A +{ + int i; + long l; +}; + +struct B +{ + int i; +}; + +struct C +{ + int i; + struct B b; +}; + +struct B foo (struct A a) +{ + struct C *c = (struct C *) &a; + return c->b; +} +void bar (struct A a, struct B b) +{ + struct C *c = (struct C *) &a; + c->b = b; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44988.c b/gcc/testsuite/gcc.c-torture/compile/pr44988.c new file mode 100644 index 000000000..317eafdf7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr44988.c @@ -0,0 +1,13 @@ +struct S +{ + int i; +}; + +extern void bar (struct S); + +void +foo (void) +{ + int i = 0; + bar (*(struct S *) &i); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45047.c b/gcc/testsuite/gcc.c-torture/compile/pr45047.c new file mode 100644 index 000000000..f37955a03 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45047.c @@ -0,0 +1,9 @@ +/* PR tree-optimization/45047 */ + +void +foo (const unsigned short *w, char *x, int y, int z) +{ + int i; + for (i = 0; i < y; i++) + x[i] = w[i] == z; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45059.c b/gcc/testsuite/gcc.c-torture/compile/pr45059.c new file mode 100644 index 000000000..3f13cdbf8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45059.c @@ -0,0 +1,23 @@ +/* PR tree-optimization/45059 */ + +typedef unsigned int T; +extern void foo (signed char *, int); + +static signed char a; +static T b[1] = { -1 }; +static unsigned char c; + +static inline short int +bar (short v) +{ + c |= a < b[0]; + return 0; +} + +int +main () +{ + signed char *e = &a; + foo (e, bar (bar (c))); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45085.c b/gcc/testsuite/gcc.c-torture/compile/pr45085.c new file mode 100644 index 000000000..5c1ec6a5c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45085.c @@ -0,0 +1,45 @@ +/* { dg-options "-O2 -Wuninitialized" } */ +struct S { char *s1; long s2; }; +struct T { int t1; long t2; long t3; }; +extern int fn2 (void); +extern int fn3 (struct T); +extern struct T fn4 (); +extern int fn5 (char **, long *, int); +extern void fn6 (void); +extern void fn7 (void *); +struct S *fn10 (); +static int p; +static void *q; +extern struct T r; + +static struct T +fn8 (struct T x, int y) +{ + struct S *u = fn10 (); + int v = fn5 (&u->s1, &u->s2, 0); + while (1) + { + if (p) +fn6 (); + if (fn3 (x)) +return fn4 (); + if (y & 1) +return r; + v = fn5 (&u->s1, &u->s2, 1); + } +} + +struct T +fn9 (struct T x, int y) +{ + struct T t = fn8 (x, y); + if (fn2 ()) + fn7 (q); + return t; +} + +void * +fn1 (void) +{ + return fn9; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45109.c b/gcc/testsuite/gcc.c-torture/compile/pr45109.c new file mode 100644 index 000000000..0e46c3840 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45109.c @@ -0,0 +1,38 @@ +struct o_fsm_t; +struct o_fsm_event_t; + +typedef void (*fn_t) (struct o_fsm_t *, + struct o_fsm_event_t const *); + +struct o_fsm_state_t { + fn_t dispatch; +}; + +struct o_fsm_t { + fn_t dispatch; +}; + +extern struct o_fsm_state_t o_fsm_tran(struct o_fsm_t *fsm, + struct o_fsm_state_t next_state); +static void plist_parser_state_start(struct o_fsm_t *fsm, + struct o_fsm_event_t const *fsm_event); + +struct o_fsm_state_t o_fsm_state(fn_t dispatch_fcn) +{ + return *(struct o_fsm_state_t *)&dispatch_fcn; +} + +typedef struct _o_plist_parser_t { + struct o_fsm_t fsm; +} o_plist_parser_t; + +static void plist_parser_state_start(struct o_fsm_t *fsm, + struct o_fsm_event_t const *fsm_event) +{ +} + +void o_plist_deserialize_xml(int fin) +{ + o_plist_parser_t parser; + o_fsm_tran(&parser.fsm, o_fsm_state(plist_parser_state_start)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45182.c b/gcc/testsuite/gcc.c-torture/compile/pr45182.c new file mode 100644 index 000000000..ad27ff886 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45182.c @@ -0,0 +1,10 @@ +typedef struct TypHeader { + struct TypHeader ** ptr; +} *TypHandle; +void PlainRange (TypHandle hdList, long lenList, long low, long inc) +{ + long i; + for (i = 1; i <= lenList; i++ ) + (((TypHandle*)((hdList)->ptr))[i] = (((TypHandle) (((long)(low + (i-1) * +inc) << 2) + 1)))); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45412.c b/gcc/testsuite/gcc.c-torture/compile/pr45412.c new file mode 100644 index 000000000..339854b59 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45412.c @@ -0,0 +1,22 @@ +extern void baz (int, int, int); + +int j; + +int +bar (void) +{ + int n = 0, *np = &n; + if (j) + baz (0, 0, 0); + if (j) + baz (0, 0, 0); + return n; +} + +void +foo (void) +{ + bar (); + bar (); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45535.c b/gcc/testsuite/gcc.c-torture/compile/pr45535.c new file mode 100644 index 000000000..03d15a12d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45535.c @@ -0,0 +1,38 @@ +typedef struct { + unsigned long pmd0; + unsigned long pmd1; +} pmd_t; +typedef unsigned int pgd_t; +struct mm_struct { + pgd_t * pgd; +}; +extern inline int pmd_bad(pmd_t pmd) +{ +} +extern inline void pmd_clear(pmd_t * pmdp) +{ + ((*pmdp).pmd0) = 0x20 | 0x00; + ((*pmdp).pmd1) = 0x20 | 0x00; +} +static inline void free_one_pmd(pmd_t * dir) +{ + if (pmd_bad(*dir)) { + pmd_clear(dir); + } +} +static inline void free_one_pgd(pgd_t * dir) +{ + int j; + pmd_t * pmd; + pmd = ((pmd_t *) ((unsigned long) (void *)(__pgd_val(dir) & (~((1UL << 12)-1)))) + (((0) >> 21) & (512 - 1))); + for (j = 0; j < 512 ; j++) { + free_one_pmd(pmd+j); + } +} +void clear_page_tables(struct mm_struct *mm, unsigned long first, int nr) +{ + pgd_t * page_dir = mm->pgd; + do { + free_one_pgd(page_dir); + } while (--nr); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45728.c b/gcc/testsuite/gcc.c-torture/compile/pr45728.c new file mode 100644 index 000000000..a6ee10b8c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45728.c @@ -0,0 +1,17 @@ +/* PR rtl-optimization/45728 */ + +union U +{ + int *m; + double d; +}; + +int i; +union U u; + +int +foo (void) +{ + union U v = { &i }; + return u.d == v.d; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45771.c b/gcc/testsuite/gcc.c-torture/compile/pr45771.c new file mode 100644 index 000000000..2bd96eccc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45771.c @@ -0,0 +1,7 @@ +static const int data[2048]; + +void foo (void *ptr) +{ + __builtin_memcmp (data, ptr, 1); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45876.c b/gcc/testsuite/gcc.c-torture/compile/pr45876.c new file mode 100644 index 000000000..a71be5fa8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45876.c @@ -0,0 +1,9 @@ +/* PR middle-end/45876 */ + +unsigned +foo (unsigned x) +{ + short i = 0; + i = ((short) (((((unsigned) i) >> 1) & 16383) + x)) & 16383; + return i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45919.c b/gcc/testsuite/gcc.c-torture/compile/pr45919.c new file mode 100644 index 000000000..caf518db0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45919.c @@ -0,0 +1,9 @@ +/* PR tree-optimization/45919 */ + +const struct S { int a; int b[]; } s = { 0, { 0 }}; + +int +foo (void) +{ + return s.b[0]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45969-1.c b/gcc/testsuite/gcc.c-torture/compile/pr45969-1.c new file mode 100644 index 000000000..ccf68bc49 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45969-1.c @@ -0,0 +1,6 @@ +/* { dg-options "-std=c89" } */ +void crash() { + double l[4]; + if((l[0]+l[2]) && (l[1]+l[3])){ + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46002.c b/gcc/testsuite/gcc.c-torture/compile/pr46002.c new file mode 100644 index 000000000..27a3a3a28 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46002.c @@ -0,0 +1,10 @@ +/* { dg-options "-fira-algorithm=priority" } */ +char ** +foo (char **p, char *cmp, unsigned i) +{ + for (; *p; p++) + if (__builtin_strncmp (*p, cmp, i)) + if (i == __builtin_strlen (*p)) + break; + return p; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46034.c b/gcc/testsuite/gcc.c-torture/compile/pr46034.c new file mode 100644 index 000000000..02eda0572 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46034.c @@ -0,0 +1,14 @@ +/* PR rtl-optimization/46034 */ + +void bar (int); + +void +foo (int x, int y) +{ + int i; + for (i = 0; i < x; i++) + { + y = __builtin_abs (y); + bar (y / 2); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46107.c b/gcc/testsuite/gcc.c-torture/compile/pr46107.c new file mode 100644 index 000000000..41582b8a1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46107.c @@ -0,0 +1,16 @@ +/* PR tree-optimization/46107 */ + +int foo (void) __attribute__ ((noreturn)); + +void +bar (int x, int *y, int z) +{ + static void *j[] = { &&l1, &&l2 }; +l1: + if (*y) + goto *j[z]; + foo (); +l2: + *y ^= (x & 1) ? -1 : 0; + goto *j[x]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46248.c b/gcc/testsuite/gcc.c-torture/compile/pr46248.c new file mode 100644 index 000000000..6d3be2a65 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46248.c @@ -0,0 +1,32 @@ +/* PR rtl-optimization/46248 */ + +struct S +{ + int s; +}; + +void +foo (unsigned char *x, int y, struct S *z) +{ + const int l1 = y; + const int l2 = y + l1; + const int l3 = y + l2; + const int l4 = y + l3; + const int l5 = y + l4; + const int l6 = y + l5; + const int l7 = y + l6; + int i; + for (i = 0; i < 8; i++) + { + int a = x[l3] - x[l4]; + int b = x[l4] - x[l5]; + int c = x[l5] - x[l6]; + int d = (b >= 0 ? b : -b) - (((a >= 0 ? a : -a) + (c >= 0 ? c : -c)) >> 1); + if (d < z->s * 2) + { + int v = d * (-b > 0 ? 1 : -1); + x[l2] += v >> 3; + x[l7] -= v >> 3; + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46360.c b/gcc/testsuite/gcc.c-torture/compile/pr46360.c new file mode 100644 index 000000000..1a5239bc1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46360.c @@ -0,0 +1,13 @@ +/* PR middle-end/46360 */ + +__attribute__((gnu_inline, always_inline)) extern inline char * +strncpy (char *dest, const char *src, __SIZE_TYPE__ len) +{ + return __builtin_strncpy (dest, src, len); +} + +void +foo (char *s) +{ + strncpy (s, "", 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46388.c b/gcc/testsuite/gcc.c-torture/compile/pr46388.c new file mode 100644 index 000000000..74f60bb56 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46388.c @@ -0,0 +1,14 @@ +/* PR middle-end/46388 */ + +struct S; +struct T +{ + struct S *t; +}; +extern struct S s, u; + +void +foo (void) +{ + ((struct T *) &u)->t = &s; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46461.c b/gcc/testsuite/gcc.c-torture/compile/pr46461.c new file mode 100644 index 000000000..7e38598e1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46461.c @@ -0,0 +1,8 @@ +/* PR tree-optimization/46461 */ + +void +foo (char *c) +{ + c[7] = 0xff; + __builtin_memset (c + 8, 0xff, 8); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46534.c b/gcc/testsuite/gcc.c-torture/compile/pr46534.c new file mode 100644 index 000000000..dc3c967cc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46534.c @@ -0,0 +1,18 @@ +/* { dg-skip-if "too big" { pdp11-*-* } { "*" } { "" } } */ +/* PR middle-end/46534 */ + +extern int printf (const char *, ...); + +#define S1 " " +#define S2 S1 S1 S1 S1 S1 S1 S1 S1 S1 S1 +#define S3 S2 S2 S2 S2 S2 S2 S2 S2 S2 S2 +#define S4 S3 S3 S3 S3 S3 S3 S3 S3 S3 S3 +#define S5 S4 S4 S4 S4 S4 S4 S4 S4 S4 S4 +#define S6 S5 S5 S5 S5 S5 S5 S5 S5 S5 S5 +#define S7 S6 S6 S6 S6 S6 S6 S6 S6 S6 S6 + +void +foo (void) +{ + printf (S7 "\n"); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46547-1.c b/gcc/testsuite/gcc.c-torture/compile/pr46547-1.c new file mode 100644 index 000000000..67d8e1e7e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46547-1.c @@ -0,0 +1,6 @@ +void foo (void) { + _Bool d; + long double _Complex *s; + + d = *s++; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46637.c b/gcc/testsuite/gcc.c-torture/compile/pr46637.c new file mode 100644 index 000000000..c765949e8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46637.c @@ -0,0 +1,11 @@ +/* PR middle-end/46637 */ + +struct S { int s[5]; } *p; + +void +foo (long x) +{ + long a = x == 1 ? 4L : 1L; + asm ("" : "+m" (p->s[a])); + p->s[0]++; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46832.c b/gcc/testsuite/gcc.c-torture/compile/pr46832.c new file mode 100644 index 000000000..f500aa510 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46832.c @@ -0,0 +1,4 @@ +double pow(double x, double y); +void foo( double x ) { + int j = (int) ((pow(x, 2)) < 0.0 ? (pow(x, 2))-0.5 : (pow(x, 2))+0.5); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46856.c b/gcc/testsuite/gcc.c-torture/compile/pr46856.c new file mode 100644 index 000000000..2ec5e8baf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46856.c @@ -0,0 +1,26 @@ +struct data { + int prio; + signed char status; +}; + +struct base { + unsigned _num; + struct data vec[10]; +}; + +static struct data *ix(struct base *base, unsigned i) +{ + return &base->vec[i]; +} + +struct heap { + struct base base; +}; + +struct heap *heap; + +void increase_insn_priority (int *fld, int amount) +{ + if (ix(heap ? &heap->base : 0, *fld)->status > 0) + ix(heap ? &heap->base : 0, *fld)->prio += amount; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46866.c b/gcc/testsuite/gcc.c-torture/compile/pr46866.c new file mode 100644 index 000000000..494114857 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46866.c @@ -0,0 +1,19 @@ +extern void *malloc(__SIZE_TYPE__); +typedef struct T T; +struct T { + void (*destroy)(void *); +}; +void destroy(union { void *this; } __attribute__((transparent_union))); +static const typeof(destroy) *_destroy = (const typeof(destroy)*)destroy; +void destroy(void *this); +static T *create_empty(void) +{ + T *this = malloc(sizeof(*this)); + *this = (typeof(*this)){ _destroy }; + return this; +} +void openssl_crl_load(void) +{ + T *this = create_empty(); + destroy(this); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46883.c b/gcc/testsuite/gcc.c-torture/compile/pr46883.c new file mode 100644 index 000000000..db8527d54 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46883.c @@ -0,0 +1,13 @@ +void bar (unsigned char *q, unsigned short *data16s, int len) +{ + int i; + + for (i = 0; i < len; i++) + { + q[2 * i] = + (((data16s[i] & 0xFF) << 8) | ((data16s[i] >> 8) & 0xFF)) & 0xFF; + q[2 * i + 1] = + ((unsigned short) + (((data16s[i] & 0xFF) << 8) | ((data16s[i] >> 8) & 0xFF))) >> 8; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr47140.c b/gcc/testsuite/gcc.c-torture/compile/pr47140.c new file mode 100644 index 000000000..2adf53c20 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr47140.c @@ -0,0 +1,25 @@ +/* PR tree-optimization/47140 */ + +static inline int +foo (int x, short y) +{ + return y == 0 ? x : x + y; +} + +static inline unsigned short +bar (unsigned short x, unsigned char y) +{ + return x - y; +} + +int w; + +int baz (void); + +int +test (void) +{ + int i; + for (i = 0; i < 50; i++) + w += foo ((unsigned char) (1 + baz ()) >= bar (0, 1), 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr47141.c b/gcc/testsuite/gcc.c-torture/compile/pr47141.c new file mode 100644 index 000000000..875e0fdd1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr47141.c @@ -0,0 +1,16 @@ +int +foo (__UINTPTR_TYPE__ x) +{ + int a = 6; + int *b = &a; + if (x) + for (a = 0; a; a++) + ; + return a; +} + +void +bar (void) +{ + foo ((__UINTPTR_TYPE__) foo); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr47150.c b/gcc/testsuite/gcc.c-torture/compile/pr47150.c new file mode 100644 index 000000000..559ddd70f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr47150.c @@ -0,0 +1,11 @@ +/* PR c/47150 */ + +float _Complex foo (float, float); + +void +bar () +{ + float w = 2; + float _Complex b; + b = 0.5 * (foo (0, w) + foo (1, w) / w); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr47157.c b/gcc/testsuite/gcc.c-torture/compile/pr47157.c new file mode 100644 index 000000000..0947a5f9a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr47157.c @@ -0,0 +1,20 @@ +/* PR rtl-optimization/47157 */ + +struct S { unsigned a; unsigned b; } c = { 1, 0 }; +unsigned long int e; +void bar (int); +int baz (void); + +static int +foo (int x, short y) +{ + return ((x ^ y) & ((x ^ (x ^ y) & ~__INT_MAX__) - y ^ y)) < 0 ? x : x - y; +} + +void +test (void) +{ + bar (foo (baz () != (c.a | c.b), -1L)); + for (e = 0; e; e = 1) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr47265.c b/gcc/testsuite/gcc.c-torture/compile/pr47265.c new file mode 100644 index 000000000..183c3f986 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr47265.c @@ -0,0 +1,20 @@ +/* PR tree-optimization/47265 */ + +struct S +{ + char a[3]; + char b[3]; +}; + +void +bar (char *dst, const char *src, unsigned n) +{ + while (n--) + *dst++ = *src ? *src++ : ' '; +} + +void +foo (struct S *s) +{ + bar (s->a, s->b, 3); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr47427.c b/gcc/testsuite/gcc.c-torture/compile/pr47427.c new file mode 100644 index 000000000..4f0b98e20 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr47427.c @@ -0,0 +1,28 @@ +/* PR tree-optimization/47427 */ + +char *g, *h; + +int +bar (unsigned char x, const int y) +{ +lab: + for (; h; g = h) + for (g = 0; h; h++) + { + int a = 1; + if (h) + { + if (a) + goto lab; + return y; + } + } + return x; +} + +void +foo (void) +{ + if (bar (0, 1)) + bar (1, 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr47428.c b/gcc/testsuite/gcc.c-torture/compile/pr47428.c new file mode 100644 index 000000000..0c4ccc912 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr47428.c @@ -0,0 +1,42 @@ +/* PR tree-optimization/47428 */ + +struct S +{ + int s; +} a; +int b; + +void bar (struct S); + +int +baz (int x __attribute__((unused)), int y) +{ + int i; + for (i = 0; i < 1; i = 1) + for (y = 0; y < 1; y = 1); + return y; +} + +void +foo (void) +{ + fn (0); +} + +int +fn (const int x, int y __attribute__((unused))) +{ + if (baz (baz (0, x), 0)) + return 0; + else + bar (a); + return 0; +} + +void +bar (struct S x) +{ + for (;;) + for (; x.s;) + b = 0 ? : baz (0, 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr47967.c b/gcc/testsuite/gcc.c-torture/compile/pr47967.c new file mode 100644 index 000000000..cc2c21397 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr47967.c @@ -0,0 +1,17 @@ +/* PR tree-optimization/47967 */ + +extern void abort (void); +static void bar (); + +void +foo () +{ + bar (1); +} + +static void +bar (double i) +{ + if (i) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr48161.c b/gcc/testsuite/gcc.c-torture/compile/pr48161.c new file mode 100644 index 000000000..c454efcd0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr48161.c @@ -0,0 +1,24 @@ +/* PR bootstrap/48161 */ + +struct T { int u; }; +struct G { int l; int t; int r; }; +struct V { struct G v[10]; }; +struct { struct V b; } *h; +void bar (void); + +struct G * +baz (struct V *x, unsigned y) +{ + return &x->v[y]; +} + +int +foo (struct T *x, struct T *y) +{ + if ((baz (&h->b, y->u)->t ? baz (&h->b, y->u)->t : 0) + - baz (h ? &h->b : 0, x->u)->r + - (baz (h ? &h->b : 0, x->u)->t > 0 ? 5 : 0)) + return 1; + bar (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr48335-1.c b/gcc/testsuite/gcc.c-torture/compile/pr48335-1.c new file mode 100644 index 000000000..6f813382c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr48335-1.c @@ -0,0 +1,41 @@ +/* PR middle-end/48335 */ + +struct S { float d; }; + +void bar (struct S); + +void +f0 (int x) +{ + struct S s = {.d = 0.0f }; + ((char *) &s.d)[0] = x; + s.d *= 7.0; + bar (s); +} + +void +f1 (int x) +{ + struct S s = {.d = 0.0f }; + ((char *) &s.d)[1] = x; + s.d *= 7.0; + bar (s); +} + +void +f2 (int x) +{ + struct S s = {.d = 0.0f }; + ((char *) &s.d)[2] = x; + s.d *= 7.0; + bar (s); +} + +void +f3 (int x) +{ + struct S s = {.d = 0.0f }; + ((char *) &s.d)[3] = x; + s.d *= 7.0; + bar (s); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr48517.c b/gcc/testsuite/gcc.c-torture/compile/pr48517.c new file mode 100644 index 000000000..30b3ecbb3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr48517.c @@ -0,0 +1,13 @@ +/* PR c/48517 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void bar (const unsigned short *); + +void +foo (void) +{ + static const unsigned short array[] = (const unsigned short []) { 0x0D2B }; + const unsigned short *ptr = array; + bar (ptr); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr48734.c b/gcc/testsuite/gcc.c-torture/compile/pr48734.c new file mode 100644 index 000000000..b20ea80fb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr48734.c @@ -0,0 +1,11 @@ +/* PR tree-optimization/48734 */ + +unsigned int +foo (int x, unsigned int y, unsigned int z) +{ + z &= (x == -__INT_MAX__ - 1 ? x : -x) > y; + z &= (x == -__INT_MAX__ - 1 ? x : -x) > y; + z &= (x == -__INT_MAX__ - 1 ? x : -x) > y; + z &= (x == -__INT_MAX__ - 1 ? x : -x) > y; + return z; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr48742.c b/gcc/testsuite/gcc.c-torture/compile/pr48742.c new file mode 100644 index 000000000..0a670f3c9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr48742.c @@ -0,0 +1,15 @@ +/* PR c/48742 */ + +void baz (int); + +int +foo (void) +{ + return 1 / 0 > 0; +} + +void +bar (void) +{ + baz (1 <= 2 % (3 >> 1 > 5 / 6 == 3)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr49029.c b/gcc/testsuite/gcc.c-torture/compile/pr49029.c new file mode 100644 index 000000000..ebe81b31b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr49029.c @@ -0,0 +1,10 @@ +/* PR middle-end/49029 */ +struct S { volatile unsigned f : 11; signed g : 30; } __attribute__((packed)); +struct T { volatile struct S h; } __attribute__((packed)) a; +void foo (int); + +void +bar () +{ + foo (a.h.g); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr49049.c b/gcc/testsuite/gcc.c-torture/compile/pr49049.c new file mode 100644 index 000000000..a24b2a41c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr49049.c @@ -0,0 +1,28 @@ +__extension__ typedef unsigned long long int uint64_t; + +static int +sub (int a, int b) +{ + return a - b; +} + +static uint64_t +add (uint64_t a, uint64_t b) +{ + return a + b; +} + +int *ptr; + +int +foo (uint64_t arg1, int *arg2) +{ + int j; + for (; j < 1; j++) + { + *arg2 |= sub ( sub (sub (j || 1 ^ 0x1, 1), arg1 < 0x1 <= + sub (1, *ptr & j)), + (sub ( j != 1 || sub (j && j, 1) >= 0, + add (!j > arg1, 0x35DLL)))); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr49238.c b/gcc/testsuite/gcc.c-torture/compile/pr49238.c new file mode 100644 index 000000000..fd8443a8f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr49238.c @@ -0,0 +1,18 @@ +/* PR target/49238 */ +extern int bar (void); + +void +foo (unsigned long long a, int b) +{ + int i; + + if (b) + for (a = -12; a >= 10; a = bar ()) + break; + else + return; + + for (i = 0; i < 10; i += 10) + if ((i == bar ()) | (bar () >= a)) + bar (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr50565-1.c b/gcc/testsuite/gcc.c-torture/compile/pr50565-1.c new file mode 100644 index 000000000..cdaad294f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr50565-1.c @@ -0,0 +1,4 @@ +struct s { char p[2]; }; +static struct s v; +const int o0 = (int) ((void *) &v.p[0] - (void *) &v) + 0U; +const int o1 = (int) ((void *) &v.p[0] - (void *) &v) + 1U; diff --git a/gcc/testsuite/gcc.c-torture/compile/pr50565-2.c b/gcc/testsuite/gcc.c-torture/compile/pr50565-2.c new file mode 100644 index 000000000..2d30e8802 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr50565-2.c @@ -0,0 +1,4 @@ +struct s { char p[2]; }; +static struct s v; +const int o0 = (int) ((void *) &v.p[0] - (void *) &v) + 0; +const int o1 = (int) ((void *) &v.p[0] - (void *) &v) + 1; diff --git a/gcc/testsuite/gcc.c-torture/compile/pr51077.c b/gcc/testsuite/gcc.c-torture/compile/pr51077.c new file mode 100644 index 000000000..de2b97e58 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr51077.c @@ -0,0 +1,15 @@ +/* PR middle-end/51077 */ + +struct S { unsigned char s, t[256]; }; + +void +foo (const struct S *x, struct S *y, int z) +{ + int i; + for (i = 0; i < 8; i++) + { + const struct S *a = &x[i]; + __builtin___memcpy_chk (y->t, a->t, z, __builtin_object_size (y->t, 0)); + y = (struct S *) &y->t[z]; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr51767.c b/gcc/testsuite/gcc.c-torture/compile/pr51767.c new file mode 100644 index 000000000..62a192d66 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr51767.c @@ -0,0 +1,23 @@ +/* PR rtl-optimization/51767 */ + +extern void fn1 (void), fn2 (void); + +static inline __attribute__((always_inline)) int +foo (int *x, long y) +{ + asm goto ("" : : "r" (x), "r" (y) : "memory" : lab); + return 0; +lab: + return 1; +} + +void +bar (int *x) +{ + if (foo (x, 23)) + fn1 (); + else + fn2 (); + + foo (x, 2); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr52074.c b/gcc/testsuite/gcc.c-torture/compile/pr52074.c new file mode 100644 index 000000000..92a2096f0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr52074.c @@ -0,0 +1,10 @@ +/* PR middle-end/52074 */ + +struct S { const char *d, *e; } __attribute__((packed)); + +void +foo (const char **p, struct S *q) +{ + *p = "abcdef"; + q->d = "ghijk"; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr53418-1.c b/gcc/testsuite/gcc.c-torture/compile/pr53418-1.c new file mode 100644 index 000000000..721b02d78 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr53418-1.c @@ -0,0 +1,5 @@ +void +f (void) +{ + int i = (0 ? 1 : 0U / 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr53418-2.c b/gcc/testsuite/gcc.c-torture/compile/pr53418-2.c new file mode 100644 index 000000000..a437b6a0e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr53418-2.c @@ -0,0 +1,5 @@ +void +f (void) +{ + int i = (1 ? 0U / 0 : 1); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr54103-1.c b/gcc/testsuite/gcc.c-torture/compile/pr54103-1.c new file mode 100644 index 000000000..d941f3e1f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr54103-1.c @@ -0,0 +1,5 @@ +void +f (void) +{ + 0 || 0 / 0 ? : 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr54103-2.c b/gcc/testsuite/gcc.c-torture/compile/pr54103-2.c new file mode 100644 index 000000000..4bd624965 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr54103-2.c @@ -0,0 +1,5 @@ +void +f (void) +{ + 0 / 0 || 0 ? : 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr54103-3.c b/gcc/testsuite/gcc.c-torture/compile/pr54103-3.c new file mode 100644 index 000000000..9be0b94ce --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr54103-3.c @@ -0,0 +1,5 @@ +void +f (void) +{ + 1 && 0 / 0 ? : 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr54103-4.c b/gcc/testsuite/gcc.c-torture/compile/pr54103-4.c new file mode 100644 index 000000000..89ce24cd9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr54103-4.c @@ -0,0 +1,5 @@ +void +f (void) +{ + 0 / 0 && 1 ? : 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr54103-5.c b/gcc/testsuite/gcc.c-torture/compile/pr54103-5.c new file mode 100644 index 000000000..9594b2895 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr54103-5.c @@ -0,0 +1,5 @@ +void +f (void) +{ + !(0 / 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr54103-6.c b/gcc/testsuite/gcc.c-torture/compile/pr54103-6.c new file mode 100644 index 000000000..2b0b0baa9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr54103-6.c @@ -0,0 +1,5 @@ +void +f (void) +{ + 0 || 65536*65536 ? : 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr54552-1.c b/gcc/testsuite/gcc.c-torture/compile/pr54552-1.c new file mode 100644 index 000000000..bc20053a1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr54552-1.c @@ -0,0 +1,8 @@ +void +f (void) +{ + unsigned n = 10; + + typedef double T[n]; + (double (*)[n])((unsigned char (*)[sizeof (T)]){ 0 }); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr56539.c b/gcc/testsuite/gcc.c-torture/compile/pr56539.c new file mode 100644 index 000000000..0fba96f4c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr56539.c @@ -0,0 +1,7 @@ +/* PR tree-optimization/56539 */ + +short +foo (const char *x, unsigned y) +{ + return y > 1 ? (x[y - 1] - '0') + 10 * foo (x, y - 1) : (*x - '0'); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pta-1.c b/gcc/testsuite/gcc.c-torture/compile/pta-1.c new file mode 100644 index 000000000..515e5ff13 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pta-1.c @@ -0,0 +1,31 @@ +typedef struct JSObject JSObject; +typedef struct JSObjectMap *(*JSNewObjectMapOp) (JSObject *obj); +typedef JSObject *(*JSGetMethodOp) (JSObject *obj); +struct JSObjectOps { + JSNewObjectMapOp newObjectMap; +}; +struct JSXMLObjectOps { + struct JSObjectOps base; + JSGetMethodOp getMethod; +}; +struct JSObjectMap { + struct JSObjectOps *ops; +}; +struct JSObject { + struct JSObjectMap *map; +}; + +struct JSXMLObjectOps js_XMLObjectOps; + + +/* We need to create SFT's for the entire structure when this address is taken, + not just the part in the component reference itself. */ +JSObject *JS_GetMethod(JSObject *obj) +{ + if (obj->map->ops == &js_XMLObjectOps.base) { + struct JSXMLObjectOps *ops; + ops = (struct JSXMLObjectOps *) obj->map->ops; + obj = ops->getMethod(obj); + } + return obj; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/ptr-conv-1.c b/gcc/testsuite/gcc.c-torture/compile/ptr-conv-1.c new file mode 100644 index 000000000..11dc8ce89 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/ptr-conv-1.c @@ -0,0 +1,11 @@ +/* The intermediate conversion to __PTRDIFF_TYPE__ could be lost, + resulting in an "invalid types in nop conversion" ICE. */ +long long a; +void +f (void) +{ + int c = 1; + volatile int *p = &c; + a = (long long) (__PTRDIFF_TYPE__) p; + *p; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-1.c b/gcc/testsuite/gcc.c-torture/compile/simd-1.c new file mode 100644 index 000000000..6a07bbb6a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/simd-1.c @@ -0,0 +1,7 @@ +typedef int v2si __attribute__ ((vector_size (8))); +typedef unsigned di __attribute__ ((mode(DI))); +void foo(unsigned long); +void bar() { + v2si x = { 1, 2 }; + foo((di) x); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-2.c b/gcc/testsuite/gcc.c-torture/compile/simd-2.c new file mode 100644 index 000000000..480c712c0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/simd-2.c @@ -0,0 +1,17 @@ +typedef float floatvect2 __attribute__((vector_size (8))); + +typedef union +{ + floatvect2 vector; + float f[2]; +}resfloatvect2; + +void tempf(float *x, float *y) +{ + floatvect2 temp={x[0],x[1]}; + floatvect2 temp1={y[0],y[1]}; + resfloatvect2 temp2; + temp2.vector=temp+temp1; + x[0]=temp2.f[0]; + x[1]=temp2.f[1]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-3.c b/gcc/testsuite/gcc.c-torture/compile/simd-3.c new file mode 100644 index 000000000..42a38ae56 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/simd-3.c @@ -0,0 +1,23 @@ +#include + +/* If double is not wider than float, we probably don't have DFmode, + or at least it's not as wide as double. */ +#if DBL_MANT_DIG > FLT_MANT_DIG +typedef double floatvect2 __attribute__((vector_size (16))); + +typedef union +{ + floatvect2 vector; + double f[2]; +}resfloatvect2; + +void tempf(double *x, double *y) +{ + floatvect2 temp={x[0],x[1]}; + floatvect2 temp1={y[0],y[1]}; + resfloatvect2 temp2; + temp2.vector=temp+temp1; + x[0]=temp2.f[0]; + x[1]=temp2.f[1]; +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-4.c b/gcc/testsuite/gcc.c-torture/compile/simd-4.c new file mode 100644 index 000000000..6329fc096 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/simd-4.c @@ -0,0 +1,15 @@ +typedef float floatvect2 __attribute__((vector_size (16))); + +typedef union +{ + floatvect2 vector; + float f[2]; +}resfloatvect2; + +void tempf(floatvect2 *x, floatvect2 *y) +{ + floatvect2 temp= *x; + floatvect2 temp1=*y; + resfloatvect2 temp2; + *x=temp+temp1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-5.c b/gcc/testsuite/gcc.c-torture/compile/simd-5.c new file mode 100644 index 000000000..016cccd1e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/simd-5.c @@ -0,0 +1,12 @@ +#define vector64 __attribute__((vector_size(8))) + +main(){ + + vector64 int c; +vector64 int a = {1, -1}; +vector64 int b = {2, -2}; +c = -a + b*b*(-1LL); +/* c is now {5, 3} */ + + printf("result is %llx\n", (long long)c); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-6.c b/gcc/testsuite/gcc.c-torture/compile/simd-6.c new file mode 100644 index 000000000..7998e152f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/simd-6.c @@ -0,0 +1,3 @@ +typedef int __attribute__((vector_size (8))) vec; + +vec a[] = {(vec) {1, 2}, {3, 4}}; diff --git a/gcc/testsuite/gcc.c-torture/compile/sizeof-macros-1.c b/gcc/testsuite/gcc.c-torture/compile/sizeof-macros-1.c new file mode 100644 index 000000000..80618cc8d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/sizeof-macros-1.c @@ -0,0 +1,15 @@ +/* This checks the gcc builtin macros defined to the byte + sizes of C standard types. */ + +int a[sizeof(int) == __SIZEOF_INT__ ? 1 : -1]; +int b[sizeof(long) == __SIZEOF_LONG__ ? 1 : -1]; +int c[sizeof(long long) == __SIZEOF_LONG_LONG__ ? 1 : -1]; +int d[sizeof(short) == __SIZEOF_SHORT__ ? 1 : -1]; +int e[sizeof(void *) == __SIZEOF_POINTER__ ? 1 : -1]; +int f[sizeof(float) == __SIZEOF_FLOAT__ ? 1 : -1]; +int g[sizeof(double) == __SIZEOF_DOUBLE__ ? 1 : -1]; +int h[sizeof(long double) == __SIZEOF_LONG_DOUBLE__ ? 1 : -1]; +int i[sizeof(__SIZE_TYPE__) == __SIZEOF_SIZE_T__ ? 1 : -1]; +int j[sizeof(__WCHAR_TYPE__) == __SIZEOF_WCHAR_T__ ? 1 : -1]; +int k[sizeof(__WINT_TYPE__) == __SIZEOF_WINT_T__ ? 1 : -1]; +int l[sizeof(__PTRDIFF_TYPE__) == __SIZEOF_PTRDIFF_T__ ? 1 : -1]; diff --git a/gcc/testsuite/gcc.c-torture/compile/sra-1.c b/gcc/testsuite/gcc.c-torture/compile/sra-1.c new file mode 100644 index 000000000..06dcf1002 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/sra-1.c @@ -0,0 +1,75 @@ +/* { dg-do compile } */ +/* { dg-options "-O1" } */ +/* Let gimple verifier check what SRA does to unions and single-field + strucutres . */ + +struct sim_struct +{ + int x; +}; + +extern struct sim_struct get_x(void); + +struct sim_struct foo (void) +{ + struct sim_struct simple; + + simple = get_x (); + if (simple.x % 2) + simple.x = 39; + else + simple.x -=8; + + return simple; +} + +struct sim_cmplx +{ + _Complex double c; +}; + +extern struct sim_cmplx get_sc (void); + +_Complex double foo_c (void) +{ + struct sim_cmplx simple; + + simple = get_sc (); + if (__real__ simple.c > 200.3) + __imag__ simple.c -= 2.4; + + return simple.c; +} + + +union sim_union +{ + int i; + float d; +}; + +extern union sim_union get_y (void); + +union sim_union bar (void) +{ + union sim_union simple; + + simple = get_y (); + if (simple.d > 8.2) + simple.i = 300; + + return simple; +} + +extern int get_int (void); + +int bar_i (void) +{ + union sim_union simple; + + simple = get_y (); + if (simple.d > 8.2) + simple.i = get_int (); + + return simple.i; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/ssa-pre-1.c b/gcc/testsuite/gcc.c-torture/compile/ssa-pre-1.c new file mode 100644 index 000000000..eda370d4b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/ssa-pre-1.c @@ -0,0 +1,19 @@ +void washQtoM3(double m[9], double q[4]); +double sqrt(double); +int f(int samp) +{ + double clp[2], xyz[3], q[4], len; + double mRF[9]; + int xi; + for (xi=0; xi. + + Please email any bugs, comments, and/or additions to this file to: + bug-gdb@prep.ai.mit.edu */ + +struct struct1 { char a;}; +struct struct2 { char a, b;}; +struct struct3 { char a, b, c; }; +struct struct4 { char a, b, c, d; }; +struct struct5 { char a, b, c, d, e; }; +struct struct6 { char a, b, c, d, e, f; }; +struct struct7 { char a, b, c, d, e, f, g; }; +struct struct8 { char a, b, c, d, e, f, g, h; }; +struct struct9 { char a, b, c, d, e, f, g, h, i; }; +struct struct10 { char a, b, c, d, e, f, g, h, i, j; }; +struct struct11 { char a, b, c, d, e, f, g, h, i, j, k; }; +struct struct12 { char a, b, c, d, e, f, g, h, i, j, k, l; }; +struct struct16 { char a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p; }; + +struct struct1 foo1 = {'1'}, L1; +struct struct2 foo2 = { 'a', 'b'}, L2; +struct struct3 foo3 = { 'A', 'B', 'C'}, L3; +struct struct4 foo4 = {'1', '2', '3', '4'}, L4; +struct struct5 foo5 = {'a', 'b', 'c', 'd', 'e'}, L5; +struct struct6 foo6 = {'A', 'B', 'C', 'D', 'E', 'F'}, L6; +struct struct7 foo7 = {'1', '2', '3', '4', '5', '6', '7'}, L7; +struct struct8 foo8 = {'1', '2', '3', '4', '5', '6', '7', '8'}, L8; +struct struct9 foo9 = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'}, L9; +struct struct10 foo10 = { + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'}, L10; +struct struct11 foo11 = { + '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B'}, L11; +struct struct12 foo12 = { + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L'}, L12; +struct struct16 foo16 = { + 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p'}, L16; + +struct struct1 fun1() +{ + return foo1; +} +struct struct2 fun2() +{ + return foo2; +} +struct struct3 fun3() +{ + return foo3; +} +struct struct4 fun4() +{ + return foo4; +} +struct struct5 fun5() +{ + return foo5; +} +struct struct6 fun6() +{ + return foo6; +} +struct struct7 fun7() +{ + return foo7; +} +struct struct8 fun8() +{ + return foo8; +} +struct struct9 fun9() +{ + return foo9; +} +struct struct10 fun10() +{ + return foo10; +} +struct struct11 fun11() +{ + return foo11; +} +struct struct12 fun12() +{ + return foo12; +} +struct struct16 fun16() +{ + return foo16; +} + +#ifdef PROTOTYPES +void Fun1(struct struct1 foo1) +#else +void Fun1(foo1) + struct struct1 foo1; +#endif +{ + L1 = foo1; +} +#ifdef PROTOTYPES +void Fun2(struct struct2 foo2) +#else +void Fun2(foo2) + struct struct2 foo2; +#endif +{ + L2 = foo2; +} +#ifdef PROTOTYPES +void Fun3(struct struct3 foo3) +#else +void Fun3(foo3) + struct struct3 foo3; +#endif +{ + L3 = foo3; +} +#ifdef PROTOTYPES +void Fun4(struct struct4 foo4) +#else +void Fun4(foo4) + struct struct4 foo4; +#endif +{ + L4 = foo4; +} +#ifdef PROTOTYPES +void Fun5(struct struct5 foo5) +#else +void Fun5(foo5) + struct struct5 foo5; +#endif +{ + L5 = foo5; +} +#ifdef PROTOTYPES +void Fun6(struct struct6 foo6) +#else +void Fun6(foo6) + struct struct6 foo6; +#endif +{ + L6 = foo6; +} +#ifdef PROTOTYPES +void Fun7(struct struct7 foo7) +#else +void Fun7(foo7) + struct struct7 foo7; +#endif +{ + L7 = foo7; +} +#ifdef PROTOTYPES +void Fun8(struct struct8 foo8) +#else +void Fun8(foo8) + struct struct8 foo8; +#endif +{ + L8 = foo8; +} +#ifdef PROTOTYPES +void Fun9(struct struct9 foo9) +#else +void Fun9(foo9) + struct struct9 foo9; +#endif +{ + L9 = foo9; +} +#ifdef PROTOTYPES +void Fun10(struct struct10 foo10) +#else +void Fun10(foo10) + struct struct10 foo10; +#endif +{ + L10 = foo10; +} +#ifdef PROTOTYPES +void Fun11(struct struct11 foo11) +#else +void Fun11(foo11) + struct struct11 foo11; +#endif +{ + L11 = foo11; +} +#ifdef PROTOTYPES +void Fun12(struct struct12 foo12) +#else +void Fun12(foo12) + struct struct12 foo12; +#endif +{ + L12 = foo12; +} +#ifdef PROTOTYPES +void Fun16(struct struct16 foo16) +#else +void Fun16(foo16) + struct struct16 foo16; +#endif +{ + L16 = foo16; +} + +int main() +{ +#ifdef usestubs + set_debug_traps(); + breakpoint(); +#endif + + /* TEST C FUNCTIONS */ + L1 = fun1(); + L2 = fun2(); + L3 = fun3(); + L4 = fun4(); + L5 = fun5(); + L6 = fun6(); + L7 = fun7(); + L8 = fun8(); + L9 = fun9(); + L10 = fun10(); + L11 = fun11(); + L12 = fun12(); + L16 = fun16(); + + foo1.a = foo2.a = foo3.a = foo4.a = foo5.a = foo6.a = foo7.a = foo8.a = + foo9.a = foo10.a = foo11.a = foo12.a = foo16.a = '$'; + + Fun1(foo1); + Fun2(foo2); + Fun3(foo3); + Fun4(foo4); + Fun5(foo5); + Fun6(foo6); + Fun7(foo7); + Fun8(foo8); + Fun9(foo9); + Fun10(foo10); + Fun11(foo11); + Fun12(foo12); + Fun16(foo16); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/switch-1.c b/gcc/testsuite/gcc.c-torture/compile/switch-1.c new file mode 100644 index 000000000..cc71d30bb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/switch-1.c @@ -0,0 +1,9 @@ +/* PR middle-end/26557. */ +const int struct_test[1] = {1}; +void g(); +void f() { + switch(struct_test[0]) { + case 1: g(); + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/sync-1.c b/gcc/testsuite/gcc.c-torture/compile/sync-1.c new file mode 100644 index 000000000..0354923d2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/sync-1.c @@ -0,0 +1,279 @@ +/* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "" { target *-*-* } 0 } */ +/* { dg-message "note: '__sync_nand_and_fetch' changed semantics in GCC 4.4" "" { target *-*-* } 0 } */ + +/* Validate that each of the __sync builtins compiles. This won't + necessarily link, since the target might not support the builtin, + so this may result in external library calls. */ + +signed char sc; +unsigned char uc; +signed short ss; +unsigned short us; +signed int si; +unsigned int ui; +signed long sl; +unsigned long ul; +signed long long sll; +unsigned long long ull; +void *vp; +int *ip; +struct S { struct S *next; int x; } *sp; + +void test_op_ignore (void) +{ + (void) __sync_fetch_and_add (&sc, 1); + (void) __sync_fetch_and_add (&uc, 1); + (void) __sync_fetch_and_add (&ss, 1); + (void) __sync_fetch_and_add (&us, 1); + (void) __sync_fetch_and_add (&si, 1); + (void) __sync_fetch_and_add (&ui, 1); + (void) __sync_fetch_and_add (&sl, 1); + (void) __sync_fetch_and_add (&ul, 1); + (void) __sync_fetch_and_add (&sll, 1); + (void) __sync_fetch_and_add (&ull, 1); + + (void) __sync_fetch_and_sub (&sc, 1); + (void) __sync_fetch_and_sub (&uc, 1); + (void) __sync_fetch_and_sub (&ss, 1); + (void) __sync_fetch_and_sub (&us, 1); + (void) __sync_fetch_and_sub (&si, 1); + (void) __sync_fetch_and_sub (&ui, 1); + (void) __sync_fetch_and_sub (&sl, 1); + (void) __sync_fetch_and_sub (&ul, 1); + (void) __sync_fetch_and_sub (&sll, 1); + (void) __sync_fetch_and_sub (&ull, 1); + + (void) __sync_fetch_and_or (&sc, 1); + (void) __sync_fetch_and_or (&uc, 1); + (void) __sync_fetch_and_or (&ss, 1); + (void) __sync_fetch_and_or (&us, 1); + (void) __sync_fetch_and_or (&si, 1); + (void) __sync_fetch_and_or (&ui, 1); + (void) __sync_fetch_and_or (&sl, 1); + (void) __sync_fetch_and_or (&ul, 1); + (void) __sync_fetch_and_or (&sll, 1); + (void) __sync_fetch_and_or (&ull, 1); + + (void) __sync_fetch_and_xor (&sc, 1); + (void) __sync_fetch_and_xor (&uc, 1); + (void) __sync_fetch_and_xor (&ss, 1); + (void) __sync_fetch_and_xor (&us, 1); + (void) __sync_fetch_and_xor (&si, 1); + (void) __sync_fetch_and_xor (&ui, 1); + (void) __sync_fetch_and_xor (&sl, 1); + (void) __sync_fetch_and_xor (&ul, 1); + (void) __sync_fetch_and_xor (&sll, 1); + (void) __sync_fetch_and_xor (&ull, 1); + + (void) __sync_fetch_and_and (&sc, 1); + (void) __sync_fetch_and_and (&uc, 1); + (void) __sync_fetch_and_and (&ss, 1); + (void) __sync_fetch_and_and (&us, 1); + (void) __sync_fetch_and_and (&si, 1); + (void) __sync_fetch_and_and (&ui, 1); + (void) __sync_fetch_and_and (&sl, 1); + (void) __sync_fetch_and_and (&ul, 1); + (void) __sync_fetch_and_and (&sll, 1); + (void) __sync_fetch_and_and (&ull, 1); + + (void) __sync_fetch_and_nand (&sc, 1); + (void) __sync_fetch_and_nand (&uc, 1); + (void) __sync_fetch_and_nand (&ss, 1); + (void) __sync_fetch_and_nand (&us, 1); + (void) __sync_fetch_and_nand (&si, 1); + (void) __sync_fetch_and_nand (&ui, 1); + (void) __sync_fetch_and_nand (&sl, 1); + (void) __sync_fetch_and_nand (&ul, 1); + (void) __sync_fetch_and_nand (&sll, 1); + (void) __sync_fetch_and_nand (&ull, 1); +} + +void test_fetch_and_op (void) +{ + sc = __sync_fetch_and_add (&sc, 11); + uc = __sync_fetch_and_add (&uc, 11); + ss = __sync_fetch_and_add (&ss, 11); + us = __sync_fetch_and_add (&us, 11); + si = __sync_fetch_and_add (&si, 11); + ui = __sync_fetch_and_add (&ui, 11); + sl = __sync_fetch_and_add (&sl, 11); + ul = __sync_fetch_and_add (&ul, 11); + sll = __sync_fetch_and_add (&sll, 11); + ull = __sync_fetch_and_add (&ull, 11); + + sc = __sync_fetch_and_sub (&sc, 11); + uc = __sync_fetch_and_sub (&uc, 11); + ss = __sync_fetch_and_sub (&ss, 11); + us = __sync_fetch_and_sub (&us, 11); + si = __sync_fetch_and_sub (&si, 11); + ui = __sync_fetch_and_sub (&ui, 11); + sl = __sync_fetch_and_sub (&sl, 11); + ul = __sync_fetch_and_sub (&ul, 11); + sll = __sync_fetch_and_sub (&sll, 11); + ull = __sync_fetch_and_sub (&ull, 11); + + sc = __sync_fetch_and_or (&sc, 11); + uc = __sync_fetch_and_or (&uc, 11); + ss = __sync_fetch_and_or (&ss, 11); + us = __sync_fetch_and_or (&us, 11); + si = __sync_fetch_and_or (&si, 11); + ui = __sync_fetch_and_or (&ui, 11); + sl = __sync_fetch_and_or (&sl, 11); + ul = __sync_fetch_and_or (&ul, 11); + sll = __sync_fetch_and_or (&sll, 11); + ull = __sync_fetch_and_or (&ull, 11); + + sc = __sync_fetch_and_xor (&sc, 11); + uc = __sync_fetch_and_xor (&uc, 11); + ss = __sync_fetch_and_xor (&ss, 11); + us = __sync_fetch_and_xor (&us, 11); + si = __sync_fetch_and_xor (&si, 11); + ui = __sync_fetch_and_xor (&ui, 11); + sl = __sync_fetch_and_xor (&sl, 11); + ul = __sync_fetch_and_xor (&ul, 11); + sll = __sync_fetch_and_xor (&sll, 11); + ull = __sync_fetch_and_xor (&ull, 11); + + sc = __sync_fetch_and_and (&sc, 11); + uc = __sync_fetch_and_and (&uc, 11); + ss = __sync_fetch_and_and (&ss, 11); + us = __sync_fetch_and_and (&us, 11); + si = __sync_fetch_and_and (&si, 11); + ui = __sync_fetch_and_and (&ui, 11); + sl = __sync_fetch_and_and (&sl, 11); + ul = __sync_fetch_and_and (&ul, 11); + sll = __sync_fetch_and_and (&sll, 11); + ull = __sync_fetch_and_and (&ull, 11); + + sc = __sync_fetch_and_nand (&sc, 11); + uc = __sync_fetch_and_nand (&uc, 11); + ss = __sync_fetch_and_nand (&ss, 11); + us = __sync_fetch_and_nand (&us, 11); + si = __sync_fetch_and_nand (&si, 11); + ui = __sync_fetch_and_nand (&ui, 11); + sl = __sync_fetch_and_nand (&sl, 11); + ul = __sync_fetch_and_nand (&ul, 11); + sll = __sync_fetch_and_nand (&sll, 11); + ull = __sync_fetch_and_nand (&ull, 11); +} + +void test_op_and_fetch (void) +{ + sc = __sync_add_and_fetch (&sc, uc); + uc = __sync_add_and_fetch (&uc, uc); + ss = __sync_add_and_fetch (&ss, uc); + us = __sync_add_and_fetch (&us, uc); + si = __sync_add_and_fetch (&si, uc); + ui = __sync_add_and_fetch (&ui, uc); + sl = __sync_add_and_fetch (&sl, uc); + ul = __sync_add_and_fetch (&ul, uc); + sll = __sync_add_and_fetch (&sll, uc); + ull = __sync_add_and_fetch (&ull, uc); + + sc = __sync_sub_and_fetch (&sc, uc); + uc = __sync_sub_and_fetch (&uc, uc); + ss = __sync_sub_and_fetch (&ss, uc); + us = __sync_sub_and_fetch (&us, uc); + si = __sync_sub_and_fetch (&si, uc); + ui = __sync_sub_and_fetch (&ui, uc); + sl = __sync_sub_and_fetch (&sl, uc); + ul = __sync_sub_and_fetch (&ul, uc); + sll = __sync_sub_and_fetch (&sll, uc); + ull = __sync_sub_and_fetch (&ull, uc); + + sc = __sync_or_and_fetch (&sc, uc); + uc = __sync_or_and_fetch (&uc, uc); + ss = __sync_or_and_fetch (&ss, uc); + us = __sync_or_and_fetch (&us, uc); + si = __sync_or_and_fetch (&si, uc); + ui = __sync_or_and_fetch (&ui, uc); + sl = __sync_or_and_fetch (&sl, uc); + ul = __sync_or_and_fetch (&ul, uc); + sll = __sync_or_and_fetch (&sll, uc); + ull = __sync_or_and_fetch (&ull, uc); + + sc = __sync_xor_and_fetch (&sc, uc); + uc = __sync_xor_and_fetch (&uc, uc); + ss = __sync_xor_and_fetch (&ss, uc); + us = __sync_xor_and_fetch (&us, uc); + si = __sync_xor_and_fetch (&si, uc); + ui = __sync_xor_and_fetch (&ui, uc); + sl = __sync_xor_and_fetch (&sl, uc); + ul = __sync_xor_and_fetch (&ul, uc); + sll = __sync_xor_and_fetch (&sll, uc); + ull = __sync_xor_and_fetch (&ull, uc); + + sc = __sync_and_and_fetch (&sc, uc); + uc = __sync_and_and_fetch (&uc, uc); + ss = __sync_and_and_fetch (&ss, uc); + us = __sync_and_and_fetch (&us, uc); + si = __sync_and_and_fetch (&si, uc); + ui = __sync_and_and_fetch (&ui, uc); + sl = __sync_and_and_fetch (&sl, uc); + ul = __sync_and_and_fetch (&ul, uc); + sll = __sync_and_and_fetch (&sll, uc); + ull = __sync_and_and_fetch (&ull, uc); + + sc = __sync_nand_and_fetch (&sc, uc); + uc = __sync_nand_and_fetch (&uc, uc); + ss = __sync_nand_and_fetch (&ss, uc); + us = __sync_nand_and_fetch (&us, uc); + si = __sync_nand_and_fetch (&si, uc); + ui = __sync_nand_and_fetch (&ui, uc); + sl = __sync_nand_and_fetch (&sl, uc); + ul = __sync_nand_and_fetch (&ul, uc); + sll = __sync_nand_and_fetch (&sll, uc); + ull = __sync_nand_and_fetch (&ull, uc); +} + +void test_compare_and_swap (void) +{ + sc = __sync_val_compare_and_swap (&sc, uc, sc); + uc = __sync_val_compare_and_swap (&uc, uc, sc); + ss = __sync_val_compare_and_swap (&ss, uc, sc); + us = __sync_val_compare_and_swap (&us, uc, sc); + si = __sync_val_compare_and_swap (&si, uc, sc); + ui = __sync_val_compare_and_swap (&ui, uc, sc); + sl = __sync_val_compare_and_swap (&sl, uc, sc); + ul = __sync_val_compare_and_swap (&ul, uc, sc); + sll = __sync_val_compare_and_swap (&sll, uc, sc); + ull = __sync_val_compare_and_swap (&ull, uc, sc); + + ui = __sync_bool_compare_and_swap (&sc, uc, sc); + ui = __sync_bool_compare_and_swap (&uc, uc, sc); + ui = __sync_bool_compare_and_swap (&ss, uc, sc); + ui = __sync_bool_compare_and_swap (&us, uc, sc); + ui = __sync_bool_compare_and_swap (&si, uc, sc); + ui = __sync_bool_compare_and_swap (&ui, uc, sc); + ui = __sync_bool_compare_and_swap (&sl, uc, sc); + ui = __sync_bool_compare_and_swap (&ul, uc, sc); + ui = __sync_bool_compare_and_swap (&sll, uc, sc); + ui = __sync_bool_compare_and_swap (&ull, uc, sc); +} + +void test_lock (void) +{ + sc = __sync_lock_test_and_set (&sc, 1); + uc = __sync_lock_test_and_set (&uc, 1); + ss = __sync_lock_test_and_set (&ss, 1); + us = __sync_lock_test_and_set (&us, 1); + si = __sync_lock_test_and_set (&si, 1); + ui = __sync_lock_test_and_set (&ui, 1); + sl = __sync_lock_test_and_set (&sl, 1); + ul = __sync_lock_test_and_set (&ul, 1); + sll = __sync_lock_test_and_set (&sll, 1); + ull = __sync_lock_test_and_set (&ull, 1); + + __sync_synchronize (); + + __sync_lock_release (&sc); + __sync_lock_release (&uc); + __sync_lock_release (&ss); + __sync_lock_release (&us); + __sync_lock_release (&si); + __sync_lock_release (&ui); + __sync_lock_release (&sl); + __sync_lock_release (&ul); + __sync_lock_release (&sll); + __sync_lock_release (&ull); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/sync-2.c b/gcc/testsuite/gcc.c-torture/compile/sync-2.c new file mode 100644 index 000000000..bdc84ef0a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/sync-2.c @@ -0,0 +1,168 @@ +/* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "" { target *-*-* } 0 } */ + +/* Validate that each of the __sync builtins compiles. This won't + necessarily link, since the target might not support the builtin, + so this may result in external library calls. */ + +signed char sc; +unsigned char uc; +signed short ss; +unsigned short us; +signed int si; +unsigned int ui; +signed long sl; +unsigned long ul; +signed long long sll; +unsigned long long ull; + +void test_op_ignore (void) +{ + (void) __sync_fetch_and_add (&sc, -1); + (void) __sync_fetch_and_add (&uc, -1); + (void) __sync_fetch_and_add (&ss, -1); + (void) __sync_fetch_and_add (&us, -1); + (void) __sync_fetch_and_add (&si, -1); + (void) __sync_fetch_and_add (&ui, -1); + (void) __sync_fetch_and_add (&sl, -1); + (void) __sync_fetch_and_add (&ul, -1); + (void) __sync_fetch_and_add (&sll, -1); + (void) __sync_fetch_and_add (&ull, -1); + + (void) __sync_fetch_and_sub (&sc, -1); + (void) __sync_fetch_and_sub (&uc, -1); + (void) __sync_fetch_and_sub (&ss, -1); + (void) __sync_fetch_and_sub (&us, -1); + (void) __sync_fetch_and_sub (&si, -1); + (void) __sync_fetch_and_sub (&ui, -1); + (void) __sync_fetch_and_sub (&sl, -1); + (void) __sync_fetch_and_sub (&ul, -1); + (void) __sync_fetch_and_sub (&sll, -1); + (void) __sync_fetch_and_sub (&ull, -1); + + (void) __sync_fetch_and_or (&sc, -1); + (void) __sync_fetch_and_or (&uc, -1); + (void) __sync_fetch_and_or (&ss, -1); + (void) __sync_fetch_and_or (&us, -1); + (void) __sync_fetch_and_or (&si, -1); + (void) __sync_fetch_and_or (&ui, -1); + (void) __sync_fetch_and_or (&sl, -1); + (void) __sync_fetch_and_or (&ul, -1); + (void) __sync_fetch_and_or (&sll, -1); + (void) __sync_fetch_and_or (&ull, -1); + + (void) __sync_fetch_and_xor (&sc, -1); + (void) __sync_fetch_and_xor (&uc, -1); + (void) __sync_fetch_and_xor (&ss, -1); + (void) __sync_fetch_and_xor (&us, -1); + (void) __sync_fetch_and_xor (&si, -1); + (void) __sync_fetch_and_xor (&ui, -1); + (void) __sync_fetch_and_xor (&sl, -1); + (void) __sync_fetch_and_xor (&ul, -1); + (void) __sync_fetch_and_xor (&sll, -1); + (void) __sync_fetch_and_xor (&ull, -1); + + (void) __sync_fetch_and_and (&sc, -1); + (void) __sync_fetch_and_and (&uc, -1); + (void) __sync_fetch_and_and (&ss, -1); + (void) __sync_fetch_and_and (&us, -1); + (void) __sync_fetch_and_and (&si, -1); + (void) __sync_fetch_and_and (&ui, -1); + (void) __sync_fetch_and_and (&sl, -1); + (void) __sync_fetch_and_and (&ul, -1); + (void) __sync_fetch_and_and (&sll, -1); + (void) __sync_fetch_and_and (&ull, -1); + + (void) __sync_fetch_and_nand (&sc, -1); + (void) __sync_fetch_and_nand (&uc, -1); + (void) __sync_fetch_and_nand (&ss, -1); + (void) __sync_fetch_and_nand (&us, -1); + (void) __sync_fetch_and_nand (&si, -1); + (void) __sync_fetch_and_nand (&ui, -1); + (void) __sync_fetch_and_nand (&sl, -1); + (void) __sync_fetch_and_nand (&ul, -1); + (void) __sync_fetch_and_nand (&sll, -1); + (void) __sync_fetch_and_nand (&ull, -1); +} + +void test_fetch_and_op (void) +{ + sc = __sync_fetch_and_add (&sc, -11); + uc = __sync_fetch_and_add (&uc, -11); + ss = __sync_fetch_and_add (&ss, -11); + us = __sync_fetch_and_add (&us, -11); + si = __sync_fetch_and_add (&si, -11); + ui = __sync_fetch_and_add (&ui, -11); + sl = __sync_fetch_and_add (&sl, -11); + ul = __sync_fetch_and_add (&ul, -11); + sll = __sync_fetch_and_add (&sll, -11); + ull = __sync_fetch_and_add (&ull, -11); + + sc = __sync_fetch_and_sub (&sc, -11); + uc = __sync_fetch_and_sub (&uc, -11); + ss = __sync_fetch_and_sub (&ss, -11); + us = __sync_fetch_and_sub (&us, -11); + si = __sync_fetch_and_sub (&si, -11); + ui = __sync_fetch_and_sub (&ui, -11); + sl = __sync_fetch_and_sub (&sl, -11); + ul = __sync_fetch_and_sub (&ul, -11); + sll = __sync_fetch_and_sub (&sll, -11); + ull = __sync_fetch_and_sub (&ull, -11); + + sc = __sync_fetch_and_or (&sc, -11); + uc = __sync_fetch_and_or (&uc, -11); + ss = __sync_fetch_and_or (&ss, -11); + us = __sync_fetch_and_or (&us, -11); + si = __sync_fetch_and_or (&si, -11); + ui = __sync_fetch_and_or (&ui, -11); + sl = __sync_fetch_and_or (&sl, -11); + ul = __sync_fetch_and_or (&ul, -11); + sll = __sync_fetch_and_or (&sll, -11); + ull = __sync_fetch_and_or (&ull, -11); + + sc = __sync_fetch_and_xor (&sc, -11); + uc = __sync_fetch_and_xor (&uc, -11); + ss = __sync_fetch_and_xor (&ss, -11); + us = __sync_fetch_and_xor (&us, -11); + si = __sync_fetch_and_xor (&si, -11); + ui = __sync_fetch_and_xor (&ui, -11); + sl = __sync_fetch_and_xor (&sl, -11); + ul = __sync_fetch_and_xor (&ul, -11); + sll = __sync_fetch_and_xor (&sll, -11); + ull = __sync_fetch_and_xor (&ull, -11); + + sc = __sync_fetch_and_and (&sc, -11); + uc = __sync_fetch_and_and (&uc, -11); + ss = __sync_fetch_and_and (&ss, -11); + us = __sync_fetch_and_and (&us, -11); + si = __sync_fetch_and_and (&si, -11); + ui = __sync_fetch_and_and (&ui, -11); + sl = __sync_fetch_and_and (&sl, -11); + ul = __sync_fetch_and_and (&ul, -11); + sll = __sync_fetch_and_and (&sll, -11); + ull = __sync_fetch_and_and (&ull, -11); + + sc = __sync_fetch_and_nand (&sc, -11); + uc = __sync_fetch_and_nand (&uc, -11); + ss = __sync_fetch_and_nand (&ss, -11); + us = __sync_fetch_and_nand (&us, -11); + si = __sync_fetch_and_nand (&si, -11); + ui = __sync_fetch_and_nand (&ui, -11); + sl = __sync_fetch_and_nand (&sl, -11); + ul = __sync_fetch_and_nand (&ul, -11); + sll = __sync_fetch_and_nand (&sll, -11); + ull = __sync_fetch_and_nand (&ull, -11); +} + +void test_lock (void) +{ + sc = __sync_lock_test_and_set (&sc, -1); + uc = __sync_lock_test_and_set (&uc, -1); + ss = __sync_lock_test_and_set (&ss, -1); + us = __sync_lock_test_and_set (&us, -1); + si = __sync_lock_test_and_set (&si, -1); + ui = __sync_lock_test_and_set (&ui, -1); + sl = __sync_lock_test_and_set (&sl, -1); + ul = __sync_lock_test_and_set (&ul, -1); + sll = __sync_lock_test_and_set (&sll, -1); + ull = __sync_lock_test_and_set (&ull, -1); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/sync-3.c b/gcc/testsuite/gcc.c-torture/compile/sync-3.c new file mode 100644 index 000000000..9689eea5b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/sync-3.c @@ -0,0 +1,187 @@ +/* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "" { target *-*-* } 0 } */ + +/* Validate that each of the __sync builtins compiles. This won't + necessarily link, since the target might not support the builtin, + so this may result in external library calls. */ + +void test_op_ignore (void) +{ +signed char sc[2]; +unsigned char uc[2]; +signed short ss[2]; +unsigned short us[2]; +signed int si[2]; +unsigned int ui[2]; +signed long sl[2]; +unsigned long ul[2]; +signed long long sll[2]; +unsigned long long ull[2]; + (void) __sync_fetch_and_add (&sc[1], -1); + (void) __sync_fetch_and_add (&uc[1], -1); + (void) __sync_fetch_and_add (&ss[1], -1); + (void) __sync_fetch_and_add (&us[1], -1); + (void) __sync_fetch_and_add (&si[1], -1); + (void) __sync_fetch_and_add (&ui[1], -1); + (void) __sync_fetch_and_add (&sl[1], -1); + (void) __sync_fetch_and_add (&ul[1], -1); + (void) __sync_fetch_and_add (&sll[1], -1); + (void) __sync_fetch_and_add (&ull[1], -1); + + (void) __sync_fetch_and_sub (&sc[1], -1); + (void) __sync_fetch_and_sub (&uc[1], -1); + (void) __sync_fetch_and_sub (&ss[1], -1); + (void) __sync_fetch_and_sub (&us[1], -1); + (void) __sync_fetch_and_sub (&si[1], -1); + (void) __sync_fetch_and_sub (&ui[1], -1); + (void) __sync_fetch_and_sub (&sl[1], -1); + (void) __sync_fetch_and_sub (&ul[1], -1); + (void) __sync_fetch_and_sub (&sll[1], -1); + (void) __sync_fetch_and_sub (&ull[1], -1); + + (void) __sync_fetch_and_or (&sc[1], -1); + (void) __sync_fetch_and_or (&uc[1], -1); + (void) __sync_fetch_and_or (&ss[1], -1); + (void) __sync_fetch_and_or (&us[1], -1); + (void) __sync_fetch_and_or (&si[1], -1); + (void) __sync_fetch_and_or (&ui[1], -1); + (void) __sync_fetch_and_or (&sl[1], -1); + (void) __sync_fetch_and_or (&ul[1], -1); + (void) __sync_fetch_and_or (&sll[1], -1); + (void) __sync_fetch_and_or (&ull[1], -1); + + (void) __sync_fetch_and_xor (&sc[1], -1); + (void) __sync_fetch_and_xor (&uc[1], -1); + (void) __sync_fetch_and_xor (&ss[1], -1); + (void) __sync_fetch_and_xor (&us[1], -1); + (void) __sync_fetch_and_xor (&si[1], -1); + (void) __sync_fetch_and_xor (&ui[1], -1); + (void) __sync_fetch_and_xor (&sl[1], -1); + (void) __sync_fetch_and_xor (&ul[1], -1); + (void) __sync_fetch_and_xor (&sll[1], -1); + (void) __sync_fetch_and_xor (&ull[1], -1); + + (void) __sync_fetch_and_and (&sc[1], -1); + (void) __sync_fetch_and_and (&uc[1], -1); + (void) __sync_fetch_and_and (&ss[1], -1); + (void) __sync_fetch_and_and (&us[1], -1); + (void) __sync_fetch_and_and (&si[1], -1); + (void) __sync_fetch_and_and (&ui[1], -1); + (void) __sync_fetch_and_and (&sl[1], -1); + (void) __sync_fetch_and_and (&ul[1], -1); + (void) __sync_fetch_and_and (&sll[1], -1); + (void) __sync_fetch_and_and (&ull[1], -1); + + (void) __sync_fetch_and_nand (&sc[1], -1); + (void) __sync_fetch_and_nand (&uc[1], -1); + (void) __sync_fetch_and_nand (&ss[1], -1); + (void) __sync_fetch_and_nand (&us[1], -1); + (void) __sync_fetch_and_nand (&si[1], -1); + (void) __sync_fetch_and_nand (&ui[1], -1); + (void) __sync_fetch_and_nand (&sl[1], -1); + (void) __sync_fetch_and_nand (&ul[1], -1); + (void) __sync_fetch_and_nand (&sll[1], -1); + (void) __sync_fetch_and_nand (&ull[1], -1); +} + +void test_fetch_and_op (void) +{ +signed char sc[2]; +unsigned char uc[2]; +signed short ss[2]; +unsigned short us[2]; +signed int si[2]; +unsigned int ui[2]; +signed long sl[2]; +unsigned long ul[2]; +signed long long sll[2]; +unsigned long long ull[2]; + sc[1] = __sync_fetch_and_add (&sc[1], -11); + uc[1] = __sync_fetch_and_add (&uc[1], -11); + ss[1] = __sync_fetch_and_add (&ss[1], -11); + us[1] = __sync_fetch_and_add (&us[1], -11); + si[1] = __sync_fetch_and_add (&si[1], -11); + ui[1] = __sync_fetch_and_add (&ui[1], -11); + sl[1] = __sync_fetch_and_add (&sl[1], -11); + ul[1] = __sync_fetch_and_add (&ul[1], -11); + sll[1] = __sync_fetch_and_add (&sll[1], -11); + ull[1] = __sync_fetch_and_add (&ull[1], -11); + + sc[1] = __sync_fetch_and_sub (&sc[1], -11); + uc[1] = __sync_fetch_and_sub (&uc[1], -11); + ss[1] = __sync_fetch_and_sub (&ss[1], -11); + us[1] = __sync_fetch_and_sub (&us[1], -11); + si[1] = __sync_fetch_and_sub (&si[1], -11); + ui[1] = __sync_fetch_and_sub (&ui[1], -11); + sl[1] = __sync_fetch_and_sub (&sl[1], -11); + ul[1] = __sync_fetch_and_sub (&ul[1], -11); + sll[1] = __sync_fetch_and_sub (&sll[1], -11); + ull[1] = __sync_fetch_and_sub (&ull[1], -11); + + sc[1] = __sync_fetch_and_or (&sc[1], -11); + uc[1] = __sync_fetch_and_or (&uc[1], -11); + ss[1] = __sync_fetch_and_or (&ss[1], -11); + us[1] = __sync_fetch_and_or (&us[1], -11); + si[1] = __sync_fetch_and_or (&si[1], -11); + ui[1] = __sync_fetch_and_or (&ui[1], -11); + sl[1] = __sync_fetch_and_or (&sl[1], -11); + ul[1] = __sync_fetch_and_or (&ul[1], -11); + sll[1] = __sync_fetch_and_or (&sll[1], -11); + ull[1] = __sync_fetch_and_or (&ull[1], -11); + + sc[1] = __sync_fetch_and_xor (&sc[1], -11); + uc[1] = __sync_fetch_and_xor (&uc[1], -11); + ss[1] = __sync_fetch_and_xor (&ss[1], -11); + us[1] = __sync_fetch_and_xor (&us[1], -11); + si[1] = __sync_fetch_and_xor (&si[1], -11); + ui[1] = __sync_fetch_and_xor (&ui[1], -11); + sl[1] = __sync_fetch_and_xor (&sl[1], -11); + ul[1] = __sync_fetch_and_xor (&ul[1], -11); + sll[1] = __sync_fetch_and_xor (&sll[1], -11); + ull[1] = __sync_fetch_and_xor (&ull[1], -11); + + sc[1] = __sync_fetch_and_and (&sc[1], -11); + uc[1] = __sync_fetch_and_and (&uc[1], -11); + ss[1] = __sync_fetch_and_and (&ss[1], -11); + us[1] = __sync_fetch_and_and (&us[1], -11); + si[1] = __sync_fetch_and_and (&si[1], -11); + ui[1] = __sync_fetch_and_and (&ui[1], -11); + sl[1] = __sync_fetch_and_and (&sl[1], -11); + ul[1] = __sync_fetch_and_and (&ul[1], -11); + sll[1] = __sync_fetch_and_and (&sll[1], -11); + ull[1] = __sync_fetch_and_and (&ull[1], -11); + + sc[1] = __sync_fetch_and_nand (&sc[1], -11); + uc[1] = __sync_fetch_and_nand (&uc[1], -11); + ss[1] = __sync_fetch_and_nand (&ss[1], -11); + us[1] = __sync_fetch_and_nand (&us[1], -11); + si[1] = __sync_fetch_and_nand (&si[1], -11); + ui[1] = __sync_fetch_and_nand (&ui[1], -11); + sl[1] = __sync_fetch_and_nand (&sl[1], -11); + ul[1] = __sync_fetch_and_nand (&ul[1], -11); + sll[1] = __sync_fetch_and_nand (&sll[1], -11); + ull[1] = __sync_fetch_and_nand (&ull[1], -11); +} + +void test_lock (void) +{ +signed char sc[2]; +unsigned char uc[2]; +signed short ss[2]; +unsigned short us[2]; +signed int si[2]; +unsigned int ui[2]; +signed long sl[2]; +unsigned long ul[2]; +signed long long sll[2]; +unsigned long long ull[2]; + sc[1] = __sync_lock_test_and_set (&sc[1], -1); + uc[1] = __sync_lock_test_and_set (&uc[1], -1); + ss[1] = __sync_lock_test_and_set (&ss[1], -1); + us[1] = __sync_lock_test_and_set (&us[1], -1); + si[1] = __sync_lock_test_and_set (&si[1], -1); + ui[1] = __sync_lock_test_and_set (&ui[1], -1); + sl[1] = __sync_lock_test_and_set (&sl[1], -1); + ul[1] = __sync_lock_test_and_set (&ul[1], -1); + sll[1] = __sync_lock_test_and_set (&sll[1], -1); + ull[1] = __sync_lock_test_and_set (&ull[1], -1); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/trunctfdf.c b/gcc/testsuite/gcc.c-torture/compile/trunctfdf.c new file mode 100644 index 000000000..29d6ed0dc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/trunctfdf.c @@ -0,0 +1,14 @@ +/* Sparc w/128-bit long double bombed on this because even though + the trunctfdf libcall passed the long double by reference, the + libcall was still marked as LCT_CONST instead of LCT_PURE. */ + +double *copy(long double *first, long double *last, double *result) +{ + int n; + for (n = last - first; n > 0; --n) { + *result = *first; + ++first; + ++result; + } + return result; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/vector-1.c b/gcc/testsuite/gcc.c-torture/compile/vector-1.c new file mode 100644 index 000000000..9be0be19b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/vector-1.c @@ -0,0 +1,12 @@ +/* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */ +#define vector __attribute__((vector_size(16) )) +struct ss +{ + vector float mVec; +}; +float getCapsule(vector int t) +{ + vector float t1 = (vector float)t; + struct ss y = {t1}; + return *((float*)&y.mVec); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/vector-2.c b/gcc/testsuite/gcc.c-torture/compile/vector-2.c new file mode 100644 index 000000000..e04d55588 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/vector-2.c @@ -0,0 +1,13 @@ +/* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */ +#define vector __attribute__((vector_size(16) )) +struct ss +{ + vector float mVec; +}; +vector float getCapsule(vector int t) +{ + vector float t1 = (vector float)t; + struct ss y = {t1}; + *((float*)&y.mVec) = 1.0; + return y.mVec; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/vector-3.c b/gcc/testsuite/gcc.c-torture/compile/vector-3.c new file mode 100644 index 000000000..6b7314881 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/vector-3.c @@ -0,0 +1,7 @@ +#define vector __attribute__((vector_size(16) )) +vector float g(void) +{ + float t = 1.0f; + return (vector float){0.0, 0.0, t, 0.0}; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/vector-4.c b/gcc/testsuite/gcc.c-torture/compile/vector-4.c new file mode 100644 index 000000000..39c808543 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/vector-4.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-mavx" { target { i?86-*-* x86_64-*-* } } } */ + +/* Make sure that vector of size 8 of signed char works. This used to crash with AVX on x86 + as we would produce try to extract the chars inside the vector mode using the vector mode of V8SI + which was wrong. */ +__attribute__ ((vector_size (8))) signed char v4, v5, v6; +void +two (void) +{ + v4 = v5 + v6; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/vector-align-1.c b/gcc/testsuite/gcc.c-torture/compile/vector-align-1.c new file mode 100644 index 000000000..dc97ba6ca --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/vector-align-1.c @@ -0,0 +1,11 @@ +/* Check to make sure the alignment on vectors is not being lost. */ + +/* If some target has a Max alignment less than 128, please create + a #ifdef around the alignment and add your alignment. */ +#define alignment 128 + +char x __attribute__((aligned(alignment),vector_size(2))); + + +int f[__alignof__(x) == alignment?1:-1]; + diff --git a/gcc/testsuite/gcc.c-torture/compile/vla-const-1.c b/gcc/testsuite/gcc.c-torture/compile/vla-const-1.c new file mode 100644 index 000000000..6acc3d830 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/vla-const-1.c @@ -0,0 +1,5 @@ +/* Test TREE_CONSTANT VLA size: bug 27893. */ +/* Origin: Joseph Myers */ +int a; +void g(void *); +void f(void) { int b[(__SIZE_TYPE__)&a]; g(b); } diff --git a/gcc/testsuite/gcc.c-torture/compile/vla-const-2.c b/gcc/testsuite/gcc.c-torture/compile/vla-const-2.c new file mode 100644 index 000000000..913a730b4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/vla-const-2.c @@ -0,0 +1,4 @@ +/* Test TREE_CONSTANT VLA size: bug 27893. */ +/* Origin: Joseph Myers */ +void g(void *); +void f(void) { int b[1/0]; g(b); } diff --git a/gcc/testsuite/gcc.c-torture/compile/volatile-1.c b/gcc/testsuite/gcc.c-torture/compile/volatile-1.c new file mode 100644 index 000000000..cb81274c0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/volatile-1.c @@ -0,0 +1,18 @@ +/* The problem here was that the statements that + loaded from exception.reason where not being + marked as having volatile behaviour which + caused load PRE on the tree level to go + into an infinite loop. */ + +struct gdb_exception +{ + int reason; +}; +int catch_exceptions_with_msg (int *gdberrmsg) +{ + volatile struct gdb_exception exception; + exceptions_state_mc_init (&(exception)); + if (exception.reason != 0) + foo (); + return exception.reason; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/widechar-1.c b/gcc/testsuite/gcc.c-torture/compile/widechar-1.c new file mode 100644 index 000000000..5d89f33a8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/widechar-1.c @@ -0,0 +1 @@ +char *s = L"a" "b"; diff --git a/gcc/testsuite/gcc.c-torture/compile/zero-strct-1.c b/gcc/testsuite/gcc.c-torture/compile/zero-strct-1.c new file mode 100644 index 000000000..d3db81269 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/zero-strct-1.c @@ -0,0 +1,7 @@ +typedef struct { } empty_t; + +f () +{ + empty_t i; + bar (i); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/zero-strct-2.c b/gcc/testsuite/gcc.c-torture/compile/zero-strct-2.c new file mode 100644 index 000000000..0f97f7d12 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/zero-strct-2.c @@ -0,0 +1,2 @@ +struct { } foo = { }; +void * bar(void) { return &foo; } diff --git a/gcc/testsuite/gcc.c-torture/compile/zero-strct-3.c b/gcc/testsuite/gcc.c-torture/compile/zero-strct-3.c new file mode 100644 index 000000000..31bc328d0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/zero-strct-3.c @@ -0,0 +1,12 @@ +typedef struct {} spinlock_t; +struct sk_buff_head { + int i; + spinlock_t lock; +}; +struct sk_buff_head audit_skb_queue; +void audit_init(void) +{ + struct sk_buff_head *list = &audit_skb_queue; + spinlock_t a = {}; + audit_skb_queue.lock = a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/zero-strct-4.c b/gcc/testsuite/gcc.c-torture/compile/zero-strct-4.c new file mode 100644 index 000000000..4a5889f80 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/zero-strct-4.c @@ -0,0 +1,14 @@ +typedef struct {} raw_spinlock_t; +typedef struct { + raw_spinlock_t raw_lock; +} spinlock_t; +struct sk_buff_head { + int i; + spinlock_t lock; +}; +struct sk_buff_head audit_skb_queue; +void audit_init(void) +{ + struct sk_buff_head *list = &audit_skb_queue; + audit_skb_queue.lock = (spinlock_t) { .raw_lock = { } }; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/zero-strct-5.c b/gcc/testsuite/gcc.c-torture/compile/zero-strct-5.c new file mode 100644 index 000000000..2dfbabe40 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/zero-strct-5.c @@ -0,0 +1,14 @@ +/* Check that the inliner does not crash for this testcase. + gimple_expr can change the expr to NULL meaning that we + should not add any statement. */ +struct f {}; +struct g1 {struct f l;}; + +static inline void g(struct f a, int i){} + +void h(void) +{ + struct g1 t; + g(t.l , 1); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20000112-1.c b/gcc/testsuite/gcc.c-torture/execute/20000112-1.c new file mode 100644 index 000000000..080b6627c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000112-1.c @@ -0,0 +1,21 @@ +#include + +static int +special_format (fmt) + const char *fmt; +{ + return (strchr (fmt, '*') != 0 + || strchr (fmt, 'V') != 0 + || strchr (fmt, 'S') != 0 + || strchr (fmt, 'n') != 0); +} + +main() +{ + if (special_format ("ee")) + abort (); + if (!special_format ("*e")) + abort (); + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20000113-1.c b/gcc/testsuite/gcc.c-torture/execute/20000113-1.c new file mode 100644 index 000000000..8b61dbb21 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000113-1.c @@ -0,0 +1,23 @@ +struct x { + unsigned x1:1; + unsigned x2:2; + unsigned x3:3; +}; + +foobar (int x, int y, int z) +{ + struct x a = {x, y, z}; + struct x b = {x, y, z}; + struct x *c = &b; + + c->x3 += (a.x2 - a.x1) * c->x2; + if (a.x1 != 1 || c->x3 != 5) + abort (); + exit (0); +} + +main() +{ + foobar (1, 2, 3); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20000121-1.c b/gcc/testsuite/gcc.c-torture/execute/20000121-1.c new file mode 100644 index 000000000..71f0914d3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000121-1.c @@ -0,0 +1,14 @@ +void big(long long u) { } + +void doit(unsigned int a,unsigned int b,char *id) +{ + big(*id); + big(a); + big(b); +} + +int main(void) +{ + doit(1,1,"\n"); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000205-1.c b/gcc/testsuite/gcc.c-torture/execute/20000205-1.c new file mode 100644 index 000000000..b605b84b6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000205-1.c @@ -0,0 +1,17 @@ +static int f (int a) +{ + if (a == 0) + return 0; + do + if (a & 128) + return 1; + while (f (0)); + return 0; +} + +int main(void) +{ + if (f (~128)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000217-1.c b/gcc/testsuite/gcc.c-torture/execute/20000217-1.c new file mode 100644 index 000000000..42716afbe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000217-1.c @@ -0,0 +1,17 @@ +unsigned short int showbug(unsigned short int *a, unsigned short int *b) +{ + *a += *b -8; + return (*a >= 8); +} + +int main() +{ + unsigned short int x = 0; + unsigned short int y = 10; + + if (showbug(&x, &y) != 0) + abort (); + + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20000223-1.c b/gcc/testsuite/gcc.c-torture/execute/20000223-1.c new file mode 100644 index 000000000..db6180b75 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000223-1.c @@ -0,0 +1,61 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. + Contributed by Nathan Sidwell 23 Feb 2000 */ + +/* __alignof__ should never return a non-power of 2 + eg, sizeof(long double) might be 12, but that means it must be alignable + on a 4 byte boundary. */ + +void check (char const *type, int align) +{ + if ((align & -align) != align) + { + abort (); + } +} + +#define QUOTE_(s) #s +#define QUOTE(s) QUOTE_(s) + +#define check(t) check(QUOTE(t), __alignof__(t)) + +// This struct should have an alignment of the lcm of all the types. If one of +// the base alignments is not a power of two, then A cannot be power of two +// aligned. +struct A +{ + char c; + signed short ss; + unsigned short us; + signed int si; + unsigned int ui; + signed long sl; + unsigned long ul; + signed long long sll; + unsigned long long ull; + float f; + double d; + long double ld; + void *dp; + void (*fp)(); +}; + +int main () +{ + check (void); + check (char); + check (signed short); + check (unsigned short); + check (signed int); + check (unsigned int); + check (signed long); + check (unsigned long); + check (signed long long); + check (unsigned long long); + check (float); + check (double); + check (long double); + check (void *); + check (void (*)()); + check (struct A); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000224-1.c b/gcc/testsuite/gcc.c-torture/execute/20000224-1.c new file mode 100644 index 000000000..295cc473b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000224-1.c @@ -0,0 +1,28 @@ +int loop_1 = 100; +int loop_2 = 7; +int flag = 0; + +int test (void) +{ + int i; + int counter = 0; + + while (loop_1 > counter) { + if (flag & 1) { + for (i = 0; i < loop_2; i++) { + counter++; + } + } + flag++; + } + return 1; +} + +int main() +{ + if (test () != 1) + abort (); + + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20000225-1.c b/gcc/testsuite/gcc.c-torture/execute/20000225-1.c new file mode 100644 index 000000000..6c409bcf7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000225-1.c @@ -0,0 +1,21 @@ +int main () +{ + int nResult; + int b=0; + int i = -1; + + do + { + if (b!=0) { + abort (); + nResult=1; + } else { + nResult=0; + } + i++; + b=(i+2)*4; + } while (i < 0); + exit (0); +} + + diff --git a/gcc/testsuite/gcc.c-torture/execute/20000227-1.c b/gcc/testsuite/gcc.c-torture/execute/20000227-1.c new file mode 100644 index 000000000..395a02c50 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000227-1.c @@ -0,0 +1,15 @@ +static const unsigned char f[] = "\0\377"; +static const unsigned char g[] = "\0ÿ"; + +int main(void) +{ + if (sizeof f != 3 || sizeof g != 3) + abort (); + if (f[0] != g[0]) + abort (); + if (f[1] != g[1]) + abort (); + if (f[2] != g[2]) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000313-1.c b/gcc/testsuite/gcc.c-torture/execute/20000313-1.c new file mode 100644 index 000000000..5c9a5569b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000313-1.c @@ -0,0 +1,20 @@ +unsigned int buggy (unsigned int *param) +{ + unsigned int accu, zero = 0, borrow; + accu = - *param; + borrow = - (accu > zero); + *param += accu; + return borrow; +} + +int main (void) +{ + unsigned int param = 1; + unsigned int borrow = buggy (¶m); + + if (param != 0) + abort (); + if (borrow + 1 != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000314-1.c b/gcc/testsuite/gcc.c-torture/execute/20000314-1.c new file mode 100644 index 000000000..09de09493 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000314-1.c @@ -0,0 +1,17 @@ +int main () +{ + long winds = 0; + + while (winds != 0) + { + if (*(char *) winds) + break; + } + + if (winds == 0 || winds != 0 || *(char *) winds) + exit (0); + + abort (); +} + + diff --git a/gcc/testsuite/gcc.c-torture/execute/20000314-2.c b/gcc/testsuite/gcc.c-torture/execute/20000314-2.c new file mode 100644 index 000000000..c190d8f79 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000314-2.c @@ -0,0 +1,23 @@ +typedef unsigned long long uint64; +const uint64 bigconst = 1ULL << 34; + +int a = 1; + +static +uint64 getmask(void) +{ + if (a) + return bigconst; + else + return 0; +} + +main() +{ + uint64 f = getmask(); + if (sizeof (long long) == 8 + && f != bigconst) abort (); + exit (0); +} + + diff --git a/gcc/testsuite/gcc.c-torture/execute/20000314-3.c b/gcc/testsuite/gcc.c-torture/execute/20000314-3.c new file mode 100644 index 000000000..a141bfa6a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000314-3.c @@ -0,0 +1,42 @@ +extern void abort (void); + +static char arg0[] = "arg0"; +static char arg1[] = "arg1"; + +static void attr_rtx (char *, char *); +static char *attr_string (char *); +static void attr_eq (char *, char *); + +static void +attr_rtx (char *varg0, char *varg1) +{ + if (varg0 != arg0) + abort (); + + if (varg1 != arg1) + abort (); + + return; +} + +static void +attr_eq (name, value) + char *name, *value; +{ + return attr_rtx (attr_string (name), + attr_string (value)); +} + +static char * +attr_string (str) + char *str; +{ + return str; +} + +int main() +{ + attr_eq (arg0, arg1); + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20000402-1.c b/gcc/testsuite/gcc.c-torture/execute/20000402-1.c new file mode 100644 index 000000000..2c9e04fda --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000402-1.c @@ -0,0 +1,33 @@ +#include + +#if ULONG_LONG_MAX != 18446744073709551615ull && ULONG_MAX != 18446744073709551615ull +int main(void) { exit (0); } +#else +#if ULONG_MAX != 18446744073709551615ull +typedef unsigned long long ull; +#else +typedef unsigned long ull; +#endif + +#include + +void checkit(int); + +main () { + const ull a = 0x1400000000ULL; + const ull b = 0x80000000ULL; + const ull c = a/b; + const ull d = 0x1400000000ULL / 0x80000000ULL; + + checkit ((int) c); + checkit ((int) d); + + exit(0); +} + +void checkit (int a) +{ + if (a != 40) + abort(); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/20000403-1.c b/gcc/testsuite/gcc.c-torture/execute/20000403-1.c new file mode 100644 index 000000000..8bcd6f133 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000403-1.c @@ -0,0 +1,29 @@ +extern unsigned long aa[], bb[]; + +int seqgt (unsigned long a, unsigned short win, unsigned long b); + +int seqgt2 (unsigned long a, unsigned short win, unsigned long b); + +main() +{ + if (! seqgt (*aa, 0x1000, *bb) || ! seqgt2 (*aa, 0x1000, *bb)) + abort (); + + exit (0); +} + +int +seqgt (unsigned long a, unsigned short win, unsigned long b) +{ + return (long) ((a + win) - b) > 0; +} + +int +seqgt2 (unsigned long a, unsigned short win, unsigned long b) +{ + long l = ((a + win) - b); + return l > 0; +} + +unsigned long aa[] = { (1UL << (sizeof (long) * 8 - 1)) - 0xfff }; +unsigned long bb[] = { (1UL << (sizeof (long) * 8 - 1)) - 0xfff }; diff --git a/gcc/testsuite/gcc.c-torture/execute/20000412-1.c b/gcc/testsuite/gcc.c-torture/execute/20000412-1.c new file mode 100644 index 000000000..c9f71305d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000412-1.c @@ -0,0 +1,17 @@ +short int i = -1; +const char * const wordlist[207]; + +const char * const * +foo(void) +{ + register const char * const *wordptr = &wordlist[207u + i]; + return wordptr; +} + +int +main() +{ + if (foo() != &wordlist[206]) + abort (); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000412-2.c b/gcc/testsuite/gcc.c-torture/execute/20000412-2.c new file mode 100644 index 000000000..de3ebf9e8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000412-2.c @@ -0,0 +1,16 @@ +int f(int a,int *y) +{ + int x = a; + + if (a==0) + return *y; + + return f(a-1,&x); +} + +int main(int argc,char **argv) +{ + if (f (100, (int *) 0) != 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000412-3.c b/gcc/testsuite/gcc.c-torture/execute/20000412-3.c new file mode 100644 index 000000000..a5cb3eece --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000412-3.c @@ -0,0 +1,32 @@ +typedef struct { + char y; + char x[32]; +} X; + +int z (void) +{ + X xxx; + xxx.x[0] = + xxx.x[31] = '0'; + xxx.y = 0xf; + return f (xxx, xxx); +} + +int main (void) +{ + int val; + + val = z (); + if (val != 0x60) + abort (); + exit (0); +} + +int f(X x, X y) +{ + if (x.y != y.y) + return 'F'; + + return x.x[0] + y.x[0]; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20000412-4.c b/gcc/testsuite/gcc.c-torture/execute/20000412-4.c new file mode 100644 index 000000000..f05b15109 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000412-4.c @@ -0,0 +1,26 @@ + void f(int i, int j, int radius, int width, int N) + { + const int diff = i-radius; + const int lowk = (diff>0 ? diff : 0 ); + int k; + + for(k=lowk; k<= 2; k++){ + int idx = ((k-i+radius)*width-j+radius); + if (idx < 0) + abort (); + } + + for(k=lowk; k<= 2; k++); + } + + + int main(int argc, char **argv) + { + int exc_rad=2; + int N=8; + int i; + for(i=1; i<4; i++) + f(i,1,exc_rad,2*exc_rad + 1, N); + exit (0); + } + diff --git a/gcc/testsuite/gcc.c-torture/execute/20000412-5.c b/gcc/testsuite/gcc.c-torture/execute/20000412-5.c new file mode 100644 index 000000000..c2efb15bc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000412-5.c @@ -0,0 +1,11 @@ +int main( void ) { + struct { + int node; + int type; + } lastglob[1] = { { 0 , 1 } }; + + if (lastglob[0].node != 0 || lastglob[0].type != 1) + abort (); + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20000412-6.c b/gcc/testsuite/gcc.c-torture/execute/20000412-6.c new file mode 100644 index 000000000..98e003051 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000412-6.c @@ -0,0 +1,22 @@ +unsigned bug (unsigned short value, unsigned short *buffer, + unsigned short *bufend); + +unsigned short buf[] = {1, 4, 16, 64, 256}; +int main() +{ + if (bug (512, buf, buf + 3) != 491) + abort (); + + exit (0); +} + +unsigned +bug (unsigned short value, unsigned short *buffer, unsigned short *bufend) +{ + unsigned short *tmp; + + for (tmp = buffer; tmp < bufend; tmp++) + value -= *tmp; + + return value; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000419-1.c b/gcc/testsuite/gcc.c-torture/execute/20000419-1.c new file mode 100644 index 000000000..6127d8b13 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000419-1.c @@ -0,0 +1,22 @@ +struct foo { int a, b, c; }; + +void +brother (int a, int b, int c) +{ + if (a) + abort (); +} + +void +sister (struct foo f, int b, int c) +{ + brother ((f.b == b), b, c); +} + +int +main () +{ + struct foo f = { 7, 8, 9 }; + sister (f, 1, 2); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000422-1.c b/gcc/testsuite/gcc.c-torture/execute/20000422-1.c new file mode 100644 index 000000000..f94d4c5ef --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000422-1.c @@ -0,0 +1,39 @@ +int ops[13] = +{ + 11, 12, 46, 3, 2, 2, 3, 2, 1, 3, 2, 1, 2 +}; + +int correct[13] = +{ + 46, 12, 11, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1 +}; + +int num = 13; + +int main() +{ + int i; + + for (i = 0; i < num; i++) + { + int j; + + for (j = num - 1; j > i; j--) + { + if (ops[j-1] < ops[j]) + { + int op = ops[j]; + ops[j] = ops[j-1]; + ops[j-1] = op; + } + } + } + + + for (i = 0; i < num; i++) + if (ops[i] != correct[i]) + abort (); + + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20000503-1.c b/gcc/testsuite/gcc.c-torture/execute/20000503-1.c new file mode 100644 index 000000000..bbf32623f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000503-1.c @@ -0,0 +1,13 @@ +unsigned long +sub (int a) +{ + return ((0 > a - 2) ? 0 : a - 2) * sizeof (long); +} + +main () +{ + if (sub (0) != 0) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000511-1.c b/gcc/testsuite/gcc.c-torture/execute/20000511-1.c new file mode 100644 index 000000000..b8a41f5e8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000511-1.c @@ -0,0 +1,33 @@ +void f (int value, int expect) +{ + if (value != expect) + abort (); +} + +int main() +{ + int a = 7, b = 6, c = 4, d = 7, e = 2; + + f (a||b%c, 1); + f (a?b%c:0, 2); + f (a=b%c, 2); + f (a*=b%c, 4); + f (a/=b%c, 2); + f (a%=b%c, 0); + f (a+=b%c, 2); + f (d||c&&e, 1); + f (d?c&&e:0, 1); + f (d=c&&e, 1); + f (d*=c&&e, 1); + f (d%=c&&e, 0); + f (d+=c&&e, 1); + f (d-=c&&e, 0); + f (d||c||e, 1); + f (d?c||e:0, 0); + f (d=c||e, 1); + f (d*=c||e, 1); + f (d%=c||e, 0); + f (d+=c||e, 1); + f (d-=c||e, 0); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000519-1.c b/gcc/testsuite/gcc.c-torture/execute/20000519-1.c new file mode 100644 index 000000000..eec5bdd8f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000519-1.c @@ -0,0 +1,30 @@ +#include + +int +bar (int a, va_list ap) +{ + int b; + + do + b = va_arg (ap, int); + while (b > 10); + + return a + b; +} + +int +foo (int a, ...) +{ + va_list ap; + + va_start (ap, a); + return bar (a, ap); +} + +int +main () +{ + if (foo (1, 2, 3) != 3) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000519-2.c b/gcc/testsuite/gcc.c-torture/execute/20000519-2.c new file mode 100644 index 000000000..9635e3242 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000519-2.c @@ -0,0 +1,12 @@ +long x = -1L; + +int main() +{ + long b = (x != -1L); + + if (b) + abort(); + + exit(0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20000523-1.c b/gcc/testsuite/gcc.c-torture/execute/20000523-1.c new file mode 100644 index 000000000..6382ba4a1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000523-1.c @@ -0,0 +1,22 @@ +int +main (void) +{ + long long x; + int n; + + if (sizeof (long long) < 8) + exit (0); + + n = 9; + x = (((long long) n) << 55) / 0xff; + + if (x == 0) + abort (); + + x = (((long long) 9) << 55) / 0xff; + + if (x == 0) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000528-1.c b/gcc/testsuite/gcc.c-torture/execute/20000528-1.c new file mode 100644 index 000000000..20692bf81 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000528-1.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2000 Free Software Foundation */ +/* Contributed by Alexandre Oliva */ + +unsigned long l = (unsigned long)-2; +unsigned short s; + +int main () { + long t = l; + s = t; + if (s != (unsigned short)-2) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000603-1.c b/gcc/testsuite/gcc.c-torture/execute/20000603-1.c new file mode 100644 index 000000000..e94a2c8e6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000603-1.c @@ -0,0 +1,22 @@ +/* It is not clear whether this test is conforming. See DR#236 + http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_236.htm. However, + there seems to be consensus that the presence of a union to aggregate + struct s1 and struct s2 should make it conforming. */ +struct s1 { double d; }; +struct s2 { double d; }; +union u { struct s1 x; struct s2 y; }; + +double f(struct s1 *a, struct s2 *b) +{ + a->d = 1.0; + return b->d + 1.0; +} + +int main() +{ + union u a; + a.x.d = 0.0; + if (f (&a.x, &a.y) != 2.0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000605-1.c b/gcc/testsuite/gcc.c-torture/execute/20000605-1.c new file mode 100644 index 000000000..b481ecb62 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000605-1.c @@ -0,0 +1,48 @@ +typedef struct _RenderInfo RenderInfo; +struct _RenderInfo +{ + int y; + float scaley; + int src_y; +}; + +static void bar(void) { } + +static int +render_image_rgb_a (RenderInfo * info) +{ + int y, ye; + float error; + float step; + + y = info->y; + ye = 256; + + step = 1.0 / info->scaley; + + error = y * step; + error -= ((int) error) - step; + + for (; y < ye; y++) { + if (error >= 1.0) { + info->src_y += (int) error; + error -= (int) error; + bar(); + } + error += step; + } + return info->src_y; +} + +int main (void) +{ + RenderInfo info; + + info.y = 0; + info.src_y = 0; + info.scaley = 1.0; + + if (render_image_rgb_a(&info) != 256) + abort (); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000605-2.c b/gcc/testsuite/gcc.c-torture/execute/20000605-2.c new file mode 100644 index 000000000..8a49bc6da --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000605-2.c @@ -0,0 +1,18 @@ +struct F { int i; }; + +void f1(struct F *x, struct F *y) +{ + int timeout = 0; + for (; ((const struct F*)x)->i < y->i ; x->i++) + if (++timeout > 5) + abort (); +} + +main() +{ + struct F x, y; + x.i = 0; + y.i = 1; + f1 (&x, &y); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000605-3.c b/gcc/testsuite/gcc.c-torture/execute/20000605-3.c new file mode 100644 index 000000000..7ebb27fdb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000605-3.c @@ -0,0 +1,18 @@ +struct F { int x; int y; }; + +int main() +{ + int timeout = 0; + int x = 0; + while (1) + { + const struct F i = { x++, }; + if (i.x > 0) + break; + if (++timeout > 5) + goto die; + } + return 0; + die: + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000622-1.c b/gcc/testsuite/gcc.c-torture/execute/20000622-1.c new file mode 100644 index 000000000..d853ea840 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000622-1.c @@ -0,0 +1,21 @@ +long foo(long a, long b, long c) +{ + if (a != 12 || b != 1 || c != 11) + abort(); + return 0; +} +long bar (long a, long b) +{ + return b; +} +void baz (long a, long b, void *c) +{ + long d; + d = (long)c; + foo(d, bar (a, 1), b); +} +int main() +{ + baz (10, 11, (void *)12); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000703-1.c b/gcc/testsuite/gcc.c-torture/execute/20000703-1.c new file mode 100644 index 000000000..55bdf74df --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000703-1.c @@ -0,0 +1,39 @@ +void abort(void); +void exit(int); +struct baz +{ + char a[17]; + char b[3]; + unsigned int c; + unsigned int d; +}; + +void foo(struct baz *p, unsigned int c, unsigned int d) +{ + __builtin_memcpy (p->b, "abc", 3); + p->c = c; + p->d = d; +} + +void bar(struct baz *p, unsigned int c, unsigned int d) +{ + ({ void *s = (p); + __builtin_memset (s, '\0', sizeof (struct baz)); + s; }); + __builtin_memcpy (p->a, "01234567890123456", 17); + __builtin_memcpy (p->b, "abc", 3); + p->c = c; + p->d = d; +} + +int main() +{ + struct baz p; + foo(&p, 71, 18); + if (p.c != 71 || p.d != 18) + abort(); + bar(&p, 59, 26); + if (p.c != 59 || p.d != 26) + abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000706-1.c b/gcc/testsuite/gcc.c-torture/execute/20000706-1.c new file mode 100644 index 000000000..e8eb28581 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000706-1.c @@ -0,0 +1,31 @@ +extern void abort(void); +extern void exit(int); + +struct baz { + int a, b, c, d, e; +}; + +void bar(struct baz *x, int f, int g, int h, int i, int j) +{ + if (x->a != 1 || x->b != 2 || x->c != 3 || x->d != 4 || x->e != 5 || + f != 6 || g != 7 || h != 8 || i != 9 || j != 10) + abort(); +} + +void foo(struct baz x, char **y) +{ + bar(&x,6,7,8,9,10); +} + +int main() +{ + struct baz x; + + x.a = 1; + x.b = 2; + x.c = 3; + x.d = 4; + x.e = 5; + foo(x,(char **)0); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000706-2.c b/gcc/testsuite/gcc.c-torture/execute/20000706-2.c new file mode 100644 index 000000000..faf213711 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000706-2.c @@ -0,0 +1,31 @@ +extern void abort(void); +extern void exit(int); + +struct baz { + int a, b, c, d, e; +}; + +void bar(struct baz *x, int f, int g, int h, int i, int j) +{ + if (x->a != 1 || x->b != 2 || x->c != 3 || x->d != 4 || x->e != 5 || + f != 6 || g != 7 || h != 8 || i != 9 || j != 10) + abort(); +} + +void foo(char *z, struct baz x, char *y) +{ + bar(&x,6,7,8,9,10); +} + +int main() +{ + struct baz x; + + x.a = 1; + x.b = 2; + x.c = 3; + x.d = 4; + x.e = 5; + foo((char *)0,x,(char *)0); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000706-3.c b/gcc/testsuite/gcc.c-torture/execute/20000706-3.c new file mode 100644 index 000000000..b5758d9ab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000706-3.c @@ -0,0 +1,27 @@ +extern void abort(void); +extern void exit(int); + +int c; + +void baz(int *p) +{ + c = *p; +} + +void bar(int b) +{ + if (c != 1 || b != 2) + abort(); +} + +void foo(int a, int b) +{ + baz(&a); + bar(b); +} + +int main() +{ + foo(1, 2); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000706-4.c b/gcc/testsuite/gcc.c-torture/execute/20000706-4.c new file mode 100644 index 000000000..01cc879c3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000706-4.c @@ -0,0 +1,22 @@ +extern void abort(void); +extern void exit(int); + +int *c; + +void bar(int b) +{ + if (*c != 1 || b != 2) + abort(); +} + +void foo(int a, int b) +{ + c = &a; + bar(b); +} + +int main() +{ + foo(1, 2); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000706-5.c b/gcc/testsuite/gcc.c-torture/execute/20000706-5.c new file mode 100644 index 000000000..18756f29d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000706-5.c @@ -0,0 +1,28 @@ +extern void abort(void); +extern void exit(int); + +struct baz { int a, b, c; }; + +struct baz *c; + +void bar(int b) +{ + if (c->a != 1 || c->b != 2 || c->c != 3 || b != 4) + abort(); +} + +void foo(struct baz a, int b) +{ + c = &a; + bar(b); +} + +int main() +{ + struct baz a; + a.a = 1; + a.b = 2; + a.c = 3; + foo(a, 4); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000707-1.c b/gcc/testsuite/gcc.c-torture/execute/20000707-1.c new file mode 100644 index 000000000..f1c50a923 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000707-1.c @@ -0,0 +1,27 @@ +extern void abort(void); +extern void exit(int); + +struct baz { + int a, b, c; +}; + +void +foo (int a, int b, int c) +{ + if (a != 4) + abort (); +} + +void +bar (struct baz x, int b, int c) +{ + foo (x.b, b, c); +} + +int +main () +{ + struct baz x = { 3, 4, 5 }; + bar (x, 1, 2); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000715-1.c b/gcc/testsuite/gcc.c-torture/execute/20000715-1.c new file mode 100644 index 000000000..43af11480 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000715-1.c @@ -0,0 +1,118 @@ +void abort(void); +void exit(int); + +void +test1(void) +{ + int x = 3, y = 2; + + if ((x < y ? x++ : y++) != 2) + abort (); + + if (x != 3) + abort (); + + if (y != 3) + abort (); +} + +void +test2(void) +{ + int x = 3, y = 2, z; + + z = (x < y) ? x++ : y++; + if (z != 2) + abort (); + + if (x != 3) + abort (); + + if (y != 3) + abort (); +} + +void +test3(void) +{ + int x = 3, y = 2; + int xx = 3, yy = 2; + + if ((xx < yy ? x++ : y++) != 2) + abort (); + + if (x != 3) + abort (); + + if (y != 3) + abort (); +} + +int x, y; + +static void +init_xy(void) +{ + x = 3; + y = 2; +} + +void +test4(void) +{ + init_xy(); + if ((x < y ? x++ : y++) != 2) + abort (); + + if (x != 3) + abort (); + + if (y != 3) + abort (); +} + +void +test5(void) +{ + int z; + + init_xy(); + z = (x < y) ? x++ : y++; + if (z != 2) + abort (); + + if (x != 3) + abort (); + + if (y != 3) + abort (); +} + +void +test6(void) +{ + int xx = 3, yy = 2; + int z; + + init_xy(); + z = (xx < y) ? x++ : y++; + if (z != 2) + abort (); + + if (x != 3) + abort (); + + if (y != 3) + abort (); +} + +int +main(){ + test1 (); + test2 (); + test3 (); + test4 (); + test5 (); + test6 (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000715-2.c b/gcc/testsuite/gcc.c-torture/execute/20000715-2.c new file mode 100644 index 000000000..bfee0c369 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000715-2.c @@ -0,0 +1,14 @@ +extern void abort(void); +extern void exit(int); + +unsigned int foo(unsigned int a) +{ + return ((unsigned char)(a + 1)) * 4; +} + +int main(void) +{ + if (foo((unsigned char)~0)) + abort (); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000717-1.c b/gcc/testsuite/gcc.c-torture/execute/20000717-1.c new file mode 100644 index 000000000..039ae5f34 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000717-1.c @@ -0,0 +1,22 @@ +typedef struct trio { int a, b, c; } trio; + +int +bar (int i, trio t) +{ + if (t.a == t.b || t.a == t.c) + abort (); +} + +int +foo (trio t, int i) +{ + return bar (i, t); +} + +main () +{ + trio t = { 1, 2, 3 }; + + foo (t, 4); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000717-2.c b/gcc/testsuite/gcc.c-torture/execute/20000717-2.c new file mode 100644 index 000000000..4db9032ec --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000717-2.c @@ -0,0 +1,11 @@ +static void +compare (long long foo) +{ + if (foo < 4294967297LL) + abort(); +} +int main(void) +{ + compare (8589934591LL); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000717-3.c b/gcc/testsuite/gcc.c-torture/execute/20000717-3.c new file mode 100644 index 000000000..e87d00b00 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000717-3.c @@ -0,0 +1,26 @@ +int c = -1; + +foo (p) + int *p; +{ + int x; + int a; + + a = p[0]; + x = a + 5; + a = c; + p[0] = x - 15; + return a; +} + +int main() +{ + int b = 1; + int a = foo(&b); + + if (a != -1 || b != (1 + 5 - 15)) + abort (); + + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20000717-4.c b/gcc/testsuite/gcc.c-torture/execute/20000717-4.c new file mode 100644 index 000000000..c3d27bbac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000717-4.c @@ -0,0 +1,26 @@ +/* Extracted from gas. Incorrectly generated non-pic code at -O0 for + IA-64, which produces linker errors on some operating systems. */ + +struct +{ + int offset; + struct slot + { + int field[6]; + } + slot[4]; +} s; + +int +x () +{ + int toggle = 0; + int r = s.slot[0].field[!toggle]; + return r; +} + +int +main () +{ + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000717-5.c b/gcc/testsuite/gcc.c-torture/execute/20000717-5.c new file mode 100644 index 000000000..49dcbbc66 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000717-5.c @@ -0,0 +1,23 @@ +typedef struct trio { int a, b, c; } trio; + +int +bar (int i, int j, int k, trio t) +{ + if (t.a != 1 || t.b != 2 || t.c != 3 || + i != 4 || j != 5 || k != 6) + abort (); +} + +int +foo (trio t, int i, int j, int k) +{ + return bar (i, j, k, t); +} + +main () +{ + trio t = { 1, 2, 3 }; + + foo (t, 4, 5, 6); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000722-1.c b/gcc/testsuite/gcc.c-torture/execute/20000722-1.c new file mode 100644 index 000000000..0ce319179 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000722-1.c @@ -0,0 +1,24 @@ +struct s { char *p; int t; }; + +extern void bar (void); +extern void foo (struct s *); + +int main(void) +{ + bar (); + bar (); + exit (0); +} + +void +bar (void) +{ + foo (& (struct s) { "hi", 1 }); +} + +void foo (struct s *p) +{ + if (p->t != 1) + abort(); + p->t = 2; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000726-1.c b/gcc/testsuite/gcc.c-torture/execute/20000726-1.c new file mode 100644 index 000000000..b0ecd29f3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000726-1.c @@ -0,0 +1,31 @@ +void adjust_xy (short *, short *); + +struct adjust_template +{ + short kx_x; + short kx_y; + short kx; + short kz; +}; + +static struct adjust_template adjust = {0, 0, 1, 1}; + +main () +{ + short x = 1, y = 1; + + adjust_xy (&x, &y); + + if (x != 1) + abort (); + + exit (0); +} + +void +adjust_xy (x, y) + short *x; + short *y; +{ + *x = adjust.kx_x * *x + adjust.kx_y * *y + adjust.kx; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000731-1.c b/gcc/testsuite/gcc.c-torture/execute/20000731-1.c new file mode 100644 index 000000000..787c29a3b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000731-1.c @@ -0,0 +1,24 @@ +double +foo (void) +{ + return 0.0; +} + +void +do_sibcall (void) +{ + (void) foo (); +} + +int +main (void) +{ + double x; + + for (x = 0; x < 20; x++) + do_sibcall (); + if (!(x >= 10)) + abort (); + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20000731-2.c b/gcc/testsuite/gcc.c-torture/execute/20000731-2.c new file mode 100644 index 000000000..112aa1c3a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000731-2.c @@ -0,0 +1,16 @@ +int +main() +{ + int i = 1; + int j = 0; + + while (i != 1024 || j <= 0) { + i *= 2; + ++ j; + } + + if (j != 10) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000801-1.c b/gcc/testsuite/gcc.c-torture/execute/20000801-1.c new file mode 100644 index 000000000..1bc386ea2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000801-1.c @@ -0,0 +1,39 @@ +extern void abort(void); +extern void exit(int); + +void +foo (char *bp, unsigned n) +{ + register char c; + register char *ep = bp + n; + register char *sp; + + while (bp < ep) + { + sp = bp + 3; + c = *sp; + *sp = *bp; + *bp++ = c; + sp = bp + 1; + c = *sp; + *sp = *bp; + *bp++ = c; + bp += 2; + } +} + +int main(void) +{ + int one = 1; + + if (sizeof(int) != 4 * sizeof(char)) + exit(0); + + foo((char *)&one, sizeof(one)); + foo((char *)&one, sizeof(one)); + + if (one != 1) + abort(); + + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000801-2.c b/gcc/testsuite/gcc.c-torture/execute/20000801-2.c new file mode 100644 index 000000000..5bb17b5db --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000801-2.c @@ -0,0 +1,40 @@ +extern void abort(void); +extern void exit(int); +int bar(void); +int baz(void); + +struct foo { + struct foo *next; +}; + +struct foo *test(struct foo *node) +{ + while (node) { + if (bar() && !baz()) + break; + node = node->next; + } + return node; +} + +int bar (void) +{ + return 0; +} + +int baz (void) +{ + return 0; +} + +int main(void) +{ + struct foo a, b, *c; + + a.next = &b; + b.next = (struct foo *)0; + c = test(&a); + if (c) + abort(); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000801-3.c b/gcc/testsuite/gcc.c-torture/execute/20000801-3.c new file mode 100644 index 000000000..8d47a8155 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000801-3.c @@ -0,0 +1,24 @@ +/* Origin: PR c/92 from Simon Marlow , adapted + to a testcase by Joseph Myers . +*/ + +typedef struct { } empty; + +typedef struct { + int i; + empty e; + int i2; +} st; + +st s = { .i = 0, .i2 = 1 }; + +extern void abort (void); + +int +main (void) +{ + if (s.i2 == 1) + exit (0); + else + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000801-4.c b/gcc/testsuite/gcc.c-torture/execute/20000801-4.c new file mode 100644 index 000000000..d293f05c4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000801-4.c @@ -0,0 +1,30 @@ +/* Origin: PR c/128 from Martin Sebor , adapted + as a testcase by Joseph Myers . +*/ +/* Character arrays initialized by a string literal must have + uninitialized elements zeroed. This isn't clear in the 1990 + standard, but was fixed in TC2 and C99; see DRs #060, #092. +*/ +extern void abort (void); + +int +foo (void) +{ + char s[2] = ""; + return 0 == s[1]; +} + +char *t; + +int +main (void) +{ + { + char s[] = "x"; + t = s; + } + if (foo ()) + exit (0); + else + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000808-1.c b/gcc/testsuite/gcc.c-torture/execute/20000808-1.c new file mode 100644 index 000000000..a905aad96 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000808-1.c @@ -0,0 +1,56 @@ +typedef struct { + long int p_x, p_y; +} Point; + +void +bar () +{ +} + +void +f (p0, p1, p2, p3, p4, p5) + Point p0, p1, p2, p3, p4, p5; +{ + if (p0.p_x != 0 || p0.p_y != 1 + || p1.p_x != -1 || p1.p_y != 0 + || p2.p_x != 1 || p2.p_y != -1 + || p3.p_x != -1 || p3.p_y != 1 + || p4.p_x != 0 || p4.p_y != -1 + || p5.p_x != 1 || p5.p_y != 0) + abort (); +} + +void +foo () +{ + Point p0, p1, p2, p3, p4, p5; + + bar(); + + p0.p_x = 0; + p0.p_y = 1; + + p1.p_x = -1; + p1.p_y = 0; + + p2.p_x = 1; + p2.p_y = -1; + + p3.p_x = -1; + p3.p_y = 1; + + p4.p_x = 0; + p4.p_y = -1; + + p5.p_x = 1; + p5.p_y = 0; + + f (p0, p1, p2, p3, p4, p5); +} + +int +main() +{ + foo(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000815-1.c b/gcc/testsuite/gcc.c-torture/execute/20000815-1.c new file mode 100644 index 000000000..22b537f99 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000815-1.c @@ -0,0 +1,70 @@ +struct table_elt +{ + void *exp; + struct table_elt *next_same_hash; + struct table_elt *prev_same_hash; + struct table_elt *next_same_value; + struct table_elt *prev_same_value; + struct table_elt *first_same_value; + struct table_elt *related_value; + int cost; + int mode; + char in_memory; + char in_struct; + char is_const; + char flag; +}; + +struct write_data +{ + int sp : 1; + int var : 1; + int nonscalar : 1; + int all : 1; +}; + +int cse_rtx_addr_varies_p(void *); +void remove_from_table(struct table_elt *, int); +static struct table_elt *table[32]; + +void +invalidate_memory (writes) + struct write_data *writes; +{ + register int i; + register struct table_elt *p, *next; + int all = writes->all; + int nonscalar = writes->nonscalar; + + for (i = 0; i < 31; i++) + for (p = table[i]; p; p = next) + { + next = p->next_same_hash; + if (p->in_memory + && (all + || (nonscalar && p->in_struct) + || cse_rtx_addr_varies_p (p->exp))) + remove_from_table (p, i); + } +} + +int cse_rtx_addr_varies_p(void *x) { return 0; } +void remove_from_table(struct table_elt *x, int y) { abort (); } + +int +main() +{ + struct write_data writes; + struct table_elt elt; + + __builtin_memset(&elt, 0, sizeof(elt)); + elt.in_memory = 1; + table[0] = &elt; + + __builtin_memset(&writes, 0, sizeof(writes)); + writes.var = 1; + writes.nonscalar = 1; + + invalidate_memory(&writes); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000818-1.c b/gcc/testsuite/gcc.c-torture/execute/20000818-1.c new file mode 100644 index 000000000..0067644bd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000818-1.c @@ -0,0 +1,60 @@ +/* Copyright (C) 2000 Free Software Foundation. + + by Manfred Hollstein */ + +void *temporary_obstack; + +static int input (void); +static int ISALNUM (int ch); +static void obstack_1grow (void **ptr, int ch); + +int yylex (void); +int main (void); + +int main (void) +{ + int ch = yylex (); + + exit (0); +} + +int yylex (void) +{ + int ch; + +#ifndef WORK_AROUND + for (;;) + { + ch = input (); + if (ISALNUM (ch)) + obstack_1grow (&temporary_obstack, ch); + else if (ch != '_') + break; + } +#else + do + { + ch = input (); + if (ISALNUM (ch)) + obstack_1grow (&temporary_obstack, ch); + } while (ch == '_'); +#endif + + return ch; +} + +static int input (void) +{ + return 0; +} + +static int ISALNUM (int ch) +{ + return ((ch >= 'A' && ch <= 'Z') + || (ch >= 'a' && ch <= 'z') + || (ch >= '0' && ch <= '0')); +} + +static void obstack_1grow (void **ptr, int ch) +{ +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000819-1.c b/gcc/testsuite/gcc.c-torture/execute/20000819-1.c new file mode 100644 index 000000000..e1c2769c0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000819-1.c @@ -0,0 +1,17 @@ +int a[2] = { 2, 0 }; + +void foo(int *sp, int cnt) +{ + int *p, *top; + + top = sp; sp -= cnt; + + for(p = sp; p <= top; p++) + if (*p < 2) exit(0); +} + +int main() +{ + foo(a + 1, 1); + abort(); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000822-1.c b/gcc/testsuite/gcc.c-torture/execute/20000822-1.c new file mode 100644 index 000000000..f4a084b33 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000822-1.c @@ -0,0 +1,28 @@ +#ifndef NO_TRAMPOLINES +int f0(int (*fn)(int *), int *p) +{ + return (*fn) (p); +} + +int f1(void) +{ + int i = 0; + + int f2(int *p) + { + i = 1; + return *p + 1; + } + + return f0(f2, &i); +} +#endif + +int main() +{ +#ifndef NO_TRAMPOLINES + if (f1() != 2) + abort (); +#endif + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000910-1.c b/gcc/testsuite/gcc.c-torture/execute/20000910-1.c new file mode 100644 index 000000000..0c3c602dd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000910-1.c @@ -0,0 +1,27 @@ +/* Copyright (C) 2000 Free Software Foundation */ +/* by Alexandre Oliva */ + +#include + +void bar (int); +void foo (int *); + +int main () { + static int a[] = { 0, 1, 2 }; + int *i = &a[sizeof(a)/sizeof(*a)]; + + while (i-- > a) + foo (i); + + exit (0); +} + +void baz (int, int); + +void bar (int i) { baz (i, i); } +void foo (int *i) { bar (*i); } + +void baz (int i, int j) { + if (i != j) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000910-2.c b/gcc/testsuite/gcc.c-torture/execute/20000910-2.c new file mode 100644 index 000000000..0023d2451 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000910-2.c @@ -0,0 +1,28 @@ +/* Copyright (C) 2000 Free Software Foundation */ +/* by Alexandre Oliva */ + +#include +#include + +char *list[] = { "*", "e" }; + +static int bar (const char *fmt) { + return (strchr (fmt, '*') != 0); +} + +static void foo () { + int i; + for (i = 0; i < sizeof (list) / sizeof (*list); i++) { + const char *fmt = list[i]; + if (bar (fmt)) + continue; + if (i == 0) + abort (); + else + exit (0); + } +} + +int main () { + foo (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000914-1.c b/gcc/testsuite/gcc.c-torture/execute/20000914-1.c new file mode 100644 index 000000000..1e8bb0ce7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000914-1.c @@ -0,0 +1,292 @@ +extern void *malloc(__SIZE_TYPE__); + +enum tree_code { +ERROR_MARK, +IDENTIFIER_NODE, +OP_IDENTIFIER, +TREE_LIST, +TREE_VEC, +BLOCK, +VOID_TYPE, +INTEGER_TYPE, +REAL_TYPE, +COMPLEX_TYPE, +VECTOR_TYPE, +ENUMERAL_TYPE, +BOOLEAN_TYPE, +CHAR_TYPE, +POINTER_TYPE, +OFFSET_TYPE, +REFERENCE_TYPE, +METHOD_TYPE, +FILE_TYPE, +ARRAY_TYPE, +SET_TYPE, +RECORD_TYPE, +UNION_TYPE, +QUAL_UNION_TYPE, +FUNCTION_TYPE, +LANG_TYPE, +INTEGER_CST, +REAL_CST, +COMPLEX_CST, +STRING_CST, +FUNCTION_DECL, +LABEL_DECL, +CONST_DECL, +TYPE_DECL, +VAR_DECL, +PARM_DECL, +RESULT_DECL, +FIELD_DECL, +NAMESPACE_DECL, +COMPONENT_REF, +BIT_FIELD_REF, +INDIRECT_REF, +BUFFER_REF, +ARRAY_REF, +CONSTRUCTOR, +COMPOUND_EXPR, +MODIFY_EXPR, +INIT_EXPR, +TARGET_EXPR, +COND_EXPR, +BIND_EXPR, +CALL_EXPR, +METHOD_CALL_EXPR, +WITH_CLEANUP_EXPR, +CLEANUP_POINT_EXPR, +PLACEHOLDER_EXPR, +WITH_RECORD_EXPR, +PLUS_EXPR, +MINUS_EXPR, +MULT_EXPR, +TRUNC_DIV_EXPR, +CEIL_DIV_EXPR, +FLOOR_DIV_EXPR, +ROUND_DIV_EXPR, +TRUNC_MOD_EXPR, +CEIL_MOD_EXPR, +FLOOR_MOD_EXPR, +ROUND_MOD_EXPR, +RDIV_EXPR, +EXACT_DIV_EXPR, +FIX_TRUNC_EXPR, +FIX_CEIL_EXPR, +FIX_FLOOR_EXPR, +FIX_ROUND_EXPR, +FLOAT_EXPR, +EXPON_EXPR, +NEGATE_EXPR, +MIN_EXPR, +MAX_EXPR, +ABS_EXPR, +FFS_EXPR, +LSHIFT_EXPR, +RSHIFT_EXPR, +LROTATE_EXPR, +RROTATE_EXPR, +BIT_IOR_EXPR, +BIT_XOR_EXPR, +BIT_AND_EXPR, +BIT_ANDTC_EXPR, +BIT_NOT_EXPR, +TRUTH_ANDIF_EXPR, +TRUTH_ORIF_EXPR, +TRUTH_AND_EXPR, +TRUTH_OR_EXPR, +TRUTH_XOR_EXPR, +TRUTH_NOT_EXPR, +LT_EXPR, +LE_EXPR, +GT_EXPR, +GE_EXPR, +EQ_EXPR, +NE_EXPR, +UNORDERED_EXPR, +ORDERED_EXPR, +UNLT_EXPR, +UNLE_EXPR, +UNGT_EXPR, +UNGE_EXPR, +UNEQ_EXPR, +IN_EXPR, +SET_LE_EXPR, +CARD_EXPR, +RANGE_EXPR, +CONVERT_EXPR, +NOP_EXPR, +NON_LVALUE_EXPR, +SAVE_EXPR, +UNSAVE_EXPR, +RTL_EXPR, +ADDR_EXPR, +REFERENCE_EXPR, +ENTRY_VALUE_EXPR, +COMPLEX_EXPR, +CONJ_EXPR, +REALPART_EXPR, +IMAGPART_EXPR, +PREDECREMENT_EXPR, +PREINCREMENT_EXPR, +POSTDECREMENT_EXPR, +POSTINCREMENT_EXPR, +VA_ARG_EXPR, +TRY_CATCH_EXPR, +TRY_FINALLY_EXPR, +GOTO_SUBROUTINE_EXPR, +POPDHC_EXPR, +POPDCC_EXPR, +LABEL_EXPR, +GOTO_EXPR, +RETURN_EXPR, +EXIT_EXPR, +LOOP_EXPR, +LABELED_BLOCK_EXPR, +EXIT_BLOCK_EXPR, +EXPR_WITH_FILE_LOCATION, +SWITCH_EXPR, + LAST_AND_UNUSED_TREE_CODE +}; +typedef union tree_node *tree; +struct tree_common +{ + union tree_node *chain; + union tree_node *type; + enum tree_code code : 8; + unsigned side_effects_flag : 1; + unsigned constant_flag : 1; + unsigned permanent_flag : 1; + unsigned addressable_flag : 1; + unsigned volatile_flag : 1; + unsigned readonly_flag : 1; + unsigned unsigned_flag : 1; + unsigned asm_written_flag: 1; + unsigned used_flag : 1; + unsigned nothrow_flag : 1; + unsigned static_flag : 1; + unsigned public_flag : 1; + unsigned private_flag : 1; + unsigned protected_flag : 1; + unsigned bounded_flag : 1; + unsigned lang_flag_0 : 1; + unsigned lang_flag_1 : 1; + unsigned lang_flag_2 : 1; + unsigned lang_flag_3 : 1; + unsigned lang_flag_4 : 1; + unsigned lang_flag_5 : 1; + unsigned lang_flag_6 : 1; +}; +union tree_node +{ + struct tree_common common; + }; +enum c_tree_code { + C_DUMMY_TREE_CODE = LAST_AND_UNUSED_TREE_CODE, +SRCLOC, +SIZEOF_EXPR, +ARROW_EXPR, +ALIGNOF_EXPR, +EXPR_STMT, +COMPOUND_STMT, +DECL_STMT, +IF_STMT, +FOR_STMT, +WHILE_STMT, +DO_STMT, +RETURN_STMT, +BREAK_STMT, +CONTINUE_STMT, +SWITCH_STMT, +GOTO_STMT, +LABEL_STMT, +ASM_STMT, +SCOPE_STMT, +CASE_LABEL, +STMT_EXPR, + LAST_C_TREE_CODE +}; +enum cplus_tree_code { + CP_DUMMY_TREE_CODE = LAST_C_TREE_CODE, +OFFSET_REF, +PTRMEM_CST, +NEW_EXPR, +VEC_NEW_EXPR, +DELETE_EXPR, +VEC_DELETE_EXPR, +SCOPE_REF, +MEMBER_REF, +TYPE_EXPR, +AGGR_INIT_EXPR, +THROW_EXPR, +EMPTY_CLASS_EXPR, +TEMPLATE_DECL, +TEMPLATE_PARM_INDEX, +TEMPLATE_TYPE_PARM, +TEMPLATE_TEMPLATE_PARM, +BOUND_TEMPLATE_TEMPLATE_PARM, +TYPENAME_TYPE, +TYPEOF_TYPE, +USING_DECL, +DEFAULT_ARG, +TEMPLATE_ID_EXPR, +CPLUS_BINDING, +OVERLOAD, +WRAPPER, +LOOKUP_EXPR, +FUNCTION_NAME, +MODOP_EXPR, +CAST_EXPR, +REINTERPRET_CAST_EXPR, +CONST_CAST_EXPR, +STATIC_CAST_EXPR, +DYNAMIC_CAST_EXPR, +DOTSTAR_EXPR, +TYPEID_EXPR, +PSEUDO_DTOR_EXPR, +SUBOBJECT, +CTOR_STMT, +CLEANUP_STMT, +START_CATCH_STMT, +CTOR_INITIALIZER, +RETURN_INIT, +TRY_BLOCK, +HANDLER, +TAG_DEFN, +IDENTITY_CONV, +LVALUE_CONV, +QUAL_CONV, +STD_CONV, +PTR_CONV, +PMEM_CONV, +BASE_CONV, +REF_BIND, +USER_CONV, +AMBIG_CONV, +RVALUE_CONV, + LAST_CPLUS_TREE_CODE +}; + +blah(){} + +convert_like_real (convs) + tree convs; +{ + switch (((enum tree_code) (convs)->common.code)) + { + case AMBIG_CONV: + return blah(); + default: + break; + }; + abort (); +} + +main() +{ + tree convs = (void *)malloc (sizeof (struct tree_common));; + + convs->common.code = AMBIG_CONV; + convert_like_real (convs); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20000917-1.c b/gcc/testsuite/gcc.c-torture/execute/20000917-1.c new file mode 100644 index 000000000..05b00ffe6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20000917-1.c @@ -0,0 +1,42 @@ +/* This bug exists in gcc-2.95, egcs-1.1.2, gcc-2.7.2 and probably + every other version as well. */ + +typedef struct int3 { int a, b, c; } int3; + +int3 +one (void) +{ + return (int3) { 1, 1, 1 }; +} + +int3 +zero (void) +{ + return (int3) { 0, 0, 0 }; +} + +int +main (void) +{ + int3 a; + + /* gcc allocates a temporary for the inner expression statement + to store the return value of `one'. + + gcc frees the temporaries for the inner expression statement. + + gcc realloates the same temporary slot to store the return + value of `zero'. + + gcc expands the call to zero ahead of the expansion of the + statement expressions. The temporary gets the value of `zero'. + + gcc expands statement expressions and the stale temporary is + clobbered with the value of `one'. The bad value is copied from + the temporary into *&a. */ + + *({ ({ one (); &a; }); }) = zero (); + if (a.a && a.b && a.c) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20001009-1.c b/gcc/testsuite/gcc.c-torture/execute/20001009-1.c new file mode 100644 index 000000000..aa691cab2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20001009-1.c @@ -0,0 +1,12 @@ +int a,b; +main() +{ + int c=-2; + int d=0xfe; + int e=a&1; + int f=b&2; + if ((char)(c|(e&f)) == (char)d) + return 0; + else + abort(); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20001009-2.c b/gcc/testsuite/gcc.c-torture/execute/20001009-2.c new file mode 100644 index 000000000..eedc299fb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20001009-2.c @@ -0,0 +1,21 @@ +int b=1; +int foo() +{ + int a; + int c; + a=0xff; + for (;b;b--) + { + c=1; + asm(""::"r"(c)); + c=(signed char)a; + } + if (c!=-1) + abort(); + return c; +} +int main() +{ + foo(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20001011-1.c b/gcc/testsuite/gcc.c-torture/execute/20001011-1.c new file mode 100644 index 000000000..ffdcb9f52 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20001011-1.c @@ -0,0 +1,14 @@ +extern void abort(void); +extern int strcmp(const char *, const char *); + +int foo(const char *a) +{ + return strcmp(a, "main"); +} + +int main(void) +{ + if(foo(__FUNCTION__)) + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20001013-1.c b/gcc/testsuite/gcc.c-torture/execute/20001013-1.c new file mode 100644 index 000000000..0d139fc80 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20001013-1.c @@ -0,0 +1,17 @@ +struct x { + int a, b; +} z = { -4028, 4096 }; + +int foo(struct x *p, int y) +{ + if ((y & 0xff) != y || -p->b >= p->a) + return 1; + return 0; +} + +main() +{ + if (foo (&z, 10)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20001017-1.c b/gcc/testsuite/gcc.c-torture/execute/20001017-1.c new file mode 100644 index 000000000..f55886f4a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20001017-1.c @@ -0,0 +1,17 @@ + +void bug (double *Cref, char transb, int m, int n, int k, + double a, double *A, int fdA, double *B, int fdB, + double b, double *C, int fdC) +{ + if (C != Cref) abort (); +} + +int main (void) +{ + double A[1], B[1], C[1]; + + bug (C, 'B', 1, 2, 3, 4.0, A, 5, B, 6, 7.0, C, 8); + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20001017-2.c b/gcc/testsuite/gcc.c-torture/execute/20001017-2.c new file mode 100644 index 000000000..3263bb9b5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20001017-2.c @@ -0,0 +1,17 @@ +void +fn_4parms (unsigned char a, long *b, long *c, unsigned int *d) +{ + if (*b != 1 || *c != 2 || *d != 3) + abort (); +} + +int +main () +{ + unsigned char a = 0; + unsigned long b = 1, c = 2; + unsigned int d = 3; + + fn_4parms (a, &b, &c, &d); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20001024-1.c b/gcc/testsuite/gcc.c-torture/execute/20001024-1.c new file mode 100644 index 000000000..42be8abca --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20001024-1.c @@ -0,0 +1,34 @@ +struct a; + +extern int baz (struct a *__restrict x); + +struct a { + long v; + long w; +}; + +struct b { + struct a c; + struct a d; +}; + +int bar (int x, const struct b *__restrict y, struct b *__restrict z) +{ + if (y->c.v || y->c.w != 250000 || y->d.v || y->d.w != 250000) + abort(); +} + +void foo(void) +{ + struct b x; + x.c.v = 0; + x.c.w = 250000; + x.d = x.c; + bar(0, &x, ((void *)0)); +} + +int main() +{ + foo(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20001026-1.c b/gcc/testsuite/gcc.c-torture/execute/20001026-1.c new file mode 100644 index 000000000..6ddcc5a6f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20001026-1.c @@ -0,0 +1,44 @@ +extern void abort (void); + +typedef struct { + long r[(19 + sizeof (long))/(sizeof (long))]; +} realvaluetype; + +typedef void *tree; + +static realvaluetype +real_value_from_int_cst (tree x, tree y) +{ + realvaluetype r; + int i; + for (i = 0; i < sizeof(r.r)/sizeof(long); ++i) + r.r[i] = -1; + return r; +} + +struct brfic_args +{ + tree type; + tree i; + realvaluetype d; +}; + +static void +build_real_from_int_cst_1 (data) + void * data; +{ + struct brfic_args *args = (struct brfic_args *) data; + args->d = real_value_from_int_cst (args->type, args->i); +} + +int main() +{ + struct brfic_args args; + + __builtin_memset (&args, 0, sizeof(args)); + build_real_from_int_cst_1 (&args); + + if (args.d.r[0] == 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20001027-1.c b/gcc/testsuite/gcc.c-torture/execute/20001027-1.c new file mode 100644 index 000000000..89ac9a024 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20001027-1.c @@ -0,0 +1,11 @@ +int x,*p=&x; + +int main() +{ + int i=0; + x=1; + p[i]=2; + if (x != 2) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20001031-1.c b/gcc/testsuite/gcc.c-torture/execute/20001031-1.c new file mode 100644 index 000000000..a2a6c830a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20001031-1.c @@ -0,0 +1,37 @@ +extern void abort (void); +extern void exit (int); + +void t1 (int x) +{ + if (x != 4100) + abort (); +} + +int t2 (void) +{ + int i; + t1 ((i = 4096) + 4); + return i; +} + +void t3 (long long x) +{ + if (x != 0x80000fffULL) + abort (); +} + +long long t4 (void) +{ + long long i; + t3 ((i = 4096) + 0x7fffffffULL); + return i; +} + +main () +{ + if (t2 () != 4096) + abort (); + if (t4 () != 4096) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20001101.c b/gcc/testsuite/gcc.c-torture/execute/20001101.c new file mode 100644 index 000000000..930ee32c3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20001101.c @@ -0,0 +1,40 @@ +extern void abort(void); + +typedef struct +{ + unsigned int unchanging : 1; +} struc, *rtx; + +rtx dummy ( int *a, rtx *b) +{ + *a = 1; + *b = (rtx)7; + return (rtx)1; +} + +void bogus (insn, thread, delay_list) + rtx insn; + rtx thread; + rtx delay_list; +{ + rtx new_thread; + int must_annul; + + delay_list = dummy ( &must_annul, &new_thread); + if (delay_list == 0 && new_thread ) + { + thread = new_thread; + } + if (delay_list && must_annul) + insn->unchanging = 1; + if (new_thread != thread ) + abort(); +} + +int main() +{ + struc baz; + bogus (&baz, (rtx)7, 0); + exit(0); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20001108-1.c b/gcc/testsuite/gcc.c-torture/execute/20001108-1.c new file mode 100644 index 000000000..a2a325534 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20001108-1.c @@ -0,0 +1,25 @@ +long long +signed_poly (long long sum, long x) +{ + sum += (long long) (long) sum * (long long) x; + return sum; +} + +unsigned long long +unsigned_poly (unsigned long long sum, unsigned long x) +{ + sum += (unsigned long long) (unsigned long) sum * (unsigned long long) x; + return sum; +} + +int +main (void) +{ + if (signed_poly (2LL, -3) != -4LL) + abort (); + + if (unsigned_poly (2ULL, 3) != 8ULL) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20001111-1.c b/gcc/testsuite/gcc.c-torture/execute/20001111-1.c new file mode 100644 index 000000000..85617c23d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20001111-1.c @@ -0,0 +1,41 @@ + +static int next_buffer = 0; +void bar (void); + +static int t = 1, u = 0; + +long +foo (unsigned int offset) +{ + unsigned i, buffer; + int x; + char *data; + + i = u; + if (i) + return i * 0xce2f; + + buffer = next_buffer; + data = buffer * 0xce2f; + for (i = 0; i < 2; i++) + bar (); + buffer = next_buffer; + return buffer * 0xce2f + offset; + +} + +void +bar (void) +{ +} + +int +main () +{ + if (foo (3) != 3) + abort (); + next_buffer = 1; + if (foo (2) != 0xce2f + 2) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20001112-1.c b/gcc/testsuite/gcc.c-torture/execute/20001112-1.c new file mode 100644 index 000000000..6ce2f6651 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20001112-1.c @@ -0,0 +1,10 @@ +int main () +{ + long long i = 1; + + i = i * 2 + 1; + + if (i != 3) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20001121-1.c b/gcc/testsuite/gcc.c-torture/execute/20001121-1.c new file mode 100644 index 000000000..3647456f5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20001121-1.c @@ -0,0 +1,19 @@ +double d; + +__inline__ double foo (void) +{ + return d; +} + +__inline__ int bar (void) +{ + foo(); + return 0; +} + +int main (void) +{ + if (bar ()) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20001124-1.c b/gcc/testsuite/gcc.c-torture/execute/20001124-1.c new file mode 100644 index 000000000..c0ec8cf04 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20001124-1.c @@ -0,0 +1,76 @@ + +struct inode { + long long i_size; + struct super_block *i_sb; +}; + +struct file { + long long f_pos; +}; + +struct super_block { + int s_blocksize; + unsigned char s_blocksize_bits; + int s_hs; +}; + +static char * +isofs_bread(unsigned int block) +{ + if (block) + abort (); + exit(0); +} + +static int +do_isofs_readdir(struct inode *inode, struct file *filp) +{ + int bufsize = inode->i_sb->s_blocksize; + unsigned char bufbits = inode->i_sb->s_blocksize_bits; + unsigned int block, offset; + char *bh = 0; + int hs; + + if (filp->f_pos >= inode->i_size) + return 0; + + offset = filp->f_pos & (bufsize - 1); + block = filp->f_pos >> bufbits; + hs = inode->i_sb->s_hs; + + while (filp->f_pos < inode->i_size) { + if (!bh) + bh = isofs_bread(block); + + hs += block << bufbits; + + if (hs == 0) + filp->f_pos++; + + if (offset >= bufsize) + offset &= bufsize - 1; + + if (*bh) + filp->f_pos++; + + filp->f_pos++; + } + return 0; +} + +struct super_block s; +struct inode i; +struct file f; + +int +main(int argc, char **argv) +{ + s.s_blocksize = 512; + s.s_blocksize_bits = 9; + i.i_size = 2048; + i.i_sb = &s; + f.f_pos = 0; + + do_isofs_readdir(&i,&f); + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20001130-1.c b/gcc/testsuite/gcc.c-torture/execute/20001130-1.c new file mode 100644 index 000000000..4a996ee6a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20001130-1.c @@ -0,0 +1,21 @@ +static inline int bar(void) { return 1; } +static int mem[3]; + +static int foo(int x) +{ + if (x != 0) + return x; + + mem[x++] = foo(bar()); + + if (x != 1) + abort(); + + return 0; +} + +int main() +{ + foo(0); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20001130-2.c b/gcc/testsuite/gcc.c-torture/execute/20001130-2.c new file mode 100644 index 000000000..c4ef6c7da --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20001130-2.c @@ -0,0 +1,31 @@ +static int which_alternative = 3; + +static const char *i960_output_ldconst (void); + +static const char * +output_25 (void) +{ + switch (which_alternative) + { + case 0: + return "mov %1,%0"; + case 1: + return i960_output_ldconst (); + case 2: + return "ld %1,%0"; + case 3: + return "st %1,%0"; + } +} + +static const char *i960_output_ldconst (void) +{ + return "foo"; +} +int main(void) +{ + const char *s = output_25 () ; + if (s[0] != 's') + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20001203-1.c b/gcc/testsuite/gcc.c-torture/execute/20001203-1.c new file mode 100644 index 000000000..803c6a890 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20001203-1.c @@ -0,0 +1,24 @@ +/* Origin: PR c/410 from Jan Echternach + , + adapted to a testcase by Joseph Myers . +*/ + +extern void exit (int); + +static void +foo (void) +{ + struct { + long a; + char b[1]; + } x = { 2, { 0 } }; +} + +int +main (void) +{ + int tmp; + foo (); + tmp = 1; + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20001203-2.c b/gcc/testsuite/gcc.c-torture/execute/20001203-2.c new file mode 100644 index 000000000..03aabed93 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20001203-2.c @@ -0,0 +1,123 @@ +struct obstack +{ + long chunk_size; + struct _obstack_chunk *chunk; + char *object_base; + char *next_free; + char *chunk_limit; + int alignment_mask; + unsigned maybe_empty_object; +}; + +struct objfile + { + struct objfile *next; + struct obstack type_obstack; + }; + +struct type + { + unsigned length; + struct objfile *objfile; + short nfields; + struct field + { + union field_location + { + int bitpos; + unsigned long physaddr; + char *physname; + } + loc; + int bitsize; + struct type *type; + char *name; + } + *fields; + }; + +struct type *alloc_type (void); +void * xmalloc (unsigned int z); +void _obstack_newchunk (struct obstack *o, int i); +void get_discrete_bounds (long long *lowp, long long *highp); + +extern void *memset(void *, int, __SIZE_TYPE__); + +struct type * +create_array_type (struct type *result_type, struct type *element_type) +{ + long long low_bound, high_bound; + if (result_type == ((void *)0)) + { + result_type = alloc_type (); + } + get_discrete_bounds (&low_bound, &high_bound); + (result_type)->length = + (element_type)->length * (high_bound - low_bound + 1); + (result_type)->nfields = 1; + (result_type)->fields = + (struct field *) ((result_type)->objfile != ((void *)0) + ? ( + { + struct obstack *__h = + (&(result_type)->objfile -> type_obstack); + { + struct obstack *__o = (__h); + int __len = ((sizeof (struct field))); + if (__o->chunk_limit - __o->next_free < __len) + _obstack_newchunk (__o, __len); + __o->next_free += __len; (void) 0; + }; + ({ + struct obstack *__o1 = (__h); + void *value; + value = (void *) __o1->object_base; + if (__o1->next_free == value) + __o1->maybe_empty_object = 1; + __o1->next_free = (((((__o1->next_free) - (char *) 0) + +__o1->alignment_mask) + & ~ (__o1->alignment_mask)) + + (char *) 0); + if (__o1->next_free - (char *)__o1->chunk + > __o1->chunk_limit - (char *)__o1->chunk) + __o1->next_free = __o1->chunk_limit; + __o1->object_base = __o1->next_free; + value; + }); + }) : xmalloc (sizeof (struct field))); + return (result_type); +} + +struct type * +alloc_type (void) +{ + abort (); +} +void * xmalloc (unsigned int z) +{ + return 0; +} +void _obstack_newchunk (struct obstack *o, int i) +{ + abort (); +} +void +get_discrete_bounds (long long *lowp, long long *highp) +{ + *lowp = 0; + *highp = 2; +} + +int main(void) +{ + struct type element_type; + struct type result_type; + + memset (&element_type, 0, sizeof (struct type)); + memset (&result_type, 0, sizeof (struct type)); + element_type.length = 4; + create_array_type (&result_type, &element_type); + if (result_type.length != 12) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20001221-1.c b/gcc/testsuite/gcc.c-torture/execute/20001221-1.c new file mode 100644 index 000000000..4b6cc2b45 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20001221-1.c @@ -0,0 +1,7 @@ +int main () +{ + unsigned long long a; + if (! (a = 0xfedcba9876543210ULL)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20001228-1.c b/gcc/testsuite/gcc.c-torture/execute/20001228-1.c new file mode 100644 index 000000000..9c93e79f5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20001228-1.c @@ -0,0 +1,28 @@ +int foo1(void) +{ + union { + char a[sizeof (unsigned)]; + unsigned b; + } u; + + u.b = 0x01; + return u.a[0]; +} + +int foo2(void) +{ + volatile union { + char a[sizeof (unsigned)]; + unsigned b; + } u; + + u.b = 0x01; + return u.a[0]; +} + +int main(void) +{ + if (foo1() != foo2()) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20001229-1.c b/gcc/testsuite/gcc.c-torture/execute/20001229-1.c new file mode 100644 index 000000000..39b58af62 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20001229-1.c @@ -0,0 +1,49 @@ +/* This testcase originally provoked an unaligned access fault on Alpha. + + Since Digital Unix and Linux (and probably others) by default fix + these up in the kernel, the failure was not visible unless one + is sitting at the console examining logs. + + So: If we know how, ask the kernel to deliver SIGBUS instead so + that the test case visibly fails. */ + +#if defined(__alpha__) && (defined(__linux__) || defined(__osf__)) +#ifdef __linux__ +#include +#include + +static inline int +setsysinfo(unsigned long op, void *buffer, unsigned long size, + int *start, void *arg, unsigned long flag) +{ + syscall(__NR_osf_setsysinfo, op, buffer, size, start, arg, flag); +} + +#else +#include +#include +#endif + +static void __attribute__((constructor)) +trap_unaligned(void) +{ + unsigned int buf[2]; + buf[0] = SSIN_UACPROC; + buf[1] = UAC_SIGBUS | UAC_NOPRINT; + setsysinfo(SSI_NVPAIRS, buf, 1, 0, 0, 0); +} +#endif /* alpha */ + +void foo(char *a, char *b) { } + +void showinfo() +{ + char uname[33] = "", tty[38] = "/dev/"; + foo(uname, tty); +} + +int main() +{ + showinfo (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010106-1.c b/gcc/testsuite/gcc.c-torture/execute/20010106-1.c new file mode 100644 index 000000000..9e149c314 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010106-1.c @@ -0,0 +1,30 @@ +/* Copyright 2001 Free Software Foundation + Contributed by Alexandre Oliva */ + +int f(int i) { + switch (i) + { + case -2: + return 33; + case -1: + return 0; + case 0: + return 7; + case 1: + return 4; + case 2: + return 3; + case 3: + return 15; + case 4: + return 9; + default: + abort (); + } +} + +int main() { + if (f(-1)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010114-1.c b/gcc/testsuite/gcc.c-torture/execute/20010114-1.c new file mode 100644 index 000000000..ee8295e35 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010114-1.c @@ -0,0 +1,15 @@ +/* Origin: PR c/1540 from Mattias Lampe , + adapted to a testcase by Joseph Myers . + GCC 2.95.2 fails, CVS GCC of 2001-01-13 passes. */ +extern void abort (void); +extern void exit (int); + +int +main (void) +{ + int array1[1] = { 1 }; + int array2[2][1]= { { 1 }, { 0 } }; + if (array1[0] != 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010116-1.c b/gcc/testsuite/gcc.c-torture/execute/20010116-1.c new file mode 100644 index 000000000..b77d6fb81 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010116-1.c @@ -0,0 +1,32 @@ +/* Distilled from optimization/863. */ + +extern void abort (void); +extern void exit (int); +extern void ok (int); + +typedef struct +{ + int x, y, z; +} Data; + +void find (Data *first, Data *last) +{ + int i; + for (i = (last - first) >> 2; i > 0; --i) + ok(i); + abort (); +} + +void ok(int i) +{ + if (i != 1) + abort (); + exit (0); +} + +int +main () +{ + Data DataList[4]; + find (DataList + 0, DataList + 4); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010118-1.c b/gcc/testsuite/gcc.c-torture/execute/20010118-1.c new file mode 100644 index 000000000..ee5197c9d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010118-1.c @@ -0,0 +1,37 @@ +typedef struct { + int a, b, c, d, e, f; +} A; + +void foo (A *v, int w, int x, int *y, int *z) +{ +} + +void +bar (A *v, int x, int y, int w, int h) +{ + if (v->a != x || v->b != y) { + int oldw = w; + int oldh = h; + int e = v->e; + int f = v->f; + int dx, dy; + foo(v, 0, 0, &w, &h); + dx = (oldw - w) * (double) e/2.0; + dy = (oldh - h) * (double) f/2.0; + x += dx; + y += dy; + v->a = x; + v->b = y; + v->c = w; + v->d = h; + } +} + +int main () +{ + A w = { 100, 110, 20, 30, -1, -1 }; + bar (&w,400,420,50,70); + if (w.d != 70) + abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010119-1.c b/gcc/testsuite/gcc.c-torture/execute/20010119-1.c new file mode 100644 index 000000000..c2a691a39 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010119-1.c @@ -0,0 +1,23 @@ +#ifdef __OPTIMIZE__ +extern void undef (void); + +void bar (unsigned x) { } +void baz (unsigned x) { } + +extern inline void foo (int a, int b) +{ + int c = 0; + while (c++ < b) + (__builtin_constant_p (a) ? ((a) > 20000 ? undef () : bar (a)) : baz (a)); +} +#else +void foo (int a, int b) +{ +} +#endif + +int main (void) +{ + foo(10, 100); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010122-1.c b/gcc/testsuite/gcc.c-torture/execute/20010122-1.c new file mode 100644 index 000000000..280e3d45c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010122-1.c @@ -0,0 +1,202 @@ + +extern void exit (int); +extern void abort (void); +extern void *alloca (__SIZE_TYPE__); +char *dummy (void); + +#define NOINLINE __attribute__((noinline)) + +void *save_ret1[6]; +void *test4a (char *); +void *test5a (char *); +void *test6a (char *); + +void NOINLINE *test1 (void) +{ + void * temp; + temp = __builtin_return_address (0); + return temp; +} + +void NOINLINE *test2 (void) +{ + void * temp; + dummy (); + temp = __builtin_return_address (0); + return temp; +} + +void NOINLINE *test3 (void) +{ + void * temp; + temp = __builtin_return_address (0); + dummy (); + return temp; +} + +void NOINLINE *test4 (void) +{ + char * save = (char*) alloca (4); + + return test4a (save); +} + +void *NOINLINE test4a (char * p) +{ + void * temp; + temp = __builtin_return_address (1); + return temp; +} + +void NOINLINE *test5 (void) +{ + char * save = (char*) alloca (4); + + return test5a (save); +} + +void NOINLINE *test5a (char * p) +{ + void * temp; + dummy (); + temp = __builtin_return_address (1); + return temp; +} + +void NOINLINE *test6 (void) +{ + char * save = (char*) alloca (4); + + return test6a (save); +} + +void NOINLINE *test6a (char * p) +{ + void * temp; + temp = __builtin_return_address (1); + dummy (); + return temp; +} + +void *(*func1[6])(void) = { test1, test2, test3, test4, test5, test6 }; + +char * NOINLINE call_func1 (int i) +{ + save_ret1[i] = func1[i] (); +} + +static void *ret_addr; +void *save_ret2[6]; +void test10a (char *); +void test11a (char *); +void test12a (char *); + +void NOINLINE test7 (void) +{ + ret_addr = __builtin_return_address (0); + return; +} + +void NOINLINE test8 (void) +{ + dummy (); + ret_addr = __builtin_return_address (0); + return; +} + +void NOINLINE test9 (void) +{ + ret_addr = __builtin_return_address (0); + dummy (); + return; +} + +void NOINLINE test10 (void) +{ + char * save = (char*) alloca (4); + + test10a (save); +} + +void NOINLINE test10a (char * p) +{ + ret_addr = __builtin_return_address (1); + return; +} + +void NOINLINE test11 (void) +{ + char * save = (char*) alloca (4); + + test11a (save); +} + +void NOINLINE test11a (char * p) +{ + dummy (); + ret_addr = __builtin_return_address (1); + return; +} + +void NOINLINE test12 (void) +{ + char * save = (char*) alloca (4); + + test12a (save); +} + +void NOINLINE test12a (char * p) +{ + ret_addr = __builtin_return_address (1); + dummy (); + return; +} + +char * dummy (void) +{ + char * save = (char*) alloca (4); + + return save; +} + +void (*func2[6])(void) = { test7, test8, test9, test10, test11, test12 }; + +void NOINLINE call_func2 (int i) +{ + func2[i] (); + save_ret2[i] = ret_addr; +} + +int main (void) +{ + int i; + + for (i = 0; i < 6; i++) { + call_func1(i); + } + + if (save_ret1[0] != save_ret1[1] + || save_ret1[1] != save_ret1[2]) + abort (); + if (save_ret1[3] != save_ret1[4] + || save_ret1[4] != save_ret1[5]) + abort (); + if (save_ret1[3] && save_ret1[0] != save_ret1[3]) + abort (); + + + for (i = 0; i < 6; i++) { + call_func2(i); + } + + if (save_ret2[0] != save_ret2[1] + || save_ret2[1] != save_ret2[2]) + abort (); + if (save_ret2[3] != save_ret2[4] + || save_ret2[4] != save_ret2[5]) + abort (); + if (save_ret2[3] && save_ret2[0] != save_ret2[3]) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010122-1.x b/gcc/testsuite/gcc.c-torture/execute/20010122-1.x new file mode 100644 index 000000000..655823644 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010122-1.x @@ -0,0 +1,11 @@ +# This test relies on __builtin_return_address(1) returning something +# useful or NULL. This is not guaranteed to be be so, especially when +# -fomit-frame-pointer is used. So do not test with it. + +set torture_eval_before_compile { + if {[string match {*-fomit-frame-pointer*} "$option"]} { + continue + } +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/20010123-1.c b/gcc/testsuite/gcc.c-torture/execute/20010123-1.c new file mode 100644 index 000000000..9c0989b0e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010123-1.c @@ -0,0 +1,23 @@ +extern void abort (); +extern void exit (int); + +struct s +{ + int value; + char *string; +}; + +int main (void) +{ + int i; + for (i = 0; i < 4; i++) + { + struct s *t = & (struct s) { 3, "hey there" }; + if (t->value != 3) + abort(); + t->value = 4; + if (t->value != 4) + abort(); + } + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010129-1.c b/gcc/testsuite/gcc.c-torture/execute/20010129-1.c new file mode 100644 index 000000000..a4ea5e4d9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010129-1.c @@ -0,0 +1,64 @@ +long baz1 (void *a) +{ + static long l; + return l++; +} + +int baz2 (const char *a) +{ + return 0; +} + +int baz3 (int i) +{ + if (!i) + abort (); + return 1; +} + +void **bar; + +int foo (void *a, long b, int c) +{ + int d = 0, e, f = 0, i; + char g[256]; + void **h; + + g[0] = '\n'; + g[1] = 0; + + while (baz1 (a) < b) { + if (g[0] != ' ' && g[0] != '\t') { + f = 1; + e = 0; + if (!d && baz2 (g) == 0) { + if ((c & 0x10) == 0) + continue; + e = d = 1; + } + if (!((c & 0x10) && (c & 0x4000) && e) && (c & 2)) + continue; + if ((c & 0x2000) && baz2 (g) == 0) + continue; + if ((c & 0x1408) && baz2 (g) == 0) + continue; + if ((c & 0x200) && baz2 (g) == 0) + continue; + if (c & 0x80) { + for (h = bar, i = 0; h; h = (void **)*h, i++) + if (baz3 (i)) + break; + } + f = 0; + } + } + return 0; +} + +int main () +{ + void *n = 0; + bar = &n; + foo (&n, 1, 0xc811); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010129-1.x b/gcc/testsuite/gcc.c-torture/execute/20010129-1.x new file mode 100644 index 000000000..7e474c453 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010129-1.x @@ -0,0 +1,13 @@ +# Use "-mtune=i686" on i?86-*-* unless "-m64" is specified. +if { [istarget "i?86-*-*"] } { + set target_name [target_info name] + if {[board_info $target_name exists multilib_flags]} { + set multilib_flags [board_info $target_name multilib_flags] + if { ![regexp -- "-m64" $multilib_flags] } { + set additional_flags "-mtune=i686" + } + } else { + set additional_flags "-mtune=i686" + } +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/20010206-1.c b/gcc/testsuite/gcc.c-torture/execute/20010206-1.c new file mode 100644 index 000000000..3aa8cad86 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010206-1.c @@ -0,0 +1,16 @@ +int foo (void) +{ + int i; +#line 1 "20010206-1.c" + if (0) i = 1; else i +#line 1 "20010206-1.c" + = 26; + return i; +} + +int main () +{ + if (foo () != 26) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010209-1.c b/gcc/testsuite/gcc.c-torture/execute/20010209-1.c new file mode 100644 index 000000000..e04d605ed --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010209-1.c @@ -0,0 +1,21 @@ +int b; +int foo (void) +{ + int x[b]; + int bar (int t[b]) + { + int i; + for (i = 0; i < b; i++) + t[i] = i + (i > 0 ? t[i-1] : 0); + return t[b-1]; + } + return bar (x); +} + +int main () +{ + b = 6; + if (foo () != 15) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010221-1.c b/gcc/testsuite/gcc.c-torture/execute/20010221-1.c new file mode 100644 index 000000000..3caff8193 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010221-1.c @@ -0,0 +1,17 @@ + +int n = 2; + +main () +{ + int i, x = 45; + + for (i = 0; i < n; i++) + { + if (i != 0) + x = ( i > 0 ) ? i : 0; + } + + if (x != 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010222-1.c b/gcc/testsuite/gcc.c-torture/execute/20010222-1.c new file mode 100644 index 000000000..c3a2b18e5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010222-1.c @@ -0,0 +1,9 @@ +int a[2] = { 18, 6 }; + +int main () +{ + int b = (-3 * a[0] -3 * a[1]) / 12; + if (b != -6) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010224-1.c b/gcc/testsuite/gcc.c-torture/execute/20010224-1.c new file mode 100644 index 000000000..1d04fd173 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010224-1.c @@ -0,0 +1,44 @@ +extern void abort (void); + +typedef signed short int16_t; +typedef unsigned short uint16_t; + +int16_t logadd (int16_t *a, int16_t *b); +void ba_compute_psd (int16_t start); + +int16_t masktab[6] = { 1, 2, 3, 4, 5}; +int16_t psd[6] = { 50, 40, 30, 20, 10}; +int16_t bndpsd[6] = { 1, 2, 3, 4, 5}; + +void ba_compute_psd (int16_t start) +{ + int i,j,k; + int16_t lastbin = 4; + + j = start; + k = masktab[start]; + + bndpsd[k] = psd[j]; + j++; + + for (i = j; i < lastbin; i++) { + bndpsd[k] = logadd(&bndpsd[k], &psd[j]); + j++; + } +} + +int16_t logadd (int16_t *a, int16_t *b) +{ + return *a + *b; +} + +int main (void) +{ + int i; + + ba_compute_psd (0); + + if (bndpsd[1] != 140) abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20010325-1.c b/gcc/testsuite/gcc.c-torture/execute/20010325-1.c new file mode 100644 index 000000000..100679fa1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010325-1.c @@ -0,0 +1,15 @@ +/* Origin: Joseph Myers . + + This tests for inconsistency in whether wide STRING_CSTs use the host + or the target endianness. */ + +extern void exit (int); +extern void abort (void); + +int +main (void) +{ + if (L"a" "b"[1] != L'b') + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010329-1.c b/gcc/testsuite/gcc.c-torture/execute/20010329-1.c new file mode 100644 index 000000000..e28d6d7c7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010329-1.c @@ -0,0 +1,14 @@ +#include + +int main (void) +{ + void *x = ((void *)((unsigned int)INT_MAX + 2)); + void *y = ((void *)((unsigned long)LONG_MAX + 2)); + if (x >= ((void *)((unsigned int)INT_MAX + 1)) + && x <= ((void *)((unsigned int)INT_MAX + 6)) + && y >= ((void *)((unsigned long)LONG_MAX + 1)) + && y <= ((void *)((unsigned long)LONG_MAX + 6))) + exit (0); + else + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010403-1.c b/gcc/testsuite/gcc.c-torture/execute/20010403-1.c new file mode 100644 index 000000000..6a8f2a424 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010403-1.c @@ -0,0 +1,36 @@ +void b (int *); +void c (int, int); +void d (int); + +int e; + +void a (int x, int y) +{ + int f = x ? e : 0; + int z = y; + + b (&y); + c (z, y); + d (f); +} + +void b (int *y) +{ + (*y)++; +} + +void c (int x, int y) +{ + if (x == y) + abort (); +} + +void d (int x) +{ +} + +int main (void) +{ + a (0, 0); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010409-1.c b/gcc/testsuite/gcc.c-torture/execute/20010409-1.c new file mode 100644 index 000000000..95a5dc344 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010409-1.c @@ -0,0 +1,43 @@ +typedef __SIZE_TYPE__ size_t; +extern size_t strlen (const char *s); + +typedef struct A { + int a, b; +} A; + +typedef struct B { + struct A **a; + int b; +} B; + +A *a; +int b = 1, c; +B d[1]; + +void foo (A *x, const char *y, int z) +{ + c = y[4] + z * 25; +} + +A *bar (const char *v, int w, int x, const char *y, int z) +{ + if (w) + abort (); + exit (0); +} + +void test (const char *x, int *y) +{ + foo (d->a[d->b], "test", 200); + d->a[d->b] = bar (x, b ? 0 : 65536, strlen (x), "test", 201); + d->a[d->b]->a++; + if (y) + d->a[d->b]->b = *y; +} + +int main () +{ + d->b = 0; + d->a = &a; + test ("", 0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010422-1.c b/gcc/testsuite/gcc.c-torture/execute/20010422-1.c new file mode 100644 index 000000000..5c6bccc9e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010422-1.c @@ -0,0 +1,15 @@ +unsigned int foo(unsigned int x) +{ + if (x < 5) + x = 4; + else + x = 8; + return x; +} + +int main(void) +{ + if (foo (8) != 8) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010518-1.c b/gcc/testsuite/gcc.c-torture/execute/20010518-1.c new file mode 100644 index 000000000..94b2d8f6f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010518-1.c @@ -0,0 +1,28 @@ +/* Leaf functions with many arguments. */ + +int +add (int a, + int b, + int c, + int d, + int e, + int f, + int g, + int h, + int i, + int j, + int k, + int l, + int m) +{ + return a+b+c+d+e+f+g+h+i+j+k+l+m; +} + +int +main(void) +{ + if (add (1,2,3,4,5,6,7,8,9,10,11,12,13) != 91) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010518-2.c b/gcc/testsuite/gcc.c-torture/execute/20010518-2.c new file mode 100644 index 000000000..1990f8e63 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010518-2.c @@ -0,0 +1,38 @@ +/* Mis-aligned packed structures. */ + +typedef struct +{ + char b0; + char b1; + char b2; + char b3; + char b4; + char b5; +} __attribute__ ((packed)) b_struct; + + +typedef struct +{ + short a; + long b; + short c; + short d; + b_struct e; +} __attribute__ ((packed)) a_struct; + + +int +main(void) +{ + volatile a_struct *a; + volatile a_struct b; + + a = &b; + *a = (a_struct){1,2,3,4}; + a->e.b4 = 'c'; + + if (a->a != 1 || a->b != 2 || a->c != 3 || a->d != 4 || a->e.b4 != 'c') + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010520-1.c b/gcc/testsuite/gcc.c-torture/execute/20010520-1.c new file mode 100644 index 000000000..fa94418ca --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010520-1.c @@ -0,0 +1,12 @@ +static unsigned int expr_hash_table_size = 1; + +int +main () +{ + int del = 1; + unsigned int i = 0; + + if (i < expr_hash_table_size && del) + exit (0); + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010604-1.c b/gcc/testsuite/gcc.c-torture/execute/20010604-1.c new file mode 100644 index 000000000..e0deaf524 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010604-1.c @@ -0,0 +1,14 @@ +#include + +int f (int a, int b, int c, _Bool d, _Bool e, _Bool f, char g) +{ + if (g != 1 || d != true || e != true || f != true) abort (); + return a + b + c; +} + +int main (void) +{ + if (f (1, 2, -3, true, true, true, '\001')) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010605-1.c b/gcc/testsuite/gcc.c-torture/execute/20010605-1.c new file mode 100644 index 000000000..c777af5bd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010605-1.c @@ -0,0 +1,11 @@ +int main () +{ + int v = 42; + + inline int fff (int x) + { + return x*10; + } + + return (fff (v) != 420); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010605-2.c b/gcc/testsuite/gcc.c-torture/execute/20010605-2.c new file mode 100644 index 000000000..09c7f76ac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010605-2.c @@ -0,0 +1,36 @@ +void foo (), bar (), baz (); +int main () +{ + __complex__ double x; + __complex__ float y; + __complex__ long double z; + __real__ x = 1.0; + __imag__ x = 2.0; + foo (x); + __real__ y = 3.0f; + __imag__ y = 4.0f; + bar (y); + __real__ z = 5.0L; + __imag__ z = 6.0L; + baz (z); + exit (0); +} + +void foo (__complex__ double x) +{ + if (__real__ x != 1.0 || __imag__ x != 2.0) + abort (); +} + +void bar (__complex__ float x) +{ + if (__real__ x != 3.0f || __imag__ x != 4.0f) + abort (); +} + +void baz (__complex__ long double x) +{ + if (__real__ x != 5.0L || __imag__ x != 6.0L) + abort (); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20010711-1.c b/gcc/testsuite/gcc.c-torture/execute/20010711-1.c new file mode 100644 index 000000000..12971a55a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010711-1.c @@ -0,0 +1,13 @@ +void foo (int *a) {} + +int main () +{ + int a; + if (&a == 0) + abort (); + else + { + foo (&a); + exit (0); + } +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010717-1.c b/gcc/testsuite/gcc.c-torture/execute/20010717-1.c new file mode 100644 index 000000000..65199da90 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010717-1.c @@ -0,0 +1,22 @@ +extern void abort (void); + +int +main () +{ + int i, j; + unsigned long u, r1, r2; + + i = -16; + j = 1; + u = i + j; + + /* no sign extension upon shift */ + r1 = u >> 1; + /* sign extension upon shift, but there shouldn't be */ + r2 = ((unsigned long) (i + j)) >> 1; + + if (r1 != r2) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010723-1.c b/gcc/testsuite/gcc.c-torture/execute/20010723-1.c new file mode 100644 index 000000000..9d4b29f68 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010723-1.c @@ -0,0 +1,16 @@ +int +test () +{ + int biv,giv; + for (biv = 0, giv = 0; giv != 8; biv++) + giv = biv*8; + return giv; +} + + +main() +{ + if (test () != 8) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010724-1.c b/gcc/testsuite/gcc.c-torture/execute/20010724-1.c new file mode 100644 index 000000000..8ff7d0f44 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010724-1.c @@ -0,0 +1,59 @@ +/* Verify that the workarounds in config/mips/irix6-libc-compat.c are still + needed. */ + +/* IRIX 6, unlike other Unix systems, defines union semun in . + Inhibit this definition to be able to run this test on other platforms. */ +#define _XOPEN_SOURCE + +#include +#include +#include +#include +#include + +union semun { + int val; + struct semid_ds *buf; + ushort_t *array; +}; + +int +main (void) +{ + struct in_addr ia; + int semid; + union semun su; + + ia.s_addr = INADDR_BROADCAST; + + if (strcmp (inet_ntoa (ia), "255.255.255.255") != 0) + abort (); + + ia.s_addr = INADDR_LOOPBACK; + + if (inet_lnaof (ia) != 1) + abort (); + + if (inet_netof (ia) != IN_LOOPBACKNET) + abort (); + + ia = inet_makeaddr (IN_LOOPBACKNET, 1); + if (ia.s_addr != INADDR_LOOPBACK) + abort (); + + if ((semid = semget (IPC_PRIVATE, 1, IPC_CREAT | IPC_EXCL | SEM_R | SEM_A)) < 0) + abort (); + + su.val = 10; + + if (semctl (semid, 0, SETVAL, su) != 0) + abort (); + + if (semctl (semid, 0, GETVAL) != 10) + abort (); + + if (semctl (semid, 0, IPC_RMID) != 0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010724-1.x b/gcc/testsuite/gcc.c-torture/execute/20010724-1.x new file mode 100644 index 000000000..2f2f05634 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010724-1.x @@ -0,0 +1,3 @@ +# This test is only needed on IRIX 6 +if { ! [istarget "mips*-sgi-irix6*"] } { return 1 } +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/20010904-1.c b/gcc/testsuite/gcc.c-torture/execute/20010904-1.c new file mode 100644 index 000000000..92b258b52 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010904-1.c @@ -0,0 +1,11 @@ +typedef struct x { int a; int b; } __attribute__((aligned(32))) X; +typedef struct y { X x[32]; int c; } Y; + +Y y[2]; + +int main(void) +{ + if (((char *)&y[1] - (char *)&y[0]) & 31) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010904-2.c b/gcc/testsuite/gcc.c-torture/execute/20010904-2.c new file mode 100644 index 000000000..cbe49806c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010904-2.c @@ -0,0 +1,11 @@ +typedef struct x { int a; int b; } __attribute__((aligned(32))) X; +typedef struct y { X x; X y[31]; int c; } Y; + +Y y[2]; + +int main(void) +{ + if (((char *)&y[1] - (char *)&y[0]) & 31) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010910-1.c b/gcc/testsuite/gcc.c-torture/execute/20010910-1.c new file mode 100644 index 000000000..185e29d2b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010910-1.c @@ -0,0 +1,59 @@ +/* Test case contributed by Ingo Rohloff . + Code distilled from Linux kernel. */ + +/* Compile this program with a gcc-2.95.2 using + "gcc -O2" and run it. The result will be that + rx_ring[1].next == 0 (it should be == 14) + and + ep.skbuff[4] == 5 (it should be 0) +*/ + +extern void abort(void); + +struct epic_rx_desc +{ + unsigned int next; +}; + +struct epic_private +{ + struct epic_rx_desc *rx_ring; + unsigned int rx_skbuff[5]; +}; + +static void epic_init_ring(struct epic_private *ep) +{ + int i; + + for (i = 0; i < 5; i++) + { + ep->rx_ring[i].next = 10 + (i+1)*2; + ep->rx_skbuff[i] = 0; + } + ep->rx_ring[i-1].next = 10; +} + +static int check_rx_ring[5] = { 12,14,16,18,10 }; + +int main(void) +{ + struct epic_private ep; + struct epic_rx_desc rx_ring[5]; + int i; + + for (i=0;i<5;i++) + { + rx_ring[i].next=0; + ep.rx_skbuff[i]=5; + } + + ep.rx_ring=rx_ring; + epic_init_ring(&ep); + + for (i=0;i<5;i++) + { + if ( rx_ring[i].next != check_rx_ring[i] ) abort(); + if ( ep.rx_skbuff[i] != 0 ) abort(); + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010915-1.c b/gcc/testsuite/gcc.c-torture/execute/20010915-1.c new file mode 100644 index 000000000..5a04bf58f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010915-1.c @@ -0,0 +1,71 @@ +/* Bug in reorg.c, deleting the "++" in the last loop in main. + Origin: . */ + +extern void f (void); +extern int x (int, char **); +extern int r (const char *); +extern char *s (char *, char **); +extern char *m (char *); +char *u; +char *h; +int check = 0; +int o = 0; + +int main (int argc, char **argv) +{ + char *args[] = {"a", "b", "c", "d", "e"}; + if (x (5, args) != 0 || check != 2 || o != 5) + abort (); + exit (0); +} + +int x (int argc, char **argv) +{ + int opt = 0; + char *g = 0; + char *p = 0; + + if (argc > o && argc > 2 && argv[o]) + { + g = s (argv[o], &p); + if (g) + { + *g++ = '\0'; + h = s (g, &p); + if (g == p) + h = m (g); + } + u = s (argv[o], &p); + if (argv[o] == p) + u = m (argv[o]); + } + else + abort (); + + while (++o < argc) + if (r (argv[o]) == 0) + return 1; + + return 0; +} + +char *m (char *x) { abort (); } +char *s (char *v, char **pp) +{ + if (strcmp (v, "a") != 0 || check++ > 1) + abort (); + *pp = v+1; + return 0; +} + +int r (const char *f) +{ + static char c[2] = "b"; + static int cnt = 0; + + if (*f != *c || f[1] != c[1] || cnt > 3) + abort (); + c[0]++; + cnt++; + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010924-1.c b/gcc/testsuite/gcc.c-torture/execute/20010924-1.c new file mode 100644 index 000000000..247f51ce6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010924-1.c @@ -0,0 +1,71 @@ +/* Verify that flexible arrays can be initialized from STRING_CST + constructors. */ + +/* Baselines. */ +struct { + char a1c; + char *a1p; +} a1 = { + '4', + "62" +}; + +struct { + char a2c; + char a2p[2]; +} a2 = { + 'v', + "cq" +}; + +/* The tests. */ +struct { + char a3c; + char a3p[]; +} a3 = { + 'o', + "wx" +}; + +struct { + char a4c; + char a4p[]; +} a4 = { + '9', + { 'e', 'b' } +}; + +main() +{ + if (a1.a1c != '4') + abort(); + if (a1.a1p[0] != '6') + abort(); + if (a1.a1p[1] != '2') + abort(); + if (a1.a1p[2] != '\0') + abort(); + + if (a2.a2c != 'v') + abort(); + if (a2.a2p[0] != 'c') + abort(); + if (a2.a2p[1] != 'q') + abort(); + + if (a3.a3c != 'o') + abort(); + if (a3.a3p[0] != 'w') + abort(); + if (a3.a3p[1] != 'x') + abort(); + + if (a4.a4c != '9') + abort(); + if (a4.a4p[0] != 'e') + abort(); + if (a4.a4p[1] != 'b') + abort(); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20010925-1.c b/gcc/testsuite/gcc.c-torture/execute/20010925-1.c new file mode 100644 index 000000000..90507e795 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20010925-1.c @@ -0,0 +1,24 @@ +extern void exit(int); +extern void abort (void); + +extern void * memcpy (void *, const void *, __SIZE_TYPE__); +int foo (void *, void *, unsigned int c); + +int src[10]; +int dst[10]; + +int main() +{ + if (foo (dst, src, 10) != 0) + abort(); + exit(0); +} + +int foo (void *a, void *b, unsigned int c) +{ + if (c == 0) + return 1; + + memcpy (a, b, c); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20011008-3.c b/gcc/testsuite/gcc.c-torture/execute/20011008-3.c new file mode 100644 index 000000000..6d2a18f64 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20011008-3.c @@ -0,0 +1,105 @@ +extern void exit (int); +extern void abort (void); + +typedef unsigned int u_int32_t; +typedef unsigned char u_int8_t; +typedef int int32_t; + +typedef enum { + TXNLIST_DELETE, + TXNLIST_LSN, + TXNLIST_TXNID, + TXNLIST_PGNO +} db_txnlist_type; + +struct __db_lsn; typedef struct __db_lsn DB_LSN; +struct __db_lsn { + u_int32_t file; + u_int32_t offset; +}; +struct __db_txnlist; typedef struct __db_txnlist DB_TXNLIST; + +struct __db_txnlist { + db_txnlist_type type; + struct { struct __db_txnlist *le_next; struct __db_txnlist **le_prev; } links; + union { + struct { + u_int32_t txnid; + int32_t generation; + int32_t aborted; + } t; + struct { + + + u_int32_t flags; + int32_t fileid; + u_int32_t count; + char *fname; + } d; + struct { + int32_t ntxns; + int32_t maxn; + DB_LSN *lsn_array; + } l; + struct { + int32_t nentries; + int32_t maxentry; + char *fname; + int32_t fileid; + void *pgno_array; + u_int8_t uid[20]; + } p; + } u; +}; + +int log_compare (const DB_LSN *a, const DB_LSN *b) +{ + return 1; +} + + +int +__db_txnlist_lsnadd(int val, DB_TXNLIST *elp, DB_LSN *lsnp, u_int32_t flags) +{ + int i; + + for (i = 0; i < (!(flags & (0x1)) ? 1 : elp->u.l.ntxns); i++) + { + int __j; + DB_LSN __tmp; + val++; + for (__j = 0; __j < elp->u.l.ntxns - 1; __j++) + if (log_compare(&elp->u.l.lsn_array[__j], &elp->u.l.lsn_array[__j + 1]) < 0) + { + __tmp = elp->u.l.lsn_array[__j]; + elp->u.l.lsn_array[__j] = elp->u.l.lsn_array[__j + 1]; + elp->u.l.lsn_array[__j + 1] = __tmp; + } + } + + *lsnp = elp->u.l.lsn_array[0]; + return val; +} + +#ifndef STACK_SIZE +#define VLEN 1235 +#else +#define VLEN (STACK_SIZE/10) +#endif + +int main (void) +{ + DB_TXNLIST el; + DB_LSN lsn, lsn_a[VLEN]; + + el.u.l.ntxns = VLEN-1; + el.u.l.lsn_array = lsn_a; + + if (__db_txnlist_lsnadd (0, &el, &lsn, 0) != 1) + abort (); + + if (__db_txnlist_lsnadd (0, &el, &lsn, 1) != VLEN-1) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20011019-1.c b/gcc/testsuite/gcc.c-torture/execute/20011019-1.c new file mode 100644 index 000000000..ebaa411c4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20011019-1.c @@ -0,0 +1,18 @@ +extern void exit (int); +extern void abort (void); + +struct { int a; int b[5]; } x; +int *y; + +int foo (void) +{ + return y - x.b; +} + +int main (void) +{ + y = x.b; + if (foo ()) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20011024-1.c b/gcc/testsuite/gcc.c-torture/execute/20011024-1.c new file mode 100644 index 000000000..5b871bbb9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20011024-1.c @@ -0,0 +1,22 @@ +/* Test whether store motion recognizes pure functions as potentially reading + any memory. */ + +typedef __SIZE_TYPE__ size_t; +extern void *memcpy (void *dest, const void *src, size_t n); +extern size_t strlen (const char *s); +extern int strcmp (const char *s1, const char *s2) __attribute__((pure)); + +char buf[50]; + +static void foo (void) +{ + if (memcpy (buf, "abc", 4) != buf) abort (); + if (strcmp (buf, "abc")) abort (); + memcpy (buf, "abcdefgh", strlen ("abcdefgh") + 1); +} + +int main (void) +{ + foo (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20011109-1.c b/gcc/testsuite/gcc.c-torture/execute/20011109-1.c new file mode 100644 index 000000000..0f013d3b5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20011109-1.c @@ -0,0 +1,58 @@ +void fail1(void) +{ + abort (); +} +void fail2(void) +{ + abort (); +} +void fail3(void) +{ + abort (); +} +void fail4(void) +{ + abort (); +} + + +void foo(long x) +{ + switch (x) + { + case -6: + fail1 (); break; + case 0: + fail2 (); break; + case 1: case 2: + break; + case 3: case 4: case 5: + fail3 (); + break; + default: + fail4 (); + break; + } + switch (x) + { + + case -3: + fail1 (); break; + case 0: case 4: + fail2 (); break; + case 1: case 3: + break; + case 2: case 8: + abort (); + break; + default: + fail4 (); + break; + } +} + +int main(void) +{ + foo (1); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20011109-2.c b/gcc/testsuite/gcc.c-torture/execute/20011109-2.c new file mode 100644 index 000000000..1abbbf2f6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20011109-2.c @@ -0,0 +1,10 @@ +int main(void) +{ + char *c1 = "foo"; + char *c2 = "foo"; + int i; + for (i = 0; i < 3; i++) + if (c1[i] != c2[i]) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20011113-1.c b/gcc/testsuite/gcc.c-torture/execute/20011113-1.c new file mode 100644 index 000000000..a2eb86b6d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20011113-1.c @@ -0,0 +1,55 @@ +typedef __SIZE_TYPE__ size_t; +extern void *memcpy (void *__restrict, const void *__restrict, size_t); +extern void abort (void); +extern void exit (int); + +typedef struct t +{ + unsigned a : 16; + unsigned b : 8; + unsigned c : 8; + long d[4]; +} *T; + +typedef struct { + long r[3]; +} U; + +T bar (U, unsigned int); + +T foo (T x) +{ + U d, u; + + memcpy (&u, &x->d[1], sizeof u); + d = u; + return bar (d, x->b); +} + +T baz (T x) +{ + U d, u; + + d.r[0] = 0x123456789; + d.r[1] = 0xfedcba987; + d.r[2] = 0xabcdef123; + memcpy (&u, &x->d[1], sizeof u); + d = u; + return bar (d, x->b); +} + +T bar (U d, unsigned int m) +{ + if (d.r[0] != 21 || d.r[1] != 22 || d.r[2] != 23) + abort (); + return 0; +} + +struct t t = { 26, 0, 0, { 0, 21, 22, 23 }}; + +int main (void) +{ + baz (&t); + foo (&t); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20011114-1.c b/gcc/testsuite/gcc.c-torture/execute/20011114-1.c new file mode 100644 index 000000000..9746c1e1d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20011114-1.c @@ -0,0 +1,11 @@ +char foo(char bar[]) +{ + return bar[1]; +} +extern char foo(char *); +int main(void) +{ + if (foo("xy") != 'y') + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20011115-1.c b/gcc/testsuite/gcc.c-torture/execute/20011115-1.c new file mode 100644 index 000000000..17a35658e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20011115-1.c @@ -0,0 +1,26 @@ +extern void exit (int); + +static inline int +foo (void) +{ +#ifdef __OPTIMIZE__ + extern int undefined_reference; + return undefined_reference; +#else + return 0; +#endif +} + +static inline int +bar (void) +{ + if (foo == foo) + return 1; + else + return foo (); +} + +int main (void) +{ + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20011121-1.c b/gcc/testsuite/gcc.c-torture/execute/20011121-1.c new file mode 100644 index 000000000..3e3d03a32 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20011121-1.c @@ -0,0 +1,19 @@ +struct s +{ + int i[18]; + char f; + char b[2]; +}; + +struct s s1; + +int +main() +{ + struct s s2; + s2.b[0] = 100; + __builtin_memcpy(&s2, &s1, ((unsigned int) &((struct s *)0)->b)); + if (s2.b[0] != 100) + abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20011126-1.c b/gcc/testsuite/gcc.c-torture/execute/20011126-1.c new file mode 100644 index 000000000..ede938b00 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20011126-1.c @@ -0,0 +1,19 @@ +/* Produced a overflow in ifcvt.c, causing S to contain 0xffffffff7fffffff. */ + +int a = 1; + +int main () +{ + long long s; + + s = a; + if (s < 0) + s = -2147483648LL; + else + s = 2147483647LL; + + if (s < 0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20011126-2.c b/gcc/testsuite/gcc.c-torture/execute/20011126-2.c new file mode 100644 index 000000000..f6625058a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20011126-2.c @@ -0,0 +1,43 @@ +/* Problem originally visible on ia64. + + There is a partial redundancy of "in + 1" that makes GCSE want to + transform the final while loop to + + p = in + 1; + tmp = p; + ... + goto start; + top: + tmp = tmp + 1; + start: + in = tmp; + if (in < p) goto top; + + We miscalculate the number of loop iterations as (p - tmp) = 0 + instead of (p - in) = 1, which results in overflow in the doloop + optimization. */ + +static const char * +test (const char *in, char *out) +{ + while (1) + { + if (*in == 'a') + { + const char *p = in + 1; + while (*p == 'x') + ++p; + if (*p == 'b') + return p; + while (in < p) + *out++ = *in++; + } + } +} + +int main () +{ + char out[4]; + test ("aab", out); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20011128-1.c b/gcc/testsuite/gcc.c-torture/execute/20011128-1.c new file mode 100644 index 000000000..d1f777a3d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20011128-1.c @@ -0,0 +1,5 @@ +main() +{ + char blah[33] = "01234567890123456789"; + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20011217-1.c b/gcc/testsuite/gcc.c-torture/execute/20011217-1.c new file mode 100644 index 000000000..af9919f2d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20011217-1.c @@ -0,0 +1,12 @@ +int +main() +{ + double x = 1.0; + double y = 2.0; + + if ((y > x--) != 1) + abort (); + exit (0); +} + + diff --git a/gcc/testsuite/gcc.c-torture/execute/20011219-1.c b/gcc/testsuite/gcc.c-torture/execute/20011219-1.c new file mode 100644 index 000000000..d6455ab50 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20011219-1.c @@ -0,0 +1,49 @@ +/* This testcase failed on IA-32 at -O and above, because combine attached + a REG_LABEL note to jump instruction already using JUMP_LABEL. */ + +extern void abort (void); +extern void exit (int); + +enum X { A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q }; + +void +bar (const char *x, int y, const char *z) +{ +} + +long +foo (enum X x, const void *y) +{ + long a; + + switch (x) + { + case K: + a = *(long *)y; + break; + case L: + a = *(long *)y; + break; + case M: + a = *(long *)y; + break; + case N: + a = *(long *)y; + break; + case O: + a = *(long *)y; + break; + default: + bar ("foo", 1, "bar"); + } + return a; +} + +int +main () +{ + long i = 24; + if (foo (N, &i) != 24) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20011223-1.c b/gcc/testsuite/gcc.c-torture/execute/20011223-1.c new file mode 100644 index 000000000..18fb72089 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20011223-1.c @@ -0,0 +1,22 @@ +/* Origin: Joseph Myers . */ +/* Case labels in a switch statement are converted to the promoted + type of the controlling expression, not an unpromoted version. + Reported as PR c/2454 by + Andreas Krakowczyk . */ + +extern void exit (int); +extern void abort (void); + +static int i; + +int +main (void) +{ + i = -1; + switch ((signed char) i) { + case 255: + abort (); + default: + exit (0); + } +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020103-1.c b/gcc/testsuite/gcc.c-torture/execute/20020103-1.c new file mode 100644 index 000000000..c010aeaad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020103-1.c @@ -0,0 +1,28 @@ +/* On h8300 port, the following used to be broken with -mh or -ms. */ + +extern void abort (void); +extern void exit (int); + +unsigned long +foo (unsigned long a) +{ + return a ^ 0x0000ffff; +} + +unsigned long +bar (unsigned long a) +{ + return a ^ 0xffff0000; +} + +int +main () +{ + if (foo (0) != 0x0000ffff) + abort (); + + if (bar (0) != 0xffff0000) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020107-1.c b/gcc/testsuite/gcc.c-torture/execute/20020107-1.c new file mode 100644 index 000000000..d5bbcc413 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020107-1.c @@ -0,0 +1,28 @@ +/* This testcase failed because - 1 - buf was simplified into ~buf and when + later expanding it back into - buf + -1, -1 got lost. */ + +extern void abort (void); +extern void exit (int); + +static void +bar (int x) +{ + if (!x) + abort (); +} + +char buf[10]; + +inline char * +foo (char *tmp) +{ + asm ("" : "=r" (tmp) : "0" (tmp)); + return tmp + 2; +} + +int +main (void) +{ + bar ((foo (buf) - 1 - buf) == 1); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020108-1.c b/gcc/testsuite/gcc.c-torture/execute/20020108-1.c new file mode 100644 index 000000000..58f96673b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020108-1.c @@ -0,0 +1,203 @@ +/* This file tests shifts in various integral modes. */ + +#include + +#define CAT(A, B) A ## B + +#define REPEAT_8 \ +REPEAT_FN ( 0) \ +REPEAT_FN ( 1) \ +REPEAT_FN ( 2) \ +REPEAT_FN ( 3) \ +REPEAT_FN ( 4) \ +REPEAT_FN ( 5) \ +REPEAT_FN ( 6) \ +REPEAT_FN ( 7) + +#define REPEAT_16 \ +REPEAT_8 \ +REPEAT_FN ( 8) \ +REPEAT_FN ( 9) \ +REPEAT_FN (10) \ +REPEAT_FN (11) \ +REPEAT_FN (12) \ +REPEAT_FN (13) \ +REPEAT_FN (14) \ +REPEAT_FN (15) + +#define REPEAT_32 \ +REPEAT_16 \ +REPEAT_FN (16) \ +REPEAT_FN (17) \ +REPEAT_FN (18) \ +REPEAT_FN (19) \ +REPEAT_FN (20) \ +REPEAT_FN (21) \ +REPEAT_FN (22) \ +REPEAT_FN (23) \ +REPEAT_FN (24) \ +REPEAT_FN (25) \ +REPEAT_FN (26) \ +REPEAT_FN (27) \ +REPEAT_FN (28) \ +REPEAT_FN (29) \ +REPEAT_FN (30) \ +REPEAT_FN (31) + +/* Define 8-bit shifts. */ +#if CHAR_BIT == 8 +typedef unsigned int u8 __attribute__((mode(QI))); +typedef signed int s8 __attribute__((mode(QI))); + +#define REPEAT_FN(COUNT) \ +u8 CAT (ashift_qi_, COUNT) (u8 n) { return n << COUNT; } +REPEAT_8 +#undef REPEAT_FN + +#define REPEAT_FN(COUNT) \ +u8 CAT (lshiftrt_qi_, COUNT) (u8 n) { return n >> COUNT; } +REPEAT_8 +#undef REPEAT_FN + +#define REPEAT_FN(COUNT) \ +s8 CAT (ashiftrt_qi_, COUNT) (s8 n) { return n >> COUNT; } +REPEAT_8 +#undef REPEAT_FN +#endif /* CHAR_BIT == 8 */ + +/* Define 16-bit shifts. */ +#if CHAR_BIT == 8 || CHAR_BIT == 16 +#if CHAR_BIT == 8 +typedef unsigned int u16 __attribute__((mode(HI))); +typedef signed int s16 __attribute__((mode(HI))); +#elif CHAR_BIT == 16 +typedef unsigned int u16 __attribute__((mode(QI))); +typedef signed int s16 __attribute__((mode(QI))); +#endif + +#define REPEAT_FN(COUNT) \ +u16 CAT (ashift_hi_, COUNT) (u16 n) { return n << COUNT; } +REPEAT_16 +#undef REPEAT_FN + +#define REPEAT_FN(COUNT) \ +u16 CAT (lshiftrt_hi_, COUNT) (u16 n) { return n >> COUNT; } +REPEAT_16 +#undef REPEAT_FN + +#define REPEAT_FN(COUNT) \ +s16 CAT (ashiftrt_hi_, COUNT) (s16 n) { return n >> COUNT; } +REPEAT_16 +#undef REPEAT_FN +#endif /* CHAR_BIT == 8 || CHAR_BIT == 16 */ + +/* Define 32-bit shifts. */ +#if CHAR_BIT == 8 || CHAR_BIT == 16 || CHAR_BIT == 32 +#if CHAR_BIT == 8 +typedef unsigned int u32 __attribute__((mode(SI))); +typedef signed int s32 __attribute__((mode(SI))); +#elif CHAR_BIT == 16 +typedef unsigned int u32 __attribute__((mode(HI))); +typedef signed int s32 __attribute__((mode(HI))); +#elif CHAR_BIT == 32 +typedef unsigned int u32 __attribute__((mode(QI))); +typedef signed int s32 __attribute__((mode(QI))); +#endif + +#define REPEAT_FN(COUNT) \ +u32 CAT (ashift_si_, COUNT) (u32 n) { return n << COUNT; } +REPEAT_32 +#undef REPEAT_FN + +#define REPEAT_FN(COUNT) \ +u32 CAT (lshiftrt_si_, COUNT) (u32 n) { return n >> COUNT; } +REPEAT_32 +#undef REPEAT_FN + +#define REPEAT_FN(COUNT) \ +s32 CAT (ashiftrt_si_, COUNT) (s32 n) { return n >> COUNT; } +REPEAT_32 +#undef REPEAT_FN +#endif /* CHAR_BIT == 8 || CHAR_BIT == 16 || CHAR_BIT == 32 */ + +extern void abort (void); +extern void exit (int); + +int +main () +{ + /* Test 8-bit shifts. */ +#if CHAR_BIT == 8 +# define REPEAT_FN(COUNT) \ + if (CAT (ashift_qi_, COUNT) (0xff) != (u8) ((u8)0xff << COUNT)) abort (); + REPEAT_8; +# undef REPEAT_FN + +# define REPEAT_FN(COUNT) \ + if (CAT (lshiftrt_qi_, COUNT) (0xff) != (u8) ((u8)0xff >> COUNT)) abort (); + REPEAT_8; +# undef REPEAT_FN + +# define REPEAT_FN(COUNT) \ + if (CAT (ashiftrt_qi_, COUNT) (-1) != -1) abort (); + REPEAT_8; +# undef REPEAT_FN + +# define REPEAT_FN(COUNT) \ + if (CAT (ashiftrt_qi_, COUNT) (0) != 0) abort (); + REPEAT_8; +# undef REPEAT_FN +#endif /* CHAR_BIT == 8 */ + + /* Test 16-bit shifts. */ +#if CHAR_BIT == 8 || CHAR_BIT == 16 +# define REPEAT_FN(COUNT) \ + if (CAT (ashift_hi_, COUNT) (0xffff) \ + != (u16) ((u16) 0xffff << COUNT)) abort (); + REPEAT_16; +# undef REPEAT_FN + +# define REPEAT_FN(COUNT) \ + if (CAT (lshiftrt_hi_, COUNT) (0xffff) \ + != (u16) ((u16) 0xffff >> COUNT)) abort (); + REPEAT_16; +# undef REPEAT_FN + +# define REPEAT_FN(COUNT) \ + if (CAT (ashiftrt_hi_, COUNT) (-1) != -1) abort (); + REPEAT_16; +# undef REPEAT_FN + +# define REPEAT_FN(COUNT) \ + if (CAT (ashiftrt_hi_, COUNT) (0) != 0) abort (); + REPEAT_16; +# undef REPEAT_FN +#endif /* CHAR_BIT == 8 || CHAR_BIT == 16 */ + + /* Test 32-bit shifts. */ +#if CHAR_BIT == 8 || CHAR_BIT == 16 || CHAR_BIT == 32 +# define REPEAT_FN(COUNT) \ + if (CAT (ashift_si_, COUNT) (0xffffffff) \ + != (u32) ((u32) 0xffffffff << COUNT)) abort (); + REPEAT_32; +# undef REPEAT_FN + +# define REPEAT_FN(COUNT) \ + if (CAT (lshiftrt_si_, COUNT) (0xffffffff) \ + != (u32) ((u32) 0xffffffff >> COUNT)) abort (); + REPEAT_32; +# undef REPEAT_FN + +# define REPEAT_FN(COUNT) \ + if (CAT (ashiftrt_si_, COUNT) (-1) != -1) abort (); + REPEAT_32; +# undef REPEAT_FN + +# define REPEAT_FN(COUNT) \ + if (CAT (ashiftrt_si_, COUNT) (0) != 0) abort (); + REPEAT_32; +# undef REPEAT_FN +#endif /* CHAR_BIT == 8 || CHAR_BIT == 16 || CHAR_BIT == 32 */ + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020118-1.c b/gcc/testsuite/gcc.c-torture/execute/20020118-1.c new file mode 100644 index 000000000..fc53858c4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020118-1.c @@ -0,0 +1,33 @@ +/* This tests an insn length of sign extension on h8300 port. */ + +extern void exit (int); + +volatile signed char *q; +volatile signed int n; + +void +foo (void) +{ + signed char *p; + + for (;;) + { + p = (signed char *) q; n = p[2]; + p = (signed char *) q; n = p[2]; + p = (signed char *) q; n = p[2]; + p = (signed char *) q; n = p[2]; + p = (signed char *) q; n = p[2]; + p = (signed char *) q; n = p[2]; + p = (signed char *) q; n = p[2]; + p = (signed char *) q; n = p[2]; + p = (signed char *) q; n = p[2]; + p = (signed char *) q; n = p[2]; + p = (signed char *) q; n = p[2]; + } +} + +int +main () +{ + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020127-1.c b/gcc/testsuite/gcc.c-torture/execute/20020127-1.c new file mode 100644 index 000000000..88078dc50 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020127-1.c @@ -0,0 +1,22 @@ +/* This used to fail on h8300. */ + +extern void abort (void); +extern void exit (int); + +unsigned long +foo (unsigned long n) +{ + return (~n >> 3) & 1; +} + +int +main () +{ + if (foo (1 << 3) != 0) + abort (); + + if (foo (0) != 1) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020129-1.c b/gcc/testsuite/gcc.c-torture/execute/20020129-1.c new file mode 100644 index 000000000..6430c4c1c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020129-1.c @@ -0,0 +1,51 @@ +/* This testcase failed at -O2 on IA-64, because scheduling did not take + into account conditional execution when using cselib for alias + analysis. */ + +struct D { int d1; struct D *d2; }; +struct C { struct D c1; long c2, c3, c4, c5, c6; }; +struct A { struct A *a1; struct C *a2; }; +struct B { struct C b1; struct A *b2; }; + +extern void abort (void); +extern void exit (int); + +void +foo (struct B *x, struct B *y) +{ + if (x->b2 == 0) + { + struct A *a; + + x->b2 = a = y->b2; + y->b2 = 0; + for (; a; a = a->a1) + a->a2 = &x->b1; + } + + if (y->b2 != 0) + abort (); + + if (x->b1.c3 == -1) + { + x->b1.c3 = y->b1.c3; + x->b1.c4 = y->b1.c4; + y->b1.c3 = -1; + y->b1.c4 = 0; + } + + if (y->b1.c3 != -1) + abort (); +} + +struct B x, y; + +int main () +{ + y.b1.c1.d1 = 6; + y.b1.c3 = 145; + y.b1.c4 = 2448; + x.b1.c3 = -1; + foo (&x, &y); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020201-1.c b/gcc/testsuite/gcc.c-torture/execute/20020201-1.c new file mode 100644 index 000000000..b15f22825 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020201-1.c @@ -0,0 +1,37 @@ +/* Test whether division by constant works properly. */ + +extern void abort (void); +extern void exit (int); + +unsigned char cx = 7; +unsigned short sx = 14; +unsigned int ix = 21; +unsigned long lx = 28; +unsigned long long Lx = 35; + +int +main () +{ + unsigned char cy; + unsigned short sy; + unsigned int iy; + unsigned long ly; + unsigned long long Ly; + + cy = cx / 6; if (cy != 1) abort (); + cy = cx % 6; if (cy != 1) abort (); + + sy = sx / 6; if (sy != 2) abort (); + sy = sx % 6; if (sy != 2) abort (); + + iy = ix / 6; if (iy != 3) abort (); + iy = ix % 6; if (iy != 3) abort (); + + ly = lx / 6; if (ly != 4) abort (); + ly = lx % 6; if (ly != 4) abort (); + + Ly = Lx / 6; if (Ly != 5) abort (); + Ly = Lx % 6; if (Ly != 5) abort (); + + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020206-1.c b/gcc/testsuite/gcc.c-torture/execute/20020206-1.c new file mode 100644 index 000000000..8450800a1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020206-1.c @@ -0,0 +1,26 @@ +struct A { + unsigned int a, b, c; +}; + +extern void abort (void); +extern void exit (int); + +struct A bar (void) +{ + return (struct A) { 176, 52, 31 }; +} + +void baz (struct A *a) +{ + if (a->a != 176 || a->b != 52 || a->c != 31) + abort (); +} + +int main () +{ + struct A d; + + d = ({ ({ bar (); }); }); + baz (&d); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020206-2.c b/gcc/testsuite/gcc.c-torture/execute/20020206-2.c new file mode 100644 index 000000000..097eb3055 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020206-2.c @@ -0,0 +1,24 @@ +/* Origin: PR c/5420 from David Mosberger . + This testcase was miscompiled when tail call optimizing, because a + compound literal initialization was emitted only in the tail call insn + chain, not in the normal call insn chain. */ + +typedef struct { unsigned short a; } A; + +extern void abort (void); +extern void exit (int); + +void foo (unsigned int x) +{ + if (x != 0x800 && x != 0x810) + abort (); +} + +int +main (int argc, char **argv) +{ + int i; + for (i = 0; i < 2; ++i) + foo (((A) { ((!(i >> 4) ? 8 : 64 + (i >> 4)) << 8) + (i << 4) } ).a); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020213-1.c b/gcc/testsuite/gcc.c-torture/execute/20020213-1.c new file mode 100644 index 000000000..f9fefee26 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020213-1.c @@ -0,0 +1,34 @@ +/* PR c/5681 + This testcase failed on IA-32 at -O0, because safe_from_p + incorrectly assumed it is safe to first write into a.a2 b-1 + and then read the original value from it. */ + +int bar (float); + +struct A { + float a1; + int a2; +} a; + +int b; + +void foo (void) +{ + a.a2 = bar (a.a1); + a.a2 = a.a2 < b - 1 ? a.a2 : b - 1; + if (a.a2 >= b - 1) + abort (); +} + +int bar (float x) +{ + return 2241; +} + +int main() +{ + a.a1 = 1.0f; + b = 3384; + foo (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020215-1.c b/gcc/testsuite/gcc.c-torture/execute/20020215-1.c new file mode 100644 index 000000000..f1f46d57d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020215-1.c @@ -0,0 +1,33 @@ +/* Test failed on an architecture that: + + - had 16-bit registers, + - passed 64-bit structures in registers, + - only allowed SImode values in even numbered registers. + + Before reload, s.i2 in foo() was represented as: + + (subreg:SI (reg:DI 0) 2) + + find_dummy_reload would return (reg:SI 1) for the subreg reload, + despite that not being a valid register. */ + +struct s +{ + short i1; + long i2; + short i3; +}; + +struct s foo (struct s s) +{ + s.i2++; + return s; +} + +int main () +{ + struct s s = foo ((struct s) { 1000, 2000L, 3000 }); + if (s.i1 != 1000 || s.i2 != 2001L || s.i3 != 3000) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020216-1.c b/gcc/testsuite/gcc.c-torture/execute/20020216-1.c new file mode 100644 index 000000000..bf62de568 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020216-1.c @@ -0,0 +1,24 @@ +/* PR c/3444 + This used to fail because bitwise xor was improperly computed in char type + and sign extended to int type. */ + +extern void abort (); +extern void exit (int); + +signed char c = (signed char) 0xffffffff; + +int foo (void) +{ + return (unsigned short) c ^ (signed char) 0x99999999; +} + +int main (void) +{ + if ((unsigned char) -1 != 0xff + || sizeof (short) != 2 + || sizeof (int) != 4) + exit (0); + if (foo () != (int) 0xffff0066) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020219-1.c b/gcc/testsuite/gcc.c-torture/execute/20020219-1.c new file mode 100644 index 000000000..48200e319 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020219-1.c @@ -0,0 +1,21 @@ +/* PR c/4308 + This testcase failed because 0x8000000000000000 >> 0 + was incorrectly folded into 0xffffffff00000000. */ + +extern void abort (void); +extern void exit (int); + +long long foo (void) +{ + long long C = 1ULL << 63, X; + int Y = 32; + X = C >> (Y & 31); + return X; +} + +int main (void) +{ + if (foo () != 1ULL << 63) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020225-1.c b/gcc/testsuite/gcc.c-torture/execute/20020225-1.c new file mode 100644 index 000000000..514730a09 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020225-1.c @@ -0,0 +1,17 @@ +/* This testcase failed at -O2 on powerpc64 due to andsi3 writing + nonzero bits to the high 32 bits of a 64 bit register. */ + +extern void abort (void); +extern void exit (int); + +unsigned long foo (unsigned long base, unsigned int val) +{ + return base + (val & 0x80000001); +} + +int main (void) +{ + if (foo (0L, 0x0ffffff0) != 0L) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020225-2.c b/gcc/testsuite/gcc.c-torture/execute/20020225-2.c new file mode 100644 index 000000000..5c9159609 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020225-2.c @@ -0,0 +1,19 @@ +static int +test(int x) +{ + union + { + int i; + double d; + } a; + a.d = 0; + a.i = 1; + return x >> a.i; +} + +int main(void) +{ + if (test (5) != 2) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020226-1.c b/gcc/testsuite/gcc.c-torture/execute/20020226-1.c new file mode 100644 index 000000000..6372ffc27 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020226-1.c @@ -0,0 +1,104 @@ +/* This tests the rotate patterns that some machines support. */ + +#include + +#ifndef CHAR_BIT +#define CHAR_BIT 8 +#endif + +#define ROR(a,b) (((a) >> (b)) | ((a) << ((sizeof (a) * CHAR_BIT) - (b)))) +#define ROL(a,b) (((a) << (b)) | ((a) >> ((sizeof (a) * CHAR_BIT) - (b)))) + +#define CHAR_VALUE ((unsigned char)0x1234U) +#define SHORT_VALUE ((unsigned short)0x1234U) +#define INT_VALUE 0x1234U +#define LONG_VALUE 0x12345678LU +#define LL_VALUE 0x12345678abcdef0LLU + +#define SHIFT1 4 +#define SHIFT2 ((sizeof (long long) * CHAR_BIT) - SHIFT1) + +unsigned char uc = CHAR_VALUE; +unsigned short us = SHORT_VALUE; +unsigned int ui = INT_VALUE; +unsigned long ul = LONG_VALUE; +unsigned long long ull = LL_VALUE; +int shift1 = SHIFT1; +int shift2 = SHIFT2; + +main () +{ + if (ROR (uc, shift1) != ROR (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROR (uc, SHIFT1) != ROR (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROR (us, shift1) != ROR (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROR (us, SHIFT1) != ROR (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROR (ui, shift1) != ROR (INT_VALUE, SHIFT1)) + abort (); + + if (ROR (ui, SHIFT1) != ROR (INT_VALUE, SHIFT1)) + abort (); + + if (ROR (ul, shift1) != ROR (LONG_VALUE, SHIFT1)) + abort (); + + if (ROR (ul, SHIFT1) != ROR (LONG_VALUE, SHIFT1)) + abort (); + + if (ROR (ull, shift1) != ROR (LL_VALUE, SHIFT1)) + abort (); + + if (ROR (ull, SHIFT1) != ROR (LL_VALUE, SHIFT1)) + abort (); + + if (ROR (ull, shift2) != ROR (LL_VALUE, SHIFT2)) + abort (); + + if (ROR (ull, SHIFT2) != ROR (LL_VALUE, SHIFT2)) + abort (); + + if (ROL (uc, shift1) != ROL (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROL (uc, SHIFT1) != ROL (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROL (us, shift1) != ROL (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROL (us, SHIFT1) != ROL (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROL (ui, shift1) != ROL (INT_VALUE, SHIFT1)) + abort (); + + if (ROL (ui, SHIFT1) != ROL (INT_VALUE, SHIFT1)) + abort (); + + if (ROL (ul, shift1) != ROL (LONG_VALUE, SHIFT1)) + abort (); + + if (ROL (ul, SHIFT1) != ROL (LONG_VALUE, SHIFT1)) + abort (); + + if (ROL (ull, shift1) != ROL (LL_VALUE, SHIFT1)) + abort (); + + if (ROL (ull, SHIFT1) != ROL (LL_VALUE, SHIFT1)) + abort (); + + if (ROL (ull, shift2) != ROL (LL_VALUE, SHIFT2)) + abort (); + + if (ROL (ull, SHIFT2) != ROL (LL_VALUE, SHIFT2)) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020227-1.c b/gcc/testsuite/gcc.c-torture/execute/20020227-1.c new file mode 100644 index 000000000..0f83088bf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020227-1.c @@ -0,0 +1,30 @@ +/* This testcase failed on mmix-knuth-mmixware. Problem was with storing + to an unaligned mem:SC, gcc tried doing it by parts from a (concat:SC + (reg:SF 293) (reg:SF 294)). */ + +typedef __complex__ float cf; +struct x { char c; cf f; } __attribute__ ((__packed__)); +extern void f2 (struct x*); +extern void f1 (void); +int +main (void) +{ + f1 (); + exit (0); +} + +void +f1 (void) +{ + struct x s; + s.f = 1; + s.c = 42; + f2 (&s); +} + +void +f2 (struct x *y) +{ + if (y->f != 1 || y->c != 42) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020307-1.c b/gcc/testsuite/gcc.c-torture/execute/20020307-1.c new file mode 100644 index 000000000..c6379de3e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020307-1.c @@ -0,0 +1,69 @@ +#define MASK(N) ((1UL << (N)) - 1) +#define BITS(N) ((1UL << ((N) - 1)) + 2) + +#define FUNC(N) void f##N(long j) { if ((j & MASK(N)) >= BITS(N)) abort();} + +FUNC(3) +FUNC(4) +FUNC(5) +FUNC(6) +FUNC(7) +FUNC(8) +FUNC(9) +FUNC(10) +FUNC(11) +FUNC(12) +FUNC(13) +FUNC(14) +FUNC(15) +FUNC(16) +FUNC(17) +FUNC(18) +FUNC(19) +FUNC(20) +FUNC(21) +FUNC(22) +FUNC(23) +FUNC(24) +FUNC(25) +FUNC(26) +FUNC(27) +FUNC(28) +FUNC(29) +FUNC(30) +FUNC(31) + +int main () +{ + f3(0); + f4(0); + f5(0); + f6(0); + f7(0); + f8(0); + f9(0); + f10(0); + f11(0); + f12(0); + f13(0); + f14(0); + f15(0); + f16(0); + f17(0); + f18(0); + f19(0); + f20(0); + f21(0); + f22(0); + f23(0); + f24(0); + f25(0); + f26(0); + f27(0); + f28(0); + f29(0); + f30(0); + f31(0); + + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020314-1.c b/gcc/testsuite/gcc.c-torture/execute/20020314-1.c new file mode 100644 index 000000000..28288c82c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020314-1.c @@ -0,0 +1,36 @@ +void f(void * a, double y) +{ +} + +double g (double a, double b, double c, double d) +{ + double x, y, z; + void *p; + + x = a + b; + y = c * d; + + p = alloca (16); + + f(p, y); + z = x * y * a; + + return z + b; +} + +main () +{ + double a, b, c, d; + a = 1.0; + b = 0.0; + c = 10.0; + d = 0.0; + + if (g (a, b, c, d) != 0.0) + abort (); + + if (a != 1.0 || b != 0.0 || c != 10.0 || d != 0.0) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020320-1.c b/gcc/testsuite/gcc.c-torture/execute/20020320-1.c new file mode 100644 index 000000000..05f72c654 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020320-1.c @@ -0,0 +1,23 @@ +/* PR c/5354 */ +/* Verify that GCC preserves relevant stack slots. */ + +extern void abort(void); +extern void exit(int); + +struct large { int x, y[9]; }; + +int main() +{ + int fixed; + + fixed = ({ int temp1 = 2; temp1; }) - ({ int temp2 = 1; temp2; }); + if (fixed != 1) + abort(); + + fixed = ({ struct large temp3; temp3.x = 2; temp3; }).x + - ({ struct large temp4; temp4.x = 1; temp4; }).x; + if (fixed != 1) + abort(); + + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020321-1.c b/gcc/testsuite/gcc.c-torture/execute/20020321-1.c new file mode 100644 index 000000000..d06dd0acd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020321-1.c @@ -0,0 +1,20 @@ +/* PR 3177 */ +/* Produced a SIGILL on ia64 with sibcall from F to G. We hadn't + widened the register window to allow for the fourth outgoing + argument as an "in" register. */ + +float g (void *a, void *b, int e, int c, float d) +{ + return d; +} + +float f (void *a, void *b, int c, float d) +{ + return g (a, b, 0, c, d); +} + +int main () +{ + f (0, 0, 1, 1); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020328-1.c b/gcc/testsuite/gcc.c-torture/execute/20020328-1.c new file mode 100644 index 000000000..4b6f2bf4e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020328-1.c @@ -0,0 +1,25 @@ +int b = 0; + +func () { } + +void +testit(int x) +{ + if (x != 20) + abort (); +} + +int +main() + +{ + int a = 0; + + if (b) + func(); + + /* simplify_and_const_int would incorrectly omit the mask in + the line below. */ + testit ((a + 23) & 0xfffffffc); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020402-1.c b/gcc/testsuite/gcc.c-torture/execute/20020402-1.c new file mode 100644 index 000000000..fe2a6f657 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020402-1.c @@ -0,0 +1,41 @@ +/* derived from PR c/2100 */ + +extern void abort (); +extern void exit (int); + +#define SMALL_N 2 +#define NUM_ELEM 4 + +int main(void) +{ + int listElem[NUM_ELEM]={30,2,10,5}; + int listSmall[SMALL_N]; + int i, j; + int posGreatest=-1, greatest=-1; + + for (i=0; i greatest) { + posGreatest = i; + greatest = listElem[i]; + } + } + + for (i=SMALL_N; i greatest) { + posGreatest = j; + greatest = listSmall[j]; + } + } + } + + if (listSmall[0] != 5 || listSmall[1] != 2) + abort (); + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20020402-2.c b/gcc/testsuite/gcc.c-torture/execute/20020402-2.c new file mode 100644 index 000000000..e14233f3e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020402-2.c @@ -0,0 +1,230 @@ +/* PR 3967 + + local-alloc screwed up consideration of high+lo_sum and created + reg_equivs that it shouldn't have, resulting in lo_sum with + uninitialized data, resulting in segv. The test has to remain + relatively large, since register spilling is required to twig + the bug. */ + +unsigned long *Local1; +unsigned long *Local2; +unsigned long *Local3; +unsigned long *RDbf1; +unsigned long *RDbf2; +unsigned long *RDbf3; +unsigned long *IntVc1; +unsigned long *IntVc2; +unsigned long *IntCode3; +unsigned long *IntCode4; +unsigned long *IntCode5; +unsigned long *IntCode6; +unsigned long *Lom1; +unsigned long *Lom2; +unsigned long *Lom3; +unsigned long *Lom4; +unsigned long *Lom5; +unsigned long *Lom6; +unsigned long *Lom7; +unsigned long *Lom8; +unsigned long *Lom9; +unsigned long *Lom10; +unsigned long *RDbf11; +unsigned long *RDbf12; + +typedef struct + { + long a1; + unsigned long n1; + unsigned long local1; + unsigned long local2; + unsigned long local3; + unsigned long rdbf1; + unsigned long rdbf2; + unsigned long milli; + unsigned long frames1; + unsigned long frames2; + unsigned long nonShared; + long newPrivate; + long freeLimit; + unsigned long cache1; + unsigned long cache2; + unsigned long cache3; + unsigned long cache4; + unsigned long cache5; + unsigned long time6; + unsigned long frames7; + unsigned long page8; + unsigned long ot9; + unsigned long data10; + unsigned long bm11; + unsigned long misc12; + } +ShrPcCommonStatSType; + + +typedef struct + { + unsigned long sharedAttached; + unsigned long totalAttached; + long avgPercentShared; + unsigned long numberOfFreeFrames; + unsigned long localDirtyPageCount; + unsigned long globalDirtyPageCount; + long wakeupInterval; + unsigned long numActiveProcesses; + unsigned long numRecentActiveProcesses; + unsigned long gemDirtyPageKinds[10]; + unsigned long stoneDirtyPageKinds[10]; + unsigned long gemsInCacheCount; + long targetFreeFrameCount; + } +ShrPcMonStatSType; + +typedef struct + { + unsigned long c1; + unsigned long c2; + unsigned long c3; + unsigned long c4; + unsigned long c5; + unsigned long c6; + unsigned long c7; + unsigned long c8; + unsigned long c9; + unsigned long c10; + unsigned long c11; + unsigned long c12; + unsigned long a1; + unsigned long a2; + unsigned long a3; + unsigned long a4; + unsigned long a5; + unsigned long a6; + unsigned long a7; + unsigned long a8; + unsigned long a9; + unsigned long a10; + unsigned long a11; + unsigned long a12; + unsigned long a13; + unsigned long a14; + unsigned long a15; + unsigned long a16; + unsigned long a17; + unsigned long a18; + unsigned long a19; + unsigned long sessionStats[40]; + } +ShrPcGemStatSType; + +union ShrPcStatUnion + { + ShrPcMonStatSType monitor; + ShrPcGemStatSType gem; + }; + +typedef struct + { + int processId; + int sessionId; + ShrPcCommonStatSType cmn; + union ShrPcStatUnion u; + } ShrPcStatsSType; + +typedef struct + { + unsigned long *p1; + unsigned long *p2; + unsigned long *p3; + unsigned long *p4; + unsigned long *p5; + unsigned long *p6; + unsigned long *p7; + unsigned long *p8; + unsigned long *p9; + unsigned long *p10; + unsigned long *p11; + } +WorkEntrySType; + +WorkEntrySType Workspace; + +static void +setStatPointers (ShrPcStatsSType * statsPtr, long sessionId) +{ + statsPtr->sessionId = sessionId; + statsPtr->cmn.a1 = 0; + statsPtr->cmn.n1 = 5; + + Local1 = &statsPtr->cmn.local1; + Local2 = &statsPtr->cmn.local2; + Local3 = &statsPtr->cmn.local3; + RDbf1 = &statsPtr->cmn.rdbf1; + RDbf2 = &statsPtr->cmn.rdbf2; + RDbf3 = &statsPtr->cmn.milli; + *RDbf3 = 1; + + IntVc1 = &statsPtr->u.gem.a1; + IntVc2 = &statsPtr->u.gem.a2; + IntCode3 = &statsPtr->u.gem.a3; + IntCode4 = &statsPtr->u.gem.a4; + IntCode5 = &statsPtr->u.gem.a5; + IntCode6 = &statsPtr->u.gem.a6; + + { + WorkEntrySType *workSpPtr; + workSpPtr = &Workspace; + workSpPtr->p1 = &statsPtr->u.gem.a7; + workSpPtr->p2 = &statsPtr->u.gem.a8; + workSpPtr->p3 = &statsPtr->u.gem.a9; + workSpPtr->p4 = &statsPtr->u.gem.a10; + workSpPtr->p5 = &statsPtr->u.gem.a11; + workSpPtr->p6 = &statsPtr->u.gem.a12; + workSpPtr->p7 = &statsPtr->u.gem.a13; + workSpPtr->p8 = &statsPtr->u.gem.a14; + workSpPtr->p9 = &statsPtr->u.gem.a15; + workSpPtr->p10 = &statsPtr->u.gem.a16; + workSpPtr->p11 = &statsPtr->u.gem.a17; + } + Lom1 = &statsPtr->u.gem.c1; + Lom2 = &statsPtr->u.gem.c2; + Lom3 = &statsPtr->u.gem.c3; + Lom4 = &statsPtr->u.gem.c4; + Lom5 = &statsPtr->u.gem.c5; + Lom6 = &statsPtr->u.gem.c6; + Lom7 = &statsPtr->u.gem.c7; + Lom8 = &statsPtr->u.gem.c8; + Lom9 = &statsPtr->u.gem.c9; + Lom10 = &statsPtr->u.gem.c10; + RDbf11 = &statsPtr->u.gem.c11; + RDbf12 = &statsPtr->u.gem.c12; +} + +typedef struct +{ + ShrPcStatsSType stats; +} ShrPcPteSType; + +ShrPcPteSType MyPte; + +static void +initPte (void *shrpcPtr, long sessionId) +{ + ShrPcPteSType *ptePtr; + + ptePtr = &MyPte; + setStatPointers (&ptePtr->stats, sessionId); +} + +void +InitCache (int sessionId) +{ + initPte (0, sessionId); +} + +int +main (int argc, char *argv[]) +{ + InitCache (5); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020402-3.c b/gcc/testsuite/gcc.c-torture/execute/20020402-3.c new file mode 100644 index 000000000..eef274093 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020402-3.c @@ -0,0 +1,81 @@ +/* extracted from gdb sources */ + +typedef unsigned long long CORE_ADDR; + +struct blockvector; + +struct symtab { + struct blockvector *blockvector; +}; + +struct sec { + void *unused; +}; + +struct symbol { + int len; + char *name; +}; + +struct block { + CORE_ADDR startaddr, endaddr; + struct symbol *function; + struct block *superblock; + unsigned char gcc_compile_flag; + int nsyms; + struct symbol syms[1]; +}; + +struct blockvector { + int nblocks; + struct block *block[2]; +}; + +struct blockvector *blockvector_for_pc_sect(register CORE_ADDR pc, + struct symtab *symtab) +{ + register struct block *b; + register int bot, top, half; + struct blockvector *bl; + + bl = symtab->blockvector; + b = bl->block[0]; + + bot = 0; + top = bl->nblocks; + + while (top - bot > 1) + { + half = (top - bot + 1) >> 1; + b = bl->block[bot + half]; + if (b->startaddr <= pc) + bot += half; + else + top = bot + half; + } + + while (bot >= 0) + { + b = bl->block[bot]; + if (b->endaddr > pc) + { + return bl; + } + bot--; + } + return 0; +} + +int main(void) +{ + struct block a = { 0, 0x10000, 0, 0, 1, 20 }; + struct block b = { 0x10000, 0x20000, 0, 0, 1, 20 }; + struct blockvector bv = { 2, { &a, &b } }; + struct symtab s = { &bv }; + + struct blockvector *ret; + + ret = blockvector_for_pc_sect(0x500, &s); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020404-1.c b/gcc/testsuite/gcc.c-torture/execute/20020404-1.c new file mode 100644 index 000000000..dc62b15bb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020404-1.c @@ -0,0 +1,102 @@ +/* Extracted from GDB sources. */ + +typedef long long bfd_signed_vma; +typedef bfd_signed_vma file_ptr; + +typedef enum bfd_boolean {false, true} boolean; + +typedef unsigned long long bfd_size_type; + +typedef unsigned int flagword; + +typedef unsigned long long CORE_ADDR; +typedef unsigned long long bfd_vma; + +struct bfd_struct { + int x; +}; + +struct asection_struct { + unsigned int user_set_vma : 1; + bfd_vma vma; + bfd_vma lma; + unsigned int alignment_power; + unsigned int entsize; +}; + +typedef struct bfd_struct bfd; +typedef struct asection_struct asection; + +static bfd * +bfd_openw_with_cleanup (char *filename, const char *target, char *mode); + +static asection * +bfd_make_section_anyway (bfd *abfd, const char *name); + +static boolean +bfd_set_section_size (bfd *abfd, asection *sec, bfd_size_type val); + +static boolean +bfd_set_section_flags (bfd *abfd, asection *sec, flagword flags); + +static boolean +bfd_set_section_contents (bfd *abfd, asection *section, void * data, file_ptr offset, bfd_size_type count); + +static void +dump_bfd_file (char *filename, char *mode, + char *target, CORE_ADDR vaddr, + char *buf, int len) +{ + bfd *obfd; + asection *osection; + + obfd = bfd_openw_with_cleanup (filename, target, mode); + osection = bfd_make_section_anyway (obfd, ".newsec"); + bfd_set_section_size (obfd, osection, len); + (((osection)->vma = (osection)->lma= (vaddr)), ((osection)->user_set_vma = (boolean)true), true); + (((osection)->alignment_power = (0)),true); + bfd_set_section_flags (obfd, osection, 0x203); + osection->entsize = 0; + bfd_set_section_contents (obfd, osection, buf, 0, len); +} + +static bfd * +bfd_openw_with_cleanup (char *filename, const char *target, char *mode) +{ + static bfd foo_bfd = { 0 }; + return &foo_bfd; +} + +static asection * +bfd_make_section_anyway (bfd *abfd, const char *name) +{ + static asection foo_section = { false, 0x0, 0x0, 0 }; + + return &foo_section; +} + +static boolean +bfd_set_section_size (bfd *abfd, asection *sec, bfd_size_type val) +{ + return true; +} + +static boolean +bfd_set_section_flags (bfd *abfd, asection *sec, flagword flags) +{ +} + +static boolean +bfd_set_section_contents (bfd *abfd, asection *section, void * data, file_ptr offset, bfd_size_type count) +{ + if (count != (bfd_size_type)0x1eadbeef) + abort(); +} + +static char hello[] = "hello"; + +int main(void) +{ + dump_bfd_file(0, 0, 0, (CORE_ADDR)0xdeadbeef, hello, (int)0x1eadbeef); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020404-1.x b/gcc/testsuite/gcc.c-torture/execute/20020404-1.x new file mode 100644 index 000000000..e4fd61a44 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020404-1.x @@ -0,0 +1,15 @@ +load_lib target-supports.exp + +if { [check_effective_target_int16] } { + return 1 +} + +# m32c pointers can be 24 bits in a 32 bit variable, so the test +# patterns may get truncated. +if { [istarget "m32c-*-*"] } { + return 1 +} + + +return 0 + diff --git a/gcc/testsuite/gcc.c-torture/execute/20020406-1.c b/gcc/testsuite/gcc.c-torture/execute/20020406-1.c new file mode 100644 index 000000000..69a82f658 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020406-1.c @@ -0,0 +1,126 @@ +// Origin: abbott@dima.unige.it +// PR c/5120 + +extern void * malloc (__SIZE_TYPE__); +extern void * calloc (__SIZE_TYPE__, __SIZE_TYPE__); + +typedef unsigned int FFelem; + +FFelem FFmul(const FFelem x, const FFelem y) +{ + return x; +} + + +struct DUPFFstruct +{ + int maxdeg; + int deg; + FFelem *coeffs; +}; + +typedef struct DUPFFstruct *DUPFF; + + +int DUPFFdeg(const DUPFF f) +{ + return f->deg; +} + + +DUPFF DUPFFnew(const int maxdeg) +{ + DUPFF ans = (DUPFF)malloc(sizeof(struct DUPFFstruct)); + ans->coeffs = 0; + if (maxdeg >= 0) ans->coeffs = (FFelem*)calloc(maxdeg+1,sizeof(FFelem)); + ans->maxdeg = maxdeg; + ans->deg = -1; + return ans; +} + +void DUPFFfree(DUPFF x) +{ +} + +void DUPFFswap(DUPFF x, DUPFF y) +{ +} + + +DUPFF DUPFFcopy(const DUPFF x) +{ + return x; +} + + +void DUPFFshift_add(DUPFF f, const DUPFF g, int deg, const FFelem coeff) +{ +} + + +DUPFF DUPFFexgcd(DUPFF *fcofac, DUPFF *gcofac, const DUPFF f, const DUPFF g) +{ + DUPFF u, v, uf, ug, vf, vg; + FFelem q, lcu, lcvrecip, p; + int df, dg, du, dv; + + printf("DUPFFexgcd called on degrees %d and %d\n", DUPFFdeg(f), DUPFFdeg(g)); + if (DUPFFdeg(f) < DUPFFdeg(g)) return DUPFFexgcd(gcofac, fcofac, g, f); /*** BUG IN THIS LINE ***/ + if (DUPFFdeg(f) != 2 || DUPFFdeg(g) != 1) abort(); + if (f->coeffs[0] == 0) return f; + /****** NEVER REACH HERE IN THE EXAMPLE ******/ + p = 2; + + df = DUPFFdeg(f); if (df < 0) df = 0; /* both inputs are zero */ + dg = DUPFFdeg(g); if (dg < 0) dg = 0; /* one input is zero */ + u = DUPFFcopy(f); + v = DUPFFcopy(g); + + uf = DUPFFnew(dg); uf->coeffs[0] = 1; uf->deg = 0; + ug = DUPFFnew(df); + vf = DUPFFnew(dg); + vg = DUPFFnew(df); vg->coeffs[0] = 1; vg->deg = 0; + + while (DUPFFdeg(v) > 0) + { + dv = DUPFFdeg(v); + lcvrecip = FFmul(1, v->coeffs[dv]); + while (DUPFFdeg(u) >= dv) + { + du = DUPFFdeg(u); + lcu = u->coeffs[du]; + q = FFmul(lcu, lcvrecip); + DUPFFshift_add(u, v, du-dv, p-q); + DUPFFshift_add(uf, vf, du-dv, p-q); + DUPFFshift_add(ug, vg, du-dv, p-q); + } + DUPFFswap(u, v); + DUPFFswap(uf, vf); + DUPFFswap(ug, vg); + } + if (DUPFFdeg(v) == 0) + { + DUPFFswap(u, v); + DUPFFswap(uf, vf); + DUPFFswap(ug, vg); + } + DUPFFfree(vf); + DUPFFfree(vg); + DUPFFfree(v); + *fcofac = uf; + *gcofac = ug; + return u; +} + + + +int main() +{ + DUPFF f, g, cf, cg, h; + f = DUPFFnew(1); f->coeffs[1] = 1; f->deg = 1; + g = DUPFFnew(2); g->coeffs[2] = 1; g->deg = 2; + + printf("calling DUPFFexgcd on degrees %d and %d\n", DUPFFdeg(f), DUPFFdeg(g)) ; + h = DUPFFexgcd(&cf, &cg, f, g); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020411-1.c b/gcc/testsuite/gcc.c-torture/execute/20020411-1.c new file mode 100644 index 000000000..89e2bae70 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020411-1.c @@ -0,0 +1,25 @@ +/* PR optimization/6177 + This testcase ICEd because expr.c did not expect to see a CONCAT + as array rtl. */ + +extern void abort (void); +extern void exit (int); + +__complex__ float foo (void) +{ + __complex__ float f[1]; + __real__ f[0] = 1.0; + __imag__ f[0] = 1.0; + f[0] = __builtin_conjf (f[0]); + return f[0]; +} + +int main (void) +{ + __complex__ double d[1]; + d[0] = foo (); + if (__real__ d[0] != 1.0 + || __imag__ d[0] != -1.0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020412-1.c b/gcc/testsuite/gcc.c-torture/execute/20020412-1.c new file mode 100644 index 000000000..df0efe008 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020412-1.c @@ -0,0 +1,56 @@ +/* PR c/3711 + This testcase ICEd on IA-32 at -O0 and was miscompiled otherwise, + because std_expand_builtin_va_arg didn't handle variable size types. */ + +#include + +extern void abort (void); +extern void exit (int); + +void bar (int c) +{ + static int d = '0'; + + if (c != d++) + abort (); + if (c < '0' || c > '9') + abort (); +} + +void foo (int size, ...) +{ + struct + { + char x[size]; + } d; + va_list ap; + int i; + + va_start (ap, size); + d = va_arg (ap, typeof (d)); + for (i = 0; i < size; i++) + bar (d.x[i]); + d = va_arg (ap, typeof (d)); + for (i = 0; i < size; i++) + bar (d.x[i]); + va_end (ap); +} + +int main (void) +{ + int z = 5; + struct { char a[z]; } x, y; + + x.a[0] = '0'; + x.a[1] = '1'; + x.a[2] = '2'; + x.a[3] = '3'; + x.a[4] = '4'; + y.a[0] = '5'; + y.a[1] = '6'; + y.a[2] = '7'; + y.a[3] = '8'; + y.a[4] = '9'; + foo (z, x, y); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020413-1.c b/gcc/testsuite/gcc.c-torture/execute/20020413-1.c new file mode 100644 index 000000000..fdef9eed7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020413-1.c @@ -0,0 +1,36 @@ +void test(long double val, int *eval) +{ + long double tmp = 1.0l; + int i = 0; + + if (val < 0.0l) + val = -val; + + if (val >= tmp) + while (tmp < val) + { + tmp *= 2.0l; + if (i++ >= 10) + abort (); + } + else if (val != 0.0l) + while (val < tmp) + { + tmp /= 2.0l; + if (i++ >= 10) + abort (); + } + + *eval = i; +} + +int main(void) +{ + int eval; + + test(3.0, &eval); + test(3.5, &eval); + test(4.0, &eval); + test(5.0, &eval); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020418-1.c b/gcc/testsuite/gcc.c-torture/execute/20020418-1.c new file mode 100644 index 000000000..953f96e86 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020418-1.c @@ -0,0 +1,24 @@ +/* ifcvt accidently deletes a referenced label while generating + conditional traps on machines having such patterns */ + +struct foo { int a; }; + +void gcc_crash(struct foo *p) +{ + if (__builtin_expect(p->a < 52, 0)) + __builtin_trap(); + top: + p->a++; + if (p->a >= 62) + goto top; +} + +int main(void) +{ + struct foo x; + + x.a = 53; + gcc_crash(&x); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020423-1.c b/gcc/testsuite/gcc.c-torture/execute/20020423-1.c new file mode 100644 index 000000000..5f744b6f9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020423-1.c @@ -0,0 +1,33 @@ +/* PR c/5430 */ +/* Verify that the multiplicative folding code is not fooled + by the mix between signed variables and unsigned constants. */ + +extern void abort (void); +extern void exit (int); + +int main (void) +{ + int my_int = 924; + unsigned int result; + + result = ((my_int*2 + 4) - 8U) / 2; + if (result != 922U) + abort(); + + result = ((my_int*2 - 4U) + 2) / 2; + if (result != 923U) + abort(); + + result = (((my_int + 2) * 2) - 8U - 4) / 2; + if (result != 920U) + abort(); + result = (((my_int + 2) * 2) - (8U + 4)) / 2; + if (result != 920U) + abort(); + + result = ((my_int*4 + 2U) - 4U) / 2; + if (result != 1847U) + abort(); + + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020503-1.c b/gcc/testsuite/gcc.c-torture/execute/20020503-1.c new file mode 100644 index 000000000..6d45ca09a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020503-1.c @@ -0,0 +1,31 @@ +/* PR 6534 */ +/* GCSE unified the two i<0 tests, but if-conversion to ui=abs(i) + insertted the code at the wrong place corrupting the i<0 test. */ + +void abort (void); +static char * +inttostr (long i, char buf[128]) +{ + unsigned long ui = i; + char *p = buf + 127; + *p = '\0'; + if (i < 0) + ui = -ui; + do + *--p = '0' + ui % 10; + while ((ui /= 10) != 0); + if (i < 0) + *--p = '-'; + return p; +} + +int +main () +{ + char buf[128], *p; + + p = inttostr (-1, buf); + if (*p != '-') + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020506-1.c b/gcc/testsuite/gcc.c-torture/execute/20020506-1.c new file mode 100644 index 000000000..bcbd45bf6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020506-1.c @@ -0,0 +1,333 @@ +/* Copyright (C) 2002 Free Software Foundation. + + Test that (A & C1) op C2 optimizations behave correctly where C1 is + a constant power of 2, op is == or !=, and C2 is C1 or zero. + + Written by Roger Sayle, 5th May 2002. */ + +#include + +extern void abort (void); + +void test1 (signed char c, int set); +void test2 (unsigned char c, int set); +void test3 (short s, int set); +void test4 (unsigned short s, int set); +void test5 (int i, int set); +void test6 (unsigned int i, int set); +void test7 (long long l, int set); +void test8 (unsigned long long l, int set); + +#ifndef LONG_LONG_MAX +#define LONG_LONG_MAX __LONG_LONG_MAX__ +#endif +#ifndef LONG_LONG_MIN +#define LONG_LONG_MIN (-LONG_LONG_MAX-1) +#endif +#ifndef ULONG_LONG_MAX +#define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1) +#endif + + +void +test1 (signed char c, int set) +{ + if ((c & (SCHAR_MAX+1)) == 0) + { + if (set) abort (); + } + else + if (!set) abort (); + + if ((c & (SCHAR_MAX+1)) != 0) + { + if (!set) abort (); + } + else + if (set) abort (); + + if ((c & (SCHAR_MAX+1)) == (SCHAR_MAX+1)) + { + if (!set) abort (); + } + else + if (set) abort (); + + if ((c & (SCHAR_MAX+1)) != (SCHAR_MAX+1)) + { + if (set) abort (); + } + else + if (!set) abort (); +} + +void +test2 (unsigned char c, int set) +{ + if ((c & (SCHAR_MAX+1)) == 0) + { + if (set) abort (); + } + else + if (!set) abort (); + + if ((c & (SCHAR_MAX+1)) != 0) + { + if (!set) abort (); + } + else + if (set) abort (); + + if ((c & (SCHAR_MAX+1)) == (SCHAR_MAX+1)) + { + if (!set) abort (); + } + else + if (set) abort (); + + if ((c & (SCHAR_MAX+1)) != (SCHAR_MAX+1)) + { + if (set) abort (); + } + else + if (!set) abort (); +} + +void +test3 (short s, int set) +{ + if ((s & (SHRT_MAX+1)) == 0) + { + if (set) abort (); + } + else + if (!set) abort (); + + if ((s & (SHRT_MAX+1)) != 0) + { + if (!set) abort (); + } + else + if (set) abort (); + + if ((s & (SHRT_MAX+1)) == (SHRT_MAX+1)) + { + if (!set) abort (); + } + else + if (set) abort (); + + if ((s & (SHRT_MAX+1)) != (SHRT_MAX+1)) + { + if (set) abort (); + } + else + if (!set) abort (); +} + +void +test4 (unsigned short s, int set) +{ + if ((s & (SHRT_MAX+1)) == 0) + { + if (set) abort (); + } + else + if (!set) abort (); + + if ((s & (SHRT_MAX+1)) != 0) + { + if (!set) abort (); + } + else + if (set) abort (); + + if ((s & (SHRT_MAX+1)) == (SHRT_MAX+1)) + { + if (!set) abort (); + } + else + if (set) abort (); + + if ((s & (SHRT_MAX+1)) != (SHRT_MAX+1)) + { + if (set) abort (); + } + else + if (!set) abort (); +} + +void +test5 (int i, int set) +{ + if ((i & (INT_MAX+1U)) == 0) + { + if (set) abort (); + } + else + if (!set) abort (); + + if ((i & (INT_MAX+1U)) != 0) + { + if (!set) abort (); + } + else + if (set) abort (); + + if ((i & (INT_MAX+1U)) == (INT_MAX+1U)) + { + if (!set) abort (); + } + else + if (set) abort (); + + if ((i & (INT_MAX+1U)) != (INT_MAX+1U)) + { + if (set) abort (); + } + else + if (!set) abort (); +} + +void +test6 (unsigned int i, int set) +{ + if ((i & (INT_MAX+1U)) == 0) + { + if (set) abort (); + } + else + if (!set) abort (); + + if ((i & (INT_MAX+1U)) != 0) + { + if (!set) abort (); + } + else + if (set) abort (); + + if ((i & (INT_MAX+1U)) == (INT_MAX+1U)) + { + if (!set) abort (); + } + else + if (set) abort (); + + if ((i & (INT_MAX+1U)) != (INT_MAX+1U)) + { + if (set) abort (); + } + else + if (!set) abort (); +} + +void +test7 (long long l, int set) +{ + if ((l & (LONG_LONG_MAX+1ULL)) == 0) + { + if (set) abort (); + } + else + if (!set) abort (); + + if ((l & (LONG_LONG_MAX+1ULL)) != 0) + { + if (!set) abort (); + } + else + if (set) abort (); + + if ((l & (LONG_LONG_MAX+1ULL)) == (LONG_LONG_MAX+1ULL)) + { + if (!set) abort (); + } + else + if (set) abort (); + + if ((l & (LONG_LONG_MAX+1ULL)) != (LONG_LONG_MAX+1ULL)) + { + if (set) abort (); + } + else + if (!set) abort (); +} + +void +test8 (unsigned long long l, int set) +{ + if ((l & (LONG_LONG_MAX+1ULL)) == 0) + { + if (set) abort (); + } + else + if (!set) abort (); + + if ((l & (LONG_LONG_MAX+1ULL)) != 0) + { + if (!set) abort (); + } + else + if (set) abort (); + + if ((l & (LONG_LONG_MAX+1ULL)) == (LONG_LONG_MAX+1ULL)) + { + if (!set) abort (); + } + else + if (set) abort (); + + if ((l & (LONG_LONG_MAX+1ULL)) != (LONG_LONG_MAX+1ULL)) + { + if (set) abort (); + } + else + if (!set) abort (); +} + +int +main () +{ + test1 (0, 0); + test1 (SCHAR_MAX, 0); + test1 (SCHAR_MIN, 1); + test1 (UCHAR_MAX, 1); + + test2 (0, 0); + test2 (SCHAR_MAX, 0); + test2 (SCHAR_MIN, 1); + test2 (UCHAR_MAX, 1); + + test3 (0, 0); + test3 (SHRT_MAX, 0); + test3 (SHRT_MIN, 1); + test3 (USHRT_MAX, 1); + + test4 (0, 0); + test4 (SHRT_MAX, 0); + test4 (SHRT_MIN, 1); + test4 (USHRT_MAX, 1); + + test5 (0, 0); + test5 (INT_MAX, 0); + test5 (INT_MIN, 1); + test5 (UINT_MAX, 1); + + test6 (0, 0); + test6 (INT_MAX, 0); + test6 (INT_MIN, 1); + test6 (UINT_MAX, 1); + + test7 (0, 0); + test7 (LONG_LONG_MAX, 0); + test7 (LONG_LONG_MIN, 1); + test7 (ULONG_LONG_MAX, 1); + + test8 (0, 0); + test8 (LONG_LONG_MAX, 0); + test8 (LONG_LONG_MIN, 1); + test8 (ULONG_LONG_MAX, 1); + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20020508-1.c b/gcc/testsuite/gcc.c-torture/execute/20020508-1.c new file mode 100644 index 000000000..612be8dcc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020508-1.c @@ -0,0 +1,104 @@ +/* This tests the rotate patterns that some machines support. */ + +#include + +#ifndef CHAR_BIT +#define CHAR_BIT 8 +#endif + +#define ROR(a,b) (((a) >> (b)) | ((a) << ((sizeof (a) * CHAR_BIT) - (b)))) +#define ROL(a,b) (((a) << (b)) | ((a) >> ((sizeof (a) * CHAR_BIT) - (b)))) + +#define CHAR_VALUE ((unsigned char)0xf234U) +#define SHORT_VALUE ((unsigned short)0xf234U) +#define INT_VALUE 0xf234U +#define LONG_VALUE 0xf2345678LU +#define LL_VALUE 0xf2345678abcdef0LLU + +#define SHIFT1 4 +#define SHIFT2 ((sizeof (long long) * CHAR_BIT) - SHIFT1) + +unsigned char uc = CHAR_VALUE; +unsigned short us = SHORT_VALUE; +unsigned int ui = INT_VALUE; +unsigned long ul = LONG_VALUE; +unsigned long long ull = LL_VALUE; +int shift1 = SHIFT1; +int shift2 = SHIFT2; + +main () +{ + if (ROR (uc, shift1) != ROR (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROR (uc, SHIFT1) != ROR (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROR (us, shift1) != ROR (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROR (us, SHIFT1) != ROR (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROR (ui, shift1) != ROR (INT_VALUE, SHIFT1)) + abort (); + + if (ROR (ui, SHIFT1) != ROR (INT_VALUE, SHIFT1)) + abort (); + + if (ROR (ul, shift1) != ROR (LONG_VALUE, SHIFT1)) + abort (); + + if (ROR (ul, SHIFT1) != ROR (LONG_VALUE, SHIFT1)) + abort (); + + if (ROR (ull, shift1) != ROR (LL_VALUE, SHIFT1)) + abort (); + + if (ROR (ull, SHIFT1) != ROR (LL_VALUE, SHIFT1)) + abort (); + + if (ROR (ull, shift2) != ROR (LL_VALUE, SHIFT2)) + abort (); + + if (ROR (ull, SHIFT2) != ROR (LL_VALUE, SHIFT2)) + abort (); + + if (ROL (uc, shift1) != ROL (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROL (uc, SHIFT1) != ROL (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROL (us, shift1) != ROL (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROL (us, SHIFT1) != ROL (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROL (ui, shift1) != ROL (INT_VALUE, SHIFT1)) + abort (); + + if (ROL (ui, SHIFT1) != ROL (INT_VALUE, SHIFT1)) + abort (); + + if (ROL (ul, shift1) != ROL (LONG_VALUE, SHIFT1)) + abort (); + + if (ROL (ul, SHIFT1) != ROL (LONG_VALUE, SHIFT1)) + abort (); + + if (ROL (ull, shift1) != ROL (LL_VALUE, SHIFT1)) + abort (); + + if (ROL (ull, SHIFT1) != ROL (LL_VALUE, SHIFT1)) + abort (); + + if (ROL (ull, shift2) != ROL (LL_VALUE, SHIFT2)) + abort (); + + if (ROL (ull, SHIFT2) != ROL (LL_VALUE, SHIFT2)) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020508-2.c b/gcc/testsuite/gcc.c-torture/execute/20020508-2.c new file mode 100644 index 000000000..533805a96 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020508-2.c @@ -0,0 +1,102 @@ +#include + +#ifndef CHAR_BIT +#define CHAR_BIT 8 +#endif + +#define ROR(a,b) (((a) >> (b)) | ((a) << ((sizeof (a) * CHAR_BIT) - (b)))) +#define ROL(a,b) (((a) << (b)) | ((a) >> ((sizeof (a) * CHAR_BIT) - (b)))) + +#define CHAR_VALUE ((char)0x1234) +#define SHORT_VALUE ((short)0x1234) +#define INT_VALUE ((int)0x1234) +#define LONG_VALUE ((long)0x12345678L) +#define LL_VALUE ((long long)0x12345678abcdef0LL) + +#define SHIFT1 4 +#define SHIFT2 ((sizeof (long long) * CHAR_BIT) - SHIFT1) + +char c = CHAR_VALUE; +short s = SHORT_VALUE; +int i = INT_VALUE; +long l = LONG_VALUE; +long long ll = LL_VALUE; +int shift1 = SHIFT1; +int shift2 = SHIFT2; + +main () +{ + if (ROR (c, shift1) != ROR (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROR (c, SHIFT1) != ROR (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROR (s, shift1) != ROR (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROR (s, SHIFT1) != ROR (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROR (i, shift1) != ROR (INT_VALUE, SHIFT1)) + abort (); + + if (ROR (i, SHIFT1) != ROR (INT_VALUE, SHIFT1)) + abort (); + + if (ROR (l, shift1) != ROR (LONG_VALUE, SHIFT1)) + abort (); + + if (ROR (l, SHIFT1) != ROR (LONG_VALUE, SHIFT1)) + abort (); + + if (ROR (ll, shift1) != ROR (LL_VALUE, SHIFT1)) + abort (); + + if (ROR (ll, SHIFT1) != ROR (LL_VALUE, SHIFT1)) + abort (); + + if (ROR (ll, shift2) != ROR (LL_VALUE, SHIFT2)) + abort (); + + if (ROR (ll, SHIFT2) != ROR (LL_VALUE, SHIFT2)) + abort (); + + if (ROL (c, shift1) != ROL (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROL (c, SHIFT1) != ROL (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROL (s, shift1) != ROL (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROL (s, SHIFT1) != ROL (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROL (i, shift1) != ROL (INT_VALUE, SHIFT1)) + abort (); + + if (ROL (i, SHIFT1) != ROL (INT_VALUE, SHIFT1)) + abort (); + + if (ROL (l, shift1) != ROL (LONG_VALUE, SHIFT1)) + abort (); + + if (ROL (l, SHIFT1) != ROL (LONG_VALUE, SHIFT1)) + abort (); + + if (ROL (ll, shift1) != ROL (LL_VALUE, SHIFT1)) + abort (); + + if (ROL (ll, SHIFT1) != ROL (LL_VALUE, SHIFT1)) + abort (); + + if (ROL (ll, shift2) != ROL (LL_VALUE, SHIFT2)) + abort (); + + if (ROL (ll, SHIFT2) != ROL (LL_VALUE, SHIFT2)) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020508-3.c b/gcc/testsuite/gcc.c-torture/execute/20020508-3.c new file mode 100644 index 000000000..b41adffda --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020508-3.c @@ -0,0 +1,102 @@ +#include + +#ifndef CHAR_BIT +#define CHAR_BIT 8 +#endif + +#define ROR(a,b) (((a) >> (b)) | ((a) << ((sizeof (a) * CHAR_BIT) - (b)))) +#define ROL(a,b) (((a) << (b)) | ((a) >> ((sizeof (a) * CHAR_BIT) - (b)))) + +#define CHAR_VALUE ((char)0xf234) +#define SHORT_VALUE ((short)0xf234) +#define INT_VALUE ((int)0xf234) +#define LONG_VALUE ((long)0xf2345678L) +#define LL_VALUE ((long long)0xf2345678abcdef0LL) + +#define SHIFT1 4 +#define SHIFT2 ((sizeof (long long) * CHAR_BIT) - SHIFT1) + +char c = CHAR_VALUE; +short s = SHORT_VALUE; +int i = INT_VALUE; +long l = LONG_VALUE; +long long ll = LL_VALUE; +int shift1 = SHIFT1; +int shift2 = SHIFT2; + +main () +{ + if (ROR (c, shift1) != ROR (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROR (c, SHIFT1) != ROR (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROR (s, shift1) != ROR (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROR (s, SHIFT1) != ROR (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROR (i, shift1) != ROR (INT_VALUE, SHIFT1)) + abort (); + + if (ROR (i, SHIFT1) != ROR (INT_VALUE, SHIFT1)) + abort (); + + if (ROR (l, shift1) != ROR (LONG_VALUE, SHIFT1)) + abort (); + + if (ROR (l, SHIFT1) != ROR (LONG_VALUE, SHIFT1)) + abort (); + + if (ROR (ll, shift1) != ROR (LL_VALUE, SHIFT1)) + abort (); + + if (ROR (ll, SHIFT1) != ROR (LL_VALUE, SHIFT1)) + abort (); + + if (ROR (ll, shift2) != ROR (LL_VALUE, SHIFT2)) + abort (); + + if (ROR (ll, SHIFT2) != ROR (LL_VALUE, SHIFT2)) + abort (); + + if (ROL (c, shift1) != ROL (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROL (c, SHIFT1) != ROL (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROL (s, shift1) != ROL (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROL (s, SHIFT1) != ROL (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROL (i, shift1) != ROL (INT_VALUE, SHIFT1)) + abort (); + + if (ROL (i, SHIFT1) != ROL (INT_VALUE, SHIFT1)) + abort (); + + if (ROL (l, shift1) != ROL (LONG_VALUE, SHIFT1)) + abort (); + + if (ROL (l, SHIFT1) != ROL (LONG_VALUE, SHIFT1)) + abort (); + + if (ROL (ll, shift1) != ROL (LL_VALUE, SHIFT1)) + abort (); + + if (ROL (ll, SHIFT1) != ROL (LL_VALUE, SHIFT1)) + abort (); + + if (ROL (ll, shift2) != ROL (LL_VALUE, SHIFT2)) + abort (); + + if (ROL (ll, SHIFT2) != ROL (LL_VALUE, SHIFT2)) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020510-1.c b/gcc/testsuite/gcc.c-torture/execute/20020510-1.c new file mode 100644 index 000000000..90fb27755 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020510-1.c @@ -0,0 +1,85 @@ +/* Copyright (C) 2002 Free Software Foundation. + + Test that optimizing ((c>=1) && (c<=127)) into (signed char)c < 0 + doesn't cause any problems for the compiler and behaves correctly. + + Written by Roger Sayle, 8th May 2002. */ + +#include + +extern void abort (void); + +void +testc (unsigned char c, int ok) +{ + if ((c>=1) && (c<=SCHAR_MAX)) + { + if (!ok) abort (); + } + else + if (ok) abort (); +} + +void +tests (unsigned short s, int ok) +{ + if ((s>=1) && (s<=SHRT_MAX)) + { + if (!ok) abort (); + } + else + if (ok) abort (); +} + +void +testi (unsigned int i, int ok) +{ + if ((i>=1) && (i<=INT_MAX)) + { + if (!ok) abort (); + } + else + if (ok) abort (); +} + +void +testl (unsigned long l, int ok) +{ + if ((l>=1) && (l<=LONG_MAX)) + { + if (!ok) abort (); + } + else + if (ok) abort (); +} + +int +main () +{ + testc (0, 0); + testc (1, 1); + testc (SCHAR_MAX, 1); + testc (SCHAR_MAX+1, 0); + testc (UCHAR_MAX, 0); + + tests (0, 0); + tests (1, 1); + tests (SHRT_MAX, 1); + tests (SHRT_MAX+1, 0); + tests (USHRT_MAX, 0); + + testi (0, 0); + testi (1, 1); + testi (INT_MAX, 1); + testi (INT_MAX+1U, 0); + testi (UINT_MAX, 0); + + testl (0, 0); + testl (1, 1); + testl (LONG_MAX, 1); + testl (LONG_MAX+1UL, 0); + testl (ULONG_MAX, 0); + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20020529-1.c b/gcc/testsuite/gcc.c-torture/execute/20020529-1.c new file mode 100644 index 000000000..d1b93c76f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020529-1.c @@ -0,0 +1,78 @@ +/* PR target/6838 from cato@df.lth.se. + cris-elf got an ICE with -O2: the insn matching + (insn 49 48 52 (parallel[ + (set (mem/s:HI (plus:SI (reg/v/f:SI 0 r0 [24]) + (const_int 8 [0x8])) [5 .c+0 S2 A8]) + (reg:HI 2 r2 [27])) + (set (reg/f:SI 2 r2 [31]) + (plus:SI (reg/v/f:SI 0 r0 [24]) + (const_int 8 [0x8]))) + ] ) 24 {*mov_sidehi_mem} (nil) + (nil)) + forced a splitter through the output pattern "#", but there was no + matching splitter. */ + +struct xx + { + int a; + struct xx *b; + short c; + }; + +int f1 (struct xx *); +void f2 (void); + +int +foo (struct xx *p, int b, int c, int d) +{ + int a; + + for (;;) + { + a = f1(p); + if (a) + return (0); + if (b) + continue; + p->c = d; + if (p->a) + f2 (); + if (c) + f2 (); + d = p->c; + switch (a) + { + case 1: + if (p->b) + f2 (); + if (c) + f2 (); + default: + break; + } + } + return d; +} + +int main (void) +{ + struct xx s = {0, &s, 23}; + if (foo (&s, 0, 0, 0) != 0 || s.a != 0 || s.b != &s || s.c != 0) + abort (); + exit (0); +} + +int +f1 (struct xx *p) +{ + static int beenhere = 0; + if (beenhere++ > 1) + abort (); + return beenhere > 1; +} + +void +f2 (void) +{ + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020611-1.c b/gcc/testsuite/gcc.c-torture/execute/20020611-1.c new file mode 100644 index 000000000..87fb717cf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020611-1.c @@ -0,0 +1,32 @@ +/* PR target/6997. Missing (set_attr "cc" "none") in sleu pattern in + cris.md. Testcase from hp@axis.com. */ + +int p; +int k; +unsigned int n; + +void x () +{ + unsigned int h; + + h = n <= 30; + if (h) + p = 1; + else + p = 0; + + if (h) + k = 1; + else + k = 0; +} + +unsigned int n = 30; + +main () +{ + x (); + if (p != 1 || k != 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020614-1.c b/gcc/testsuite/gcc.c-torture/execute/20020614-1.c new file mode 100644 index 000000000..bcbaed8ae --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020614-1.c @@ -0,0 +1,41 @@ +/* PR c/6677 */ +/* Verify that GCC doesn't perform illegal simplifications + when folding constants. */ + +#include + +extern void abort (void); +extern void exit (int); + +int main (void) +{ + int i; + signed char j; + unsigned char k; + + i = SCHAR_MAX; + + j = ((signed char) (i << 1)) / 2; + + if (j != -1) + abort(); + + j = ((signed char) (i * 2)) / 2; + + if (j != -1) + abort(); + + i = UCHAR_MAX; + + k = ((unsigned char) (i << 1)) / 2; + + if (k != UCHAR_MAX/2) + abort(); + + k = ((unsigned char) (i * 2)) / 2; + + if (k != UCHAR_MAX/2) + abort(); + + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020615-1.c b/gcc/testsuite/gcc.c-torture/execute/20020615-1.c new file mode 100644 index 000000000..89bf7d046 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020615-1.c @@ -0,0 +1,59 @@ +/* PR target/7042. When reorg.c changed branches into return insns, it + completely forgot about any current_function_epilogue_delay_list and + dropped those insns. Uncovered on cris-axis-elf, where an insn in an + epilogue delay-slot set the return-value register with the testcase + below. Derived from ghostscript-6.52 (GPL) by hp@axis.com. */ + +typedef struct font_hints_s { + int axes_swapped; + int x_inverted, y_inverted; +} font_hints; +typedef struct gs_fixed_point_s { + long x, y; +} gs_fixed_point; + +int +line_hints(const font_hints *fh, const gs_fixed_point *p0, + const gs_fixed_point *p1) +{ + long dx = p1->x - p0->x; + long dy = p1->y - p0->y; + long adx, ady; + int xi = fh->x_inverted, yi = fh->y_inverted; + int hints; + if (xi) + dx = -dx; + if (yi) + dy = -dy; + if (fh->axes_swapped) { + long t = dx; + int ti = xi; + dx = dy, xi = yi; + dy = t, yi = ti; + } + adx = dx < 0 ? -dx : dx; + ady = dy < 0 ? -dy : dy; + if (dy != 0 && (adx <= ady >> 4)) { + hints = dy > 0 ? 2 : 1; + if (xi) + hints ^= 3; + } else if (dx != 0 && (ady <= adx >> 4)) { + hints = dx < 0 ? 8 : 4; + if (yi) + hints ^= 12; + } else + hints = 0; + return hints; +} +int main () +{ + static font_hints fh[] = {{0, 1, 0}, {0, 0, 1}, {0, 0, 0}}; + static gs_fixed_point gsf[] + = {{0x30000, 0x13958}, {0x30000, 0x18189}, + {0x13958, 0x30000}, {0x18189, 0x30000}}; + if (line_hints (fh, gsf, gsf + 1) != 1 + || line_hints (fh + 1, gsf + 2, gsf + 3) != 8 + || line_hints (fh + 2, gsf + 2, gsf + 3) != 4) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020619-1.c b/gcc/testsuite/gcc.c-torture/execute/20020619-1.c new file mode 100644 index 000000000..1a1503e89 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020619-1.c @@ -0,0 +1,31 @@ +#if (__SIZEOF_INT__ == 4) +typedef int int32; +#elif (__SIZEOF_LONG__ == 4) +typedef long int32; +#else +#error Add target support for int32 +#endif +static int32 ref(void) +{ + union { + char c[5]; + int32 i; + } u; + + __builtin_memset (&u, 0, sizeof(u)); + u.c[0] = 1; + u.c[1] = 2; + u.c[2] = 3; + u.c[3] = 4; + + return u.i; +} + +int main() +{ + int32 b = ref(); + if (b != 0x01020304 + && b != 0x04030201) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020716-1.c b/gcc/testsuite/gcc.c-torture/execute/20020716-1.c new file mode 100644 index 000000000..7f559590e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020716-1.c @@ -0,0 +1,36 @@ +extern void abort (void); +extern void exit (int); + +int sub1 (int val) +{ + return val; +} + +int testcond (int val) +{ + int flag1; + + { + int t1 = val; + { + int t2 = t1; + { + flag1 = sub1 (t2) ==0; + goto lab1; + }; + } + lab1: ; + } + + if (flag1 != 0) + return 0x4d0000; + else + return 0; +} + +int main (void) +{ + if (testcond (1)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020720-1.c b/gcc/testsuite/gcc.c-torture/execute/20020720-1.c new file mode 100644 index 000000000..c70bc748a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020720-1.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2002 Free Software Foundation. + + Ensure that fabs(x) < 0.0 optimization is working. + + Written by Roger Sayle, 20th July 2002. */ + +extern void abort (void); +extern double fabs (double); +extern void link_error (void); + +void +foo (double x) +{ + double p, q; + + p = fabs (x); + q = 0.0; + if (p < q) + link_error (); +} + +int +main() +{ + foo (1.0); + return 0; +} + +#ifndef __OPTIMIZE__ +void +link_error () +{ + abort (); +} +#endif + diff --git a/gcc/testsuite/gcc.c-torture/execute/20020805-1.c b/gcc/testsuite/gcc.c-torture/execute/20020805-1.c new file mode 100644 index 000000000..e7d517996 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020805-1.c @@ -0,0 +1,21 @@ +/* This testcase was miscompiled on IA-32, because fold-const + assumed associate_trees is always done on PLUS_EXPR. */ + +extern void abort (void); +extern void exit (int); + +void check (unsigned int m) +{ + if (m != (unsigned int) -1) + abort (); +} + +unsigned int n = 1; + +int main (void) +{ + unsigned int m; + m = (1 | (2 - n)) | (-n); + check (m); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020810-1.c b/gcc/testsuite/gcc.c-torture/execute/20020810-1.c new file mode 100644 index 000000000..d3386973a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020810-1.c @@ -0,0 +1,38 @@ +/* PR target/7559 + This testcase was miscompiled on x86-64, because classify_argument + wrongly computed the offset of nested structure fields. */ + +extern void abort (void); + +struct A +{ + long x; +}; + +struct R +{ + struct A a, b; +}; + +struct R R = { 100, 200 }; + +void f (struct R r) +{ + if (r.a.x != R.a.x || r.b.x != R.b.x) + abort (); +} + +struct R g (void) +{ + return R; +} + +int main (void) +{ + struct R r; + f(R); + r = g(); + if (r.a.x != R.a.x || r.b.x != R.b.x) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020819-1.c b/gcc/testsuite/gcc.c-torture/execute/20020819-1.c new file mode 100644 index 000000000..549da910c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020819-1.c @@ -0,0 +1,22 @@ +foo () +{ + return 0; +} + +main() +{ + int i, j, k, ccp_bad = 0; + + for (i = 0; i < 10; i++) + { + for (j = 0; j < 10; j++) + if (foo ()) + ccp_bad = 1; + + k = ccp_bad != 0; + if (k) + abort (); + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020904-1.c b/gcc/testsuite/gcc.c-torture/execute/20020904-1.c new file mode 100644 index 000000000..24eeb0cb0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020904-1.c @@ -0,0 +1,19 @@ +/* PR c/7102 */ + +/* Verify that GCC zero-extends integer constants + in unsigned binary operations. */ + +typedef unsigned char u8; + +u8 fun(u8 y) +{ + u8 x=((u8)255)/y; + return x; +} + +int main(void) +{ + if (fun((u8)2) != 127) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020911-1.c b/gcc/testsuite/gcc.c-torture/execute/20020911-1.c new file mode 100644 index 000000000..ec8302211 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020911-1.c @@ -0,0 +1,8 @@ +extern void abort (void); +unsigned short c = 0x8000; +int main() +{ + if ((c-0x8000) < 0 || (c-0x8000) > 0x7fff) + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020916-1.c b/gcc/testsuite/gcc.c-torture/execute/20020916-1.c new file mode 100644 index 000000000..3f2db15d0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020916-1.c @@ -0,0 +1,19 @@ +/* Distilled from try_pre_increment in flow.c. If-conversion inserted + new instructions at the wrong place on ppc. */ + +int foo(int a) +{ + int x; + x = 0; + if (a > 0) x = 1; + if (a < 0) x = 1; + return x; +} + +int main() +{ + if (foo(1) != 1) + abort(); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20020920-1.c b/gcc/testsuite/gcc.c-torture/execute/20020920-1.c new file mode 100644 index 000000000..4539742dd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020920-1.c @@ -0,0 +1,31 @@ +extern void abort (void); +extern void exit (int); + +struct B +{ + int x; + int y; +}; + +struct A +{ + int z; + struct B b; +}; + +struct A +f () +{ + struct B b = { 0, 1 }; + struct A a = { 2, b }; + return a; +} + +int +main (void) +{ + struct A a = f (); + if (a.z != 2 || a.b.x != 0 || a.b.y != 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20021010-1.c b/gcc/testsuite/gcc.c-torture/execute/20021010-1.c new file mode 100644 index 000000000..d742ce40b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20021010-1.c @@ -0,0 +1,21 @@ +#include + +int +sub () +{ + int dummy = 0, a = 16; + + if (a / INT_MAX / 16 == 0) + return 0; + else + return a / INT_MAX / 16; +} + +int +main () +{ + if (sub () != 0) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20021010-2.c b/gcc/testsuite/gcc.c-torture/execute/20021010-2.c new file mode 100644 index 000000000..425a8f6e4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20021010-2.c @@ -0,0 +1,37 @@ +/* cse.c failure on x86 target. + Contributed by Stuart Hastings 10 Oct 2002 */ +#include + +typedef signed short SInt16; + +typedef struct { + SInt16 minx; + SInt16 maxx; + SInt16 miny; + SInt16 maxy; +} IOGBounds; + +int expectedwidth = 50; + +unsigned int *global_vramPtr = (unsigned int *)0xa000; + +IOGBounds global_bounds = { 100, 150, 100, 150 }; +IOGBounds global_saveRect = { 75, 175, 75, 175 }; + +main() +{ + unsigned int *vramPtr; + int width; + IOGBounds saveRect = global_saveRect; + IOGBounds bounds = global_bounds; + + if (saveRect.minx < bounds.minx) saveRect.minx = bounds.minx; + if (saveRect.maxx > bounds.maxx) saveRect.maxx = bounds.maxx; + + vramPtr = global_vramPtr + (saveRect.miny - bounds.miny) ; + width = saveRect.maxx - saveRect.minx; + + if (width != expectedwidth) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20021011-1.c b/gcc/testsuite/gcc.c-torture/execute/20021011-1.c new file mode 100644 index 000000000..b1b2c406a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20021011-1.c @@ -0,0 +1,24 @@ +/* PR opt/8165. */ + +extern void abort (void); + +char buf[64]; + +int +main (void) +{ + int i; + + __builtin_strcpy (buf, "mystring"); + if (__builtin_strcmp (buf, "mystring") != 0) + abort (); + + for (i = 0; i < 16; ++i) + { + __builtin_strcpy (buf + i, "mystring"); + if (__builtin_strcmp (buf + i, "mystring") != 0) + abort (); + } + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20021015-1.c b/gcc/testsuite/gcc.c-torture/execute/20021015-1.c new file mode 100644 index 000000000..9d357c038 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20021015-1.c @@ -0,0 +1,30 @@ +/* PR opt/7409. */ + +extern void abort (void); + +char g_list[] = { '1' }; + +void g (void *p, char *list, int length, char **elementPtr, char **nextPtr) +{ + if (*nextPtr != g_list) + abort (); + + **nextPtr = 0; +} + +int main (void) +{ + char *list = g_list; + char *element; + int i, length = 100; + + for (i = 0; *list != 0; i++) + { + char *prevList = list; + g (0, list, length, &element, &list); + length -= (list - prevList); + } + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20021024-1.c b/gcc/testsuite/gcc.c-torture/execute/20021024-1.c new file mode 100644 index 000000000..f7d98e929 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20021024-1.c @@ -0,0 +1,43 @@ +/* Origin: PR target/6981 from Mattias Engdegaard . */ + +void exit (int); +void abort (void); + +unsigned long long *cp, m; + +void foo (void) +{ +} + +void bar (unsigned rop, unsigned long long *r) +{ + unsigned rs1, rs2, rd; + +top: + rs2 = (rop >> 23) & 0x1ff; + rs1 = (rop >> 9) & 0x1ff; + rd = rop & 0x1ff; + + *cp = 1; + m = r[rs1] + r[rs2]; + *cp = 2; + foo(); + if (!rd) + goto top; + r[rd] = 1; +} + +int main(void) +{ + static unsigned long long r[64]; + unsigned long long cr; + cp = &cr; + + r[4] = 47; + r[8] = 11; + bar((8 << 23) | (4 << 9) | 15, r); + + if (m != 47 + 11) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20021024-1.x b/gcc/testsuite/gcc.c-torture/execute/20021024-1.x new file mode 100644 index 000000000..121fcfecc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20021024-1.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_int16] } { + return 1 +} + +return 0; diff --git a/gcc/testsuite/gcc.c-torture/execute/20021111-1.c b/gcc/testsuite/gcc.c-torture/execute/20021111-1.c new file mode 100644 index 000000000..b81fa0b0f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20021111-1.c @@ -0,0 +1,31 @@ +/* Origin: PR c/8467 */ + +extern void abort (void); +extern void exit (int); + +int aim_callhandler(int sess, int conn, unsigned short family, unsigned short type); + +int aim_callhandler(int sess, int conn, unsigned short family, unsigned short type) +{ + static int i = 0; + + if (!conn) + return 0; + + if (type == 0xffff) + { + return 0; + } + + if (i >= 1) + abort (); + + i++; + return aim_callhandler(sess, conn, family, (unsigned short) 0xffff); +} + +int main (void) +{ + aim_callhandler (0, 1, 0, 0); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20021113-1.c b/gcc/testsuite/gcc.c-torture/execute/20021113-1.c new file mode 100644 index 000000000..420926d75 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20021113-1.c @@ -0,0 +1,17 @@ +/* This program tests a data flow bug that would cause constant propagation + to propagate constants through function calls. */ + +foo (int *p) +{ + *p = 10; +} + +main() +{ + int *ptr = alloca (sizeof (int)); + *ptr = 5; + foo (ptr); + if (*ptr == 5) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20021118-1.c b/gcc/testsuite/gcc.c-torture/execute/20021118-1.c new file mode 100644 index 000000000..0c1f800de --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20021118-1.c @@ -0,0 +1,15 @@ +struct s { int f[4]; }; + +int foo (struct s s, int x1, int x2, int x3, int x4, int x5, int x6, int x7) +{ + return s.f[3] + x7; +} + +int main () +{ + struct s s = { 1, 2, 3, 4 }; + + if (foo (s, 100, 200, 300, 400, 500, 600, 700) != 704) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20021118-2.c b/gcc/testsuite/gcc.c-torture/execute/20021118-2.c new file mode 100644 index 000000000..5c8c5484f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20021118-2.c @@ -0,0 +1,50 @@ +/* Originally added to test SH constant pool layout. t1() failed for + non-PIC and t2() failed for PIC. */ + +int t1 (float *f, int i, + void (*f1) (double), + void (*f2) (float, float)) +{ + f1 (3.0); + f[i] = f[i + 1]; + f2 (2.5f, 3.5f); +} + +int t2 (float *f, int i, + void (*f1) (double), + void (*f2) (float, float), + void (*f3) (float)) +{ + f3 (6.0f); + f1 (3.0); + f[i] = f[i + 1]; + f2 (2.5f, 3.5f); +} + +void f1 (double d) +{ + if (d != 3.0) + abort (); +} + +void f2 (float f1, float f2) +{ + if (f1 != 2.5f || f2 != 3.5f) + abort (); +} + +void f3 (float f) +{ + if (f != 6.0f) + abort (); +} + +int main () +{ + float f[3] = { 2.0f, 3.0f, 4.0f }; + t1 (f, 0, f1, f2); + t2 (f, 1, f1, f2, f3); + if (f[0] != 3.0f && f[1] != 4.0f) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20021118-3.c b/gcc/testsuite/gcc.c-torture/execute/20021118-3.c new file mode 100644 index 000000000..8ec01caa5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20021118-3.c @@ -0,0 +1,18 @@ +extern void abort (void); +extern void exit (int); + +int +foo (int x) +{ + if (x == -2 || -x - 100 >= 0) + abort (); + return 0; +} + +int +main () +{ + foo (-3); + foo (-99); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20021119-1.c b/gcc/testsuite/gcc.c-torture/execute/20021119-1.c new file mode 100644 index 000000000..c4ef460d4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20021119-1.c @@ -0,0 +1,17 @@ +/* PR 8639. */ + +extern void abort(void); + +int foo (int i) +{ + int r; + r = (80 - 4 * i) / 20; + return r; +} + +int main () +{ + if (foo (1) != 3) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20021120-1.c b/gcc/testsuite/gcc.c-torture/execute/20021120-1.c new file mode 100644 index 000000000..491d5d6a0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20021120-1.c @@ -0,0 +1,58 @@ +/* Macros to emit "L Nxx R" for each octal number xx between 000 and 037. */ +#define OP1(L, N, R, I, J) L N##I##J R +#define OP2(L, N, R, I) \ + OP1(L, N, R, 0, I), OP1(L, N, R, 1, I), \ + OP1(L, N, R, 2, I), OP1(L, N, R, 3, I) +#define OP(L, N, R) \ + OP2(L, N, R, 0), OP2(L, N, R, 1), OP2(L, N, R, 2), OP2(L, N, R, 3), \ + OP2(L, N, R, 4), OP2(L, N, R, 5), OP2(L, N, R, 6), OP2(L, N, R, 7) + +/* Declare 32 unique variables with prefix N. */ +#define DECLARE(N) OP (, N,) + +/* Copy 32 variables with prefix N from the array at ADDR. + Leave ADDR pointing to the end of the array. */ +#define COPYIN(N, ADDR) OP (, N, = *(ADDR++)) + +/* Likewise, but copy the other way. */ +#define COPYOUT(N, ADDR) OP (*(ADDR++) =, N,) + +/* Add the contents of the array at ADDR to 32 variables with prefix N. + Leave ADDR pointing to the end of the array. */ +#define ADD(N, ADDR) OP (, N, += *(ADDR++)) + +volatile double gd[32]; +volatile float gf[32]; + +void foo (int n) +{ + double DECLARE(d); + float DECLARE(f); + volatile double *pd; + volatile float *pf; + int i; + + pd = gd; COPYIN (d, pd); + for (i = 0; i < n; i++) + { + pf = gf; COPYIN (f, pf); + pd = gd; ADD (d, pd); + pd = gd; ADD (d, pd); + pd = gd; ADD (d, pd); + pf = gf; COPYOUT (f, pf); + } + pd = gd; COPYOUT (d, pd); +} + +int main () +{ + int i; + + for (i = 0; i < 32; i++) + gd[i] = i, gf[i] = i; + foo (1); + for (i = 0; i < 32; i++) + if (gd[i] != i * 4 || gf[i] != i) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20021120-2.c b/gcc/testsuite/gcc.c-torture/execute/20021120-2.c new file mode 100644 index 000000000..d8876c0eb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20021120-2.c @@ -0,0 +1,21 @@ +int g1, g2; + +void foo (int x) +{ + int y; + + if (x) + y = 793; + else + y = 793; + g1 = 7930 / y; + g2 = 7930 / x; +} + +int main () +{ + foo (793); + if (g1 != 10 || g2 != 10) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20021120-3.c b/gcc/testsuite/gcc.c-torture/execute/20021120-3.c new file mode 100644 index 000000000..e875f1f45 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20021120-3.c @@ -0,0 +1,26 @@ +/* Test whether a partly call-clobbered register will be moved over a call. + Although the original test case didn't use any GNUisms, it proved + difficult to reduce without the named register extension. */ +#if __SH64__ == 32 +#define LOC asm ("r10") +#else +#define LOC +#endif + +unsigned int foo (char *c, unsigned int x, unsigned int y) +{ + register unsigned int z LOC; + + sprintf (c, "%d", x / y); + z = x + 1; + return z / (y + 1); +} + +int main () +{ + char c[16]; + + if (foo (c, ~1U, 4) != (~0U / 5)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20021127-1.c b/gcc/testsuite/gcc.c-torture/execute/20021127-1.c new file mode 100644 index 000000000..0b3ff9ac8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20021127-1.c @@ -0,0 +1,14 @@ +long long a = -1; +long long llabs (long long); +void abort (void); +int +main() +{ + if (llabs (a) != 1) + abort (); + return 0; +} +long long llabs (long long b) +{ + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20021127-1.x b/gcc/testsuite/gcc.c-torture/execute/20021127-1.x new file mode 100644 index 000000000..efd854a05 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20021127-1.x @@ -0,0 +1,2 @@ +set additional_flags "-std=c99" +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/20021204-1.c b/gcc/testsuite/gcc.c-torture/execute/20021204-1.c new file mode 100644 index 000000000..e92c408a7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20021204-1.c @@ -0,0 +1,25 @@ +/* This test was miscompiled when using sibling call optimization, + because X ? Y : Y - 1 optimization changed X into !X in place + and haven't reverted it if do_store_flag was successful, so + when expanding the expression the second time it was + !X ? Y : Y - 1. */ + +extern void abort (void); +extern void exit (int); + +void foo (int x) +{ + if (x != 1) + abort (); +} + +int z; + +int main (int argc, char **argv) +{ + char *a = "test"; + char *b = a + 2; + + foo (z > 0 ? b - a : b - a - 1); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20021219-1.c b/gcc/testsuite/gcc.c-torture/execute/20021219-1.c new file mode 100644 index 000000000..2e658a5a8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20021219-1.c @@ -0,0 +1,18 @@ +/* PR optimization/8988 */ +/* Contributed by Kevin Easton */ + +void foo(char *p1, char **p2) +{} + +int main(void) +{ + char str[] = "foo { xx }"; + char *ptr = str + 5; + + foo(ptr, &ptr); + + while (*ptr && (*ptr == 13 || *ptr == 32)) + ptr++; + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030105-1.c b/gcc/testsuite/gcc.c-torture/execute/20030105-1.c new file mode 100644 index 000000000..19f3b2ddb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030105-1.c @@ -0,0 +1,20 @@ +int __attribute__ ((noinline)) +foo () +{ + const int a[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; + int i, sum; + + sum = 0; + for (i = 0; i < sizeof (a) / sizeof (*a); i++) + sum += a[i]; + + return sum; +} + +int +main () +{ + if (foo () != 28) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030109-1.c b/gcc/testsuite/gcc.c-torture/execute/20030109-1.c new file mode 100644 index 000000000..1bea931f6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030109-1.c @@ -0,0 +1,20 @@ +/* PR c/8032 */ +/* Verify that an empty initializer inside a partial + parent initializer doesn't confuse GCC. */ + +struct X +{ + int a; + int b; + int z[]; +}; + +struct X x = { .b = 40, .z = {} }; + +int main () +{ + if (x.b != 40) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030117-1.c b/gcc/testsuite/gcc.c-torture/execute/20030117-1.c new file mode 100644 index 000000000..656bd61ed --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030117-1.c @@ -0,0 +1,23 @@ +int foo (int, int, int); +int bar (int, int, int); + +int main (void) +{ + if (foo (5, 10, 21) != 12) + abort (); + + if (bar (9, 12, 15) != 150) + abort (); + + exit (0); +} + +int foo (int x, int y, int z) +{ + return (x + y + z) / 3; +} + +int bar (int x, int y, int z) +{ + return foo (x * x, y * y, z * z); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030120-1.c b/gcc/testsuite/gcc.c-torture/execute/20030120-1.c new file mode 100644 index 000000000..0ac0ecf70 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030120-1.c @@ -0,0 +1,50 @@ +/* On H8/300 port, NOTICE_UPDATE_CC had a bug that causes the final + pass to remove test insns that should be kept. */ + +unsigned short +test1 (unsigned short w) +{ + if ((w & 0xff00) == 0) + { + if (w == 0) + w = 2; + } + return w; +} + +unsigned long +test2 (unsigned long w) +{ + if ((w & 0xffff0000) == 0) + { + if (w == 0) + w = 2; + } + return w; +} + +int +test3 (unsigned short a) +{ + if (a & 1) + return 1; + else if (a) + return 1; + else + return 0; +} + +int +main () +{ + if (test1 (1) != 1) + abort (); + + if (test2 (1) != 1) + abort (); + + if (test3 (2) != 1) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030120-2.c b/gcc/testsuite/gcc.c-torture/execute/20030120-2.c new file mode 100644 index 000000000..298bc4f5b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030120-2.c @@ -0,0 +1,19 @@ +/* PR 8848 */ + +extern void abort (); + +int foo(int status) +{ + int s = 0; + if (status == 1) s=1; + if (status == 3) s=3; + if (status == 4) s=4; + return s; +} + +int main() +{ + if (foo (3) != 3) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030125-1.c b/gcc/testsuite/gcc.c-torture/execute/20030125-1.c new file mode 100644 index 000000000..8eb9a4211 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030125-1.c @@ -0,0 +1,54 @@ +/* Verify whether math functions are simplified. */ +double sin(double); +double floor(double); +float +t(float a) +{ + return sin(a); +} +float +q(float a) +{ + return floor(a); +} +double +q1(float a) +{ + return floor(a); +} +main() +{ +#ifdef __OPTIMIZE__ + if (t(0)!=0) + abort (); + if (q(0)!=0) + abort (); + if (q1(0)!=0) + abort (); +#endif + return 0; +} +__attribute__ ((noinline)) +double +floor(double a) +{ + abort (); +} +__attribute__ ((noinline)) +float +floorf(float a) +{ + return a; +} +__attribute__ ((noinline)) +double +sin(double a) +{ + abort (); +} +__attribute__ ((noinline)) +float +sinf(float a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030125-1.x b/gcc/testsuite/gcc.c-torture/execute/20030125-1.x new file mode 100644 index 000000000..3a5b13556 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030125-1.x @@ -0,0 +1,4 @@ +# Only glibc includes all c99 functions at the moment. +if { ! [istarget "*-linux*"] } { return 1 } +if { [check_effective_target_uclibc] } { return 1 } +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/20030128-1.c b/gcc/testsuite/gcc.c-torture/execute/20030128-1.c new file mode 100644 index 000000000..ceca322cc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030128-1.c @@ -0,0 +1,10 @@ +unsigned char x = 50; +volatile short y = -5; + +int main () +{ + x /= y; + if (x != (unsigned char) -10) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030203-1.c b/gcc/testsuite/gcc.c-torture/execute/20030203-1.c new file mode 100644 index 000000000..3ce3d611e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030203-1.c @@ -0,0 +1,23 @@ +void f(int); +int do_layer3(int single) +{ + int stereo1; + + if(single >= 0) /* stream is stereo, but force to mono */ + stereo1 = 1; + else + stereo1 = 2; + f(single); + + return stereo1; +} + +extern void abort (); +int main() +{ + if (do_layer3(-1) != 2) + abort (); + return 0; +} + +void f(int i) {} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030209-1.c b/gcc/testsuite/gcc.c-torture/execute/20030209-1.c new file mode 100644 index 000000000..5845d67b3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030209-1.c @@ -0,0 +1,25 @@ +#ifdef STACK_SIZE +#if STACK_SIZE < 8*100*100 +#define SKIP +#endif +#endif + +#ifndef SKIP +double x[100][100]; +int main () +{ + int i; + + i = 99; + x[i][0] = 42; + if (x[99][0] != 42) + abort (); + exit (0); +} +#else +int +main () +{ + exit (0); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/20030216-1.c b/gcc/testsuite/gcc.c-torture/execute/20030216-1.c new file mode 100644 index 000000000..2153bfdd7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030216-1.c @@ -0,0 +1,10 @@ +void link_error (void); +const double one=1.0; +main () +{ +#ifdef __OPTIMIZE__ + if ((int) one != 1) + link_error (); +#endif + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030216-1.x b/gcc/testsuite/gcc.c-torture/execute/20030216-1.x new file mode 100644 index 000000000..a0e03e379 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030216-1.x @@ -0,0 +1,12 @@ +# This test requires constant propagation of loads and stores to be +# enabled. This is only guaranteed at -O2 and higher. Do not run +# at -O1. + +set torture_eval_before_compile { + if {[string match {*-O1*} "$option"]} { + continue + } +} + +return 0 + diff --git a/gcc/testsuite/gcc.c-torture/execute/20030218-1.c b/gcc/testsuite/gcc.c-torture/execute/20030218-1.c new file mode 100644 index 000000000..8dde79451 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030218-1.c @@ -0,0 +1,25 @@ +/* On H8, the predicate general_operand_src(op,mode) used to ignore + mode when op is a (mem (post_inc ...)). As a result, the pattern + for extendhisi2 was recognized as extendqisi2. */ + +extern void abort (); +extern void exit (int); + +short *q; + +long +foo (short *p) +{ + long b = *p; + q = p + 1; + return b; +} + +int +main () +{ + short a = 0xff00; + if (foo (&a) != (long) (short) 0xff00) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030221-1.c b/gcc/testsuite/gcc.c-torture/execute/20030221-1.c new file mode 100644 index 000000000..9dcee3e23 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030221-1.c @@ -0,0 +1,17 @@ +/* PR optimization/8613 */ +/* Contributed by Glen Nakamura */ + +extern void abort (void); + +int main (void) +{ + char buf[16] = "1234567890"; + char *p = buf; + + *p++ = (char) __builtin_strlen (buf); + + if ((buf[0] != 10) || (p - buf != 1)) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030222-1.c b/gcc/testsuite/gcc.c-torture/execute/20030222-1.c new file mode 100644 index 000000000..93d1e3c4e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030222-1.c @@ -0,0 +1,27 @@ +/* Verify that we get the low part of the long long as an int. We + used to get it wrong on big-endian machines, if register allocation + succeeded at all. We use volatile to make sure the long long is + actually truncated to int, in case a single register is wide enough + for a long long. */ + +#include + +void +ll_to_int (long long x, volatile int *p) +{ + int i; + asm ("" : "=r" (i) : "0" (x)); + *p = i; +} + +int val = INT_MIN + 1; + +int main() { + volatile int i; + + ll_to_int ((long long)val, &i); + if (i != val) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030222-1.x b/gcc/testsuite/gcc.c-torture/execute/20030222-1.x new file mode 100644 index 000000000..e195563dd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030222-1.x @@ -0,0 +1,6 @@ +if [istarget "spu-*-*"] { + # Using inline assembly to convert long long to int is not working quite + # right # on the SPU. An extra shift-left-4-byte is needed. + return 1 +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/20030224-2.c b/gcc/testsuite/gcc.c-torture/execute/20030224-2.c new file mode 100644 index 000000000..5b692fb46 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030224-2.c @@ -0,0 +1,28 @@ +/* Make sure that we don't free any temp stack slots associated with + initializing marker before we're finished with them. */ + +extern void abort(); + +typedef struct { short v16; } __attribute__((packed)) jint16_t; + +struct node { + jint16_t magic; + jint16_t nodetype; + int totlen; +} __attribute__((packed)); + +struct node node, *node_p = &node; + +int main() +{ + struct node marker = { + .magic = (jint16_t) {0x1985}, + .nodetype = (jint16_t) {0x2003}, + .totlen = node_p->totlen + }; + if (marker.magic.v16 != 0x1985) + abort(); + if (marker.nodetype.v16 != 0x2003) + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030307-1.c b/gcc/testsuite/gcc.c-torture/execute/20030307-1.c new file mode 100644 index 000000000..3f4eb864d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030307-1.c @@ -0,0 +1,26 @@ +/* PR optimization/8726 */ +/* Originator: Paul Eggert */ + +/* Verify that GCC doesn't miscompile tail calls on Sparc. */ + +extern void abort(void); + +int fcntl_lock(int fd, int op, long long offset, long long count, int type); + +int vfswrap_lock(char *fsp, int fd, int op, long long offset, long long count, int type) +{ + return fcntl_lock(fd, op, offset, count, type); +} + +int fcntl_lock(int fd, int op, long long offset, long long count, int type) +{ + return type; +} + +int main(void) +{ + if (vfswrap_lock (0, 1, 2, 3, 4, 5) != 5) + abort(); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030313-1.c b/gcc/testsuite/gcc.c-torture/execute/20030313-1.c new file mode 100644 index 000000000..49245a0b3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030313-1.c @@ -0,0 +1,68 @@ +struct A +{ + unsigned long p, q, r, s; +} x = { 13, 14, 15, 16 }; + +extern void abort (void); +extern void exit (int); + +static inline struct A * +bar (void) +{ + struct A *r; + + switch (8) + { + case 2: + abort (); + break; + case 8: + r = &x; + break; + default: + abort (); + break; + } + return r; +} + +void +foo (unsigned long *x, int y) +{ + if (y != 12) + abort (); + if (x[0] != 1 || x[1] != 11) + abort (); + if (x[2] != 2 || x[3] != 12) + abort (); + if (x[4] != 3 || x[5] != 13) + abort (); + if (x[6] != 4 || x[7] != 14) + abort (); + if (x[8] != 5 || x[9] != 15) + abort (); + if (x[10] != 6 || x[11] != 16) + abort (); +} + +int +main (void) +{ + unsigned long a[40]; + int b = 0; + + a[b++] = 1; + a[b++] = 11; + a[b++] = 2; + a[b++] = 12; + a[b++] = 3; + a[b++] = bar()->p; + a[b++] = 4; + a[b++] = bar()->q; + a[b++] = 5; + a[b++] = bar()->r; + a[b++] = 6; + a[b++] = bar()->s; + foo (a, b); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030316-1.c b/gcc/testsuite/gcc.c-torture/execute/20030316-1.c new file mode 100644 index 000000000..bde2e136a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030316-1.c @@ -0,0 +1,12 @@ +/* PR target/9164 */ +/* The comparison operand was sign extended erraneously. */ + +int +main (void) +{ + long j = 0x40000000; + if ((unsigned int) (0x40000000 + j) < 0L) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030323-1.c b/gcc/testsuite/gcc.c-torture/execute/20030323-1.c new file mode 100644 index 000000000..35e2bd181 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030323-1.c @@ -0,0 +1,114 @@ +/* PR opt/10116 */ +/* Removed tablejump while label still in use; this is really a link test. */ + +void *NSReturnAddress(int offset) +{ + switch (offset) { + case 0: return __builtin_return_address(0 + 1); + case 1: return __builtin_return_address(1 + 1); + case 2: return __builtin_return_address(2 + 1); + case 3: return __builtin_return_address(3 + 1); + case 4: return __builtin_return_address(4 + 1); + case 5: return __builtin_return_address(5 + 1); + case 6: return __builtin_return_address(6 + 1); + case 7: return __builtin_return_address(7 + 1); + case 8: return __builtin_return_address(8 + 1); + case 9: return __builtin_return_address(9 + 1); + case 10: return __builtin_return_address(10 + 1); + case 11: return __builtin_return_address(11 + 1); + case 12: return __builtin_return_address(12 + 1); + case 13: return __builtin_return_address(13 + 1); + case 14: return __builtin_return_address(14 + 1); + case 15: return __builtin_return_address(15 + 1); + case 16: return __builtin_return_address(16 + 1); + case 17: return __builtin_return_address(17 + 1); + case 18: return __builtin_return_address(18 + 1); + case 19: return __builtin_return_address(19 + 1); + case 20: return __builtin_return_address(20 + 1); + case 21: return __builtin_return_address(21 + 1); + case 22: return __builtin_return_address(22 + 1); + case 23: return __builtin_return_address(23 + 1); + case 24: return __builtin_return_address(24 + 1); + case 25: return __builtin_return_address(25 + 1); + case 26: return __builtin_return_address(26 + 1); + case 27: return __builtin_return_address(27 + 1); + case 28: return __builtin_return_address(28 + 1); + case 29: return __builtin_return_address(29 + 1); + case 30: return __builtin_return_address(30 + 1); + case 31: return __builtin_return_address(31 + 1); + case 32: return __builtin_return_address(32 + 1); + case 33: return __builtin_return_address(33 + 1); + case 34: return __builtin_return_address(34 + 1); + case 35: return __builtin_return_address(35 + 1); + case 36: return __builtin_return_address(36 + 1); + case 37: return __builtin_return_address(37 + 1); + case 38: return __builtin_return_address(38 + 1); + case 39: return __builtin_return_address(39 + 1); + case 40: return __builtin_return_address(40 + 1); + case 41: return __builtin_return_address(41 + 1); + case 42: return __builtin_return_address(42 + 1); + case 43: return __builtin_return_address(43 + 1); + case 44: return __builtin_return_address(44 + 1); + case 45: return __builtin_return_address(45 + 1); + case 46: return __builtin_return_address(46 + 1); + case 47: return __builtin_return_address(47 + 1); + case 48: return __builtin_return_address(48 + 1); + case 49: return __builtin_return_address(49 + 1); + case 50: return __builtin_return_address(50 + 1); + case 51: return __builtin_return_address(51 + 1); + case 52: return __builtin_return_address(52 + 1); + case 53: return __builtin_return_address(53 + 1); + case 54: return __builtin_return_address(54 + 1); + case 55: return __builtin_return_address(55 + 1); + case 56: return __builtin_return_address(56 + 1); + case 57: return __builtin_return_address(57 + 1); + case 58: return __builtin_return_address(58 + 1); + case 59: return __builtin_return_address(59 + 1); + case 60: return __builtin_return_address(60 + 1); + case 61: return __builtin_return_address(61 + 1); + case 62: return __builtin_return_address(62 + 1); + case 63: return __builtin_return_address(63 + 1); + case 64: return __builtin_return_address(64 + 1); + case 65: return __builtin_return_address(65 + 1); + case 66: return __builtin_return_address(66 + 1); + case 67: return __builtin_return_address(67 + 1); + case 68: return __builtin_return_address(68 + 1); + case 69: return __builtin_return_address(69 + 1); + case 70: return __builtin_return_address(70 + 1); + case 71: return __builtin_return_address(71 + 1); + case 72: return __builtin_return_address(72 + 1); + case 73: return __builtin_return_address(73 + 1); + case 74: return __builtin_return_address(74 + 1); + case 75: return __builtin_return_address(75 + 1); + case 76: return __builtin_return_address(76 + 1); + case 77: return __builtin_return_address(77 + 1); + case 78: return __builtin_return_address(78 + 1); + case 79: return __builtin_return_address(79 + 1); + case 80: return __builtin_return_address(80 + 1); + case 81: return __builtin_return_address(81 + 1); + case 82: return __builtin_return_address(82 + 1); + case 83: return __builtin_return_address(83 + 1); + case 84: return __builtin_return_address(84 + 1); + case 85: return __builtin_return_address(85 + 1); + case 86: return __builtin_return_address(86 + 1); + case 87: return __builtin_return_address(87 + 1); + case 88: return __builtin_return_address(88 + 1); + case 89: return __builtin_return_address(89 + 1); + case 90: return __builtin_return_address(90 + 1); + case 91: return __builtin_return_address(91 + 1); + case 92: return __builtin_return_address(92 + 1); + case 93: return __builtin_return_address(93 + 1); + case 94: return __builtin_return_address(94 + 1); + case 95: return __builtin_return_address(95 + 1); + case 96: return __builtin_return_address(96 + 1); + case 97: return __builtin_return_address(97 + 1); + case 98: return __builtin_return_address(98 + 1); + case 99: return __builtin_return_address(99 + 1); + } + return 0; +} + +int main() +{ + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030330-1.c b/gcc/testsuite/gcc.c-torture/execute/20030330-1.c new file mode 100644 index 000000000..639e47ba7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030330-1.c @@ -0,0 +1,14 @@ +/* PR opt/10011 */ +/* This is link test for builtin_constant_p simplification + DCE. */ + +extern void link_error(void); +static void usb_hub_port_wait_reset(unsigned int delay) +{ + int delay_time; + for (delay_time = 0; delay_time < 500; delay_time += delay) { + if (__builtin_constant_p(delay)) + link_error(); + } +} + +int main() { return 0; } diff --git a/gcc/testsuite/gcc.c-torture/execute/20030401-1.c b/gcc/testsuite/gcc.c-torture/execute/20030401-1.c new file mode 100644 index 000000000..0cc144a85 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030401-1.c @@ -0,0 +1,27 @@ +/* Testcase for PR fortran/9974. This was a miscompilation of the g77 + front-end caused by the jump bypassing optimizations not handling + instructions inserted on CFG edges. */ + +extern void abort (); + +int bar () +{ + return 1; +} + +void foo (int x) +{ + unsigned char error = 0; + + if (! (error = ((x == 0) || bar ()))) + bar (); + if (! error) + abort (); +} + +int main() +{ + foo (1); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20030403-1.c b/gcc/testsuite/gcc.c-torture/execute/20030403-1.c new file mode 100644 index 000000000..cbf1351c4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030403-1.c @@ -0,0 +1,16 @@ +/* The non-destructive folder was always emitting >= when folding + comparisons to signed_max+1. */ + +#include + +int +main () +{ + unsigned long count = 8; + + if (count > INT_MAX) + abort (); + + return (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20030404-1.c b/gcc/testsuite/gcc.c-torture/execute/20030404-1.c new file mode 100644 index 000000000..1dd1ec099 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030404-1.c @@ -0,0 +1,23 @@ +/* This exposed a bug in tree-ssa-ccp.c. Since 'j' and 'i' are never + defined, CCP was not traversing the edges out of the if(), which caused + the PHI node for 'k' at the top of the while to only be visited once. + This ended up causing CCP to think that 'k' was the constant '1'. */ +main() +{ + int i, j, k; + + k = 0; + while (k < 10) + { + k++; + if (j > i) + j = 5; + else + j =3; + } + + if (k != 10) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030408-1.c b/gcc/testsuite/gcc.c-torture/execute/20030408-1.c new file mode 100644 index 000000000..c1d102c26 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030408-1.c @@ -0,0 +1,69 @@ +/* PR optimization/8634 */ +/* Contributed by Glen Nakamura */ + +extern void abort (void); + +struct foo { + char a, b, c, d, e, f, g, h, i, j; +}; + +int test1 () +{ + const char X[8] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H' }; + char buffer[8]; + __builtin_memcpy (buffer, X, 8); + if (buffer[0] != 'A' || buffer[1] != 'B' + || buffer[2] != 'C' || buffer[3] != 'D' + || buffer[4] != 'E' || buffer[5] != 'F' + || buffer[6] != 'G' || buffer[7] != 'H') + abort (); + return 0; +} + +int test2 () +{ + const char X[10] = { 'A', 'B', 'C', 'D', 'E' }; + char buffer[10]; + __builtin_memcpy (buffer, X, 10); + if (buffer[0] != 'A' || buffer[1] != 'B' + || buffer[2] != 'C' || buffer[3] != 'D' + || buffer[4] != 'E' || buffer[5] != '\0' + || buffer[6] != '\0' || buffer[7] != '\0' + || buffer[8] != '\0' || buffer[9] != '\0') + abort (); + return 0; +} + +int test3 () +{ + const struct foo X = { a : 'A', c : 'C', e : 'E', g : 'G', i : 'I' }; + char buffer[10]; + __builtin_memcpy (buffer, &X, 10); + if (buffer[0] != 'A' || buffer[1] != '\0' + || buffer[2] != 'C' || buffer[3] != '\0' + || buffer[4] != 'E' || buffer[5] != '\0' + || buffer[6] != 'G' || buffer[7] != '\0' + || buffer[8] != 'I' || buffer[9] != '\0') + abort (); + return 0; +} + +int test4 () +{ + const struct foo X = { .b = 'B', .d = 'D', .f = 'F', .h = 'H' , .j = 'J' }; + char buffer[10]; + __builtin_memcpy (buffer, &X, 10); + if (buffer[0] != '\0' || buffer[1] != 'B' + || buffer[2] != '\0' || buffer[3] != 'D' + || buffer[4] != '\0' || buffer[5] != 'F' + || buffer[6] != '\0' || buffer[7] != 'H' + || buffer[8] != '\0' || buffer[9] != 'J') + abort (); + return 0; +} + +int main () +{ + test1 (); test2 (); test3 (); test4 (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030501-1.c b/gcc/testsuite/gcc.c-torture/execute/20030501-1.c new file mode 100644 index 000000000..f47dc291b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030501-1.c @@ -0,0 +1,17 @@ +int +main (int argc, char **argv) +{ + int size = 10; + + { + int retframe_block() + { + return size + 5; + } + + if (retframe_block() != 15) + abort (); + exit (0); + + } +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030606-1.c b/gcc/testsuite/gcc.c-torture/execute/20030606-1.c new file mode 100644 index 000000000..51054d90a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030606-1.c @@ -0,0 +1,27 @@ + +int * foo (int *x, int b) +{ + + *(x++) = 55; + if (b) + *(x++) = b; + + return x; +} + +main() +{ + int a[5]; + + memset (a, 1, sizeof (a)); + + if (foo(a, 0) - a != 1 || a[0] != 55 || a[1] != a[4]) + abort(); + + memset (a, 1, sizeof (a)); + + if (foo(a, 2) - a != 2 || a[0] != 55 || a[1] != 2) + abort(); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030613-1.c b/gcc/testsuite/gcc.c-torture/execute/20030613-1.c new file mode 100644 index 000000000..cb1623d96 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030613-1.c @@ -0,0 +1,62 @@ +/* PR optimization/10955 */ +/* Originator: */ + +/* This used to fail on SPARC32 at -O3 because the loop unroller + wrongly thought it could eliminate a pseudo in a loop, while + the pseudo was used outside the loop. */ + +extern void abort(void); + +#define COMPLEX struct CS + +COMPLEX { + long x; + long y; +}; + + +static COMPLEX CCID (COMPLEX x) +{ + COMPLEX a; + + a.x = x.x; + a.y = x.y; + + return a; +} + + +static COMPLEX CPOW (COMPLEX x, int y) +{ + COMPLEX a; + a = x; + + while (--y > 0) + a=CCID(a); + + return a; +} + + +static int c5p (COMPLEX x) +{ + COMPLEX a,b; + a = CPOW (x, 2); + b = CCID( CPOW(a,2) ); + + return (b.x == b.y); +} + + +int main (void) +{ + COMPLEX x; + + x.x = -7; + x.y = -7; + + if (!c5p(x)) + abort(); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030626-1.c b/gcc/testsuite/gcc.c-torture/execute/20030626-1.c new file mode 100644 index 000000000..8b985f035 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030626-1.c @@ -0,0 +1,13 @@ +char buf[10]; + +extern void abort (void); +extern int sprintf (char*, const char*, ...); + +int main() +{ + int l = sprintf (buf, "foo\0bar"); + if (l != 3) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20030626-2.c b/gcc/testsuite/gcc.c-torture/execute/20030626-2.c new file mode 100644 index 000000000..5483d0cba --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030626-2.c @@ -0,0 +1,14 @@ +char buf[40]; + +extern int sprintf (char*, const char*, ...); +extern void abort (void); + +int main() +{ + int i = 0; + int l = sprintf (buf, "%s", i++ ? "string" : "other string"); + if (l != sizeof ("other string") - 1 || i != 1) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20030714-1.c b/gcc/testsuite/gcc.c-torture/execute/20030714-1.c new file mode 100644 index 000000000..719baede2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030714-1.c @@ -0,0 +1,193 @@ +/* derived from PR optimization/11440 */ + +extern void abort (void); +extern void exit (int); + +typedef _Bool bool; +const bool false = 0; +const bool true = 1; + +enum EPosition +{ + STATIC, RELATIVE, ABSOLUTE, FIXED +}; +typedef enum EPosition EPosition; + +enum EFloat +{ + FNONE = 0, FLEFT, FRIGHT +}; +typedef enum EFloat EFloat; + +struct RenderBox +{ + int unused[6]; + short m_verticalPosition; + + bool m_layouted : 1; + bool m_unused : 1; + bool m_minMaxKnown : 1; + bool m_floating : 1; + + bool m_positioned : 1; + bool m_overhangingContents : 1; + bool m_relPositioned : 1; + bool m_paintSpecial : 1; + + bool m_isAnonymous : 1; + bool m_recalcMinMax : 1; + bool m_isText : 1; + bool m_inline : 1; + + bool m_replaced : 1; + bool m_mouseInside : 1; + bool m_hasFirstLine : 1; + bool m_isSelectionBorder : 1; + + bool (*isTableCell) (struct RenderBox *this); +}; + +typedef struct RenderBox RenderBox; + +struct RenderStyle +{ + struct NonInheritedFlags + { + union + { + struct + { + unsigned int _display : 4; + unsigned int _bg_repeat : 2; + bool _bg_attachment : 1; + unsigned int _overflow : 4 ; + unsigned int _vertical_align : 4; + unsigned int _clear : 2; + EPosition _position : 2; + EFloat _floating : 2; + unsigned int _table_layout : 1; + bool _flowAroundFloats :1; + + unsigned int _styleType : 3; + bool _hasHover : 1; + bool _hasActive : 1; + bool _clipSpecified : 1; + unsigned int _unicodeBidi : 2; + int _unused : 1; + } f; + int _niflags; + }; + } noninherited_flags; +}; + +typedef struct RenderStyle RenderStyle; + +extern void RenderObject_setStyle(RenderBox *this, RenderStyle *_style); +extern void removeFromSpecialObjects(RenderBox *this); + + + +void RenderBox_setStyle(RenderBox *thisin, RenderStyle *_style) +{ + RenderBox *this = thisin; + bool oldpos, tmp; + EPosition tmppo; + + tmp = this->m_positioned; + + oldpos = tmp; + + RenderObject_setStyle(this, _style); + + tmppo = _style->noninherited_flags.f._position; + + switch(tmppo) + { + case ABSOLUTE: + case FIXED: + { + bool ltrue = true; + this->m_positioned = ltrue; + break; + } + + default: + { + EFloat tmpf; + EPosition tmpp; + if (oldpos) + { + bool ltrue = true; + this->m_positioned = ltrue; + removeFromSpecialObjects(this); + } + { + bool lfalse = false; + this->m_positioned = lfalse; + } + + tmpf = _style->noninherited_flags.f._floating; + + if(!this->isTableCell (this) && !(tmpf == FNONE)) + { + bool ltrue = true; + this->m_floating = ltrue; + } + else + { + tmpp = _style->noninherited_flags.f._position; + if (tmpp == RELATIVE) + { + bool ltrue = true; + this->m_relPositioned = ltrue; + } + } + } + } +} + + + + +RenderBox g_this; +RenderStyle g__style; + +void RenderObject_setStyle(RenderBox *this, RenderStyle *_style) +{ + (void) this; + (void) _style; +} + +void removeFromSpecialObjects(RenderBox *this) +{ + (void) this; +} + +bool RenderBox_isTableCell (RenderBox *this) +{ + (void) this; + return false; +} + +int main (void) +{ + + g_this.m_relPositioned = false; + g_this.m_positioned = false; + g_this.m_floating = false; + g_this.isTableCell = RenderBox_isTableCell; + + g__style.noninherited_flags.f._position = FIXED; + g__style.noninherited_flags.f._floating = FNONE; + + RenderBox_setStyle (&g_this, &g__style); + + if (g_this.m_positioned != true) + abort (); + if (g_this.m_relPositioned != false) + abort (); + if (g_this.m_floating != false) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030715-1.c b/gcc/testsuite/gcc.c-torture/execute/20030715-1.c new file mode 100644 index 000000000..a2a28ce96 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030715-1.c @@ -0,0 +1,35 @@ +/* PR optimization/11320 */ +/* Origin: Andreas Schwab */ + +/* Verify that the scheduler correctly computes the dependencies + in the presence of conditional instructions. */ + +int strcmp (const char *, const char *); +int ap_standalone; + +const char *ap_check_cmd_context (void *a, int b) +{ + return 0; +} + +const char *server_type (void *a, void *b, char *arg) +{ + const char *err = ap_check_cmd_context (a, 0x01|0x02|0x04|0x08|0x10); + if (err) + return err; + + if (!strcmp (arg, "inetd")) + ap_standalone = 0; + else if (!strcmp (arg, "standalone")) + ap_standalone = 1; + else + return "ServerType must be either 'inetd' or 'standalone'"; + + return 0; +} + +int main () +{ + server_type (0, 0, "standalone"); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030717-1.c b/gcc/testsuite/gcc.c-torture/execute/20030717-1.c new file mode 100644 index 000000000..7e43e44be --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030717-1.c @@ -0,0 +1,69 @@ +/* PR target/11087 + This testcase was miscompiled on ppc64, because basic_induction_var called + convert_modes, yet did not expect it to emit any new instructions. + Those were emitted at the end of the function and destroyed during life + analysis, while the program used uninitialized pseudos created by + convert_modes. */ + +struct A +{ + unsigned short a1; + unsigned long a2; +}; + +struct B +{ + int b1, b2, b3, b4, b5; +}; + +struct C +{ + struct B c1[1]; + int c2, c3; +}; + +static +int foo (int x) +{ + return x < 0 ? -x : x; +} + +int bar (struct C *x, struct A *y) +{ + int a = x->c3; + const int b = y->a1 >> 9; + const unsigned long c = y->a2; + int d = a; + unsigned long e, f; + + f = foo (c - x->c1[d].b4); + do + { + if (d <= 0) + d = x->c2; + d--; + + e = foo (c-x->c1[d].b4); + if (e < f) + a = d; + } + while (d != x->c3); + x->c1[a].b4 = c + b; + return a; +} + +int +main () +{ + struct A a; + struct C b; + int c; + + a.a1 = 512; + a.a2 = 4242; + __builtin_memset (&b, 0, sizeof (b)); + b.c1[0].b3 = 424242; + b.c2 = 1; + c = bar (&b, &a); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030718-1.c b/gcc/testsuite/gcc.c-torture/execute/20030718-1.c new file mode 100644 index 000000000..2a113f95e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030718-1.c @@ -0,0 +1,13 @@ +/* PR c/10320 + The function temp was not being emitted in a prerelease of 3.4 20030406. + Contributed by pinskia@physics.uc.edu */ + +static inline void temp(); +int main() +{ + temp(); + return 0; +} +static void temp(){} + + diff --git a/gcc/testsuite/gcc.c-torture/execute/20030811-1.c b/gcc/testsuite/gcc.c-torture/execute/20030811-1.c new file mode 100644 index 000000000..2ac59c03a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030811-1.c @@ -0,0 +1,35 @@ +/* Origin: PR target/11535 from H. J. Lu */ + +void vararg (int i, ...) +{ + (void) i; +} + +int i0[0], i1; + +void test1 (void) +{ + int a = (int) (long long) __builtin_return_address (0); + vararg (0, a); +} + +void test2 (void) +{ + i0[0] = (int) (long long) __builtin_return_address (0); +} + +void test3 (void) +{ + i1 = (int) (long long) __builtin_return_address (0); +} + +void test4 (void) +{ + volatile long long a = (long long) __builtin_return_address (0); + i0[0] = (int) a; +} + +int main (void) +{ + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030821-1.c b/gcc/testsuite/gcc.c-torture/execute/20030821-1.c new file mode 100644 index 000000000..b82c2f2d7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030821-1.c @@ -0,0 +1,16 @@ +extern void abort (void); + +int +foo (int x) +{ + if ((int) (x & 0x80ffffff) != (int) (0x8000fffe)) + abort (); + + return 0; +} + +int +main () +{ + return foo (0x8000fffe); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030828-1.c b/gcc/testsuite/gcc.c-torture/execute/20030828-1.c new file mode 100644 index 000000000..e8c1f0195 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030828-1.c @@ -0,0 +1,18 @@ +const int *p; + +int bar (void) +{ + return *p + 1; +} + +main () +{ + /* Variable 'i' is never used but it's aliased to a global pointer. The + alias analyzer was not considering that 'i' may be used in the call to + bar(). */ + const int i = 5; + p = &i; + if (bar() != 6) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030828-2.c b/gcc/testsuite/gcc.c-torture/execute/20030828-2.c new file mode 100644 index 000000000..0c3a195e6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030828-2.c @@ -0,0 +1,28 @@ +struct rtx_def +{ + int code; +}; + +main() +{ + int tmp[2]; + struct rtx_def *r, s; + int *p, *q; + + /* The alias analyzer was creating the same memory tag for r, p and q + because 'struct rtx_def *' is type-compatible with 'int *'. However, + the alias set of 'int[2]' is not the same as 'int *', so variable + 'tmp' was deemed not aliased with anything. */ + r = &s; + r->code = 39; + + /* If 'r' wasn't declared, then q and tmp would have had the same memory + tag. */ + p = tmp; + q = p + 1; + *q = 0; + tmp[1] = 39; + if (*q != 39) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030903-1.c b/gcc/testsuite/gcc.c-torture/execute/20030903-1.c new file mode 100644 index 000000000..95dad576f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030903-1.c @@ -0,0 +1,21 @@ +/* Test that we don't let stmt.c think that the enumeration's values are + the entire set of possibilities. Such an assumption is false for C, + but true for other languages. */ + +enum X { X1 = 1, X2, X3, X4 }; +static volatile enum X test = 0; +static void y(int); + +int main() +{ + switch (test) + { + case X1: y(1); break; + case X2: y(2); break; + case X3: y(3); break; + case X4: y(4); break; + } + return 0; +} + +static void y(int x) { abort (); } diff --git a/gcc/testsuite/gcc.c-torture/execute/20030909-1.c b/gcc/testsuite/gcc.c-torture/execute/20030909-1.c new file mode 100644 index 000000000..2f149857f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030909-1.c @@ -0,0 +1,35 @@ +void abort (); +void exit (int); + +void test(int x, int y) +{ + if (x == y) + abort (); +} + +void foo(int x, int y) +{ + if (x == y) + goto a; + else + { +a:; + if (x == y) + goto b; + else + { +b:; + if (x != y) + test (x, y); + } + } +} + +int main(void) +{ + foo (0, 0); + + exit (0); +} + + diff --git a/gcc/testsuite/gcc.c-torture/execute/20030910-1.c b/gcc/testsuite/gcc.c-torture/execute/20030910-1.c new file mode 100644 index 000000000..6c849134a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030910-1.c @@ -0,0 +1,13 @@ +/* The gimplifier was inserting unwanted temporaries for REALPART_EXPR + nodes. These need to be treated like a COMPONENT_REF so their address can + be taken. */ + +int main() +{ + __complex double dc; + double *dp = &(__real dc); + *dp = 3.14; + if ((__real dc) != 3.14) abort(); + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20030913-1.c b/gcc/testsuite/gcc.c-torture/execute/20030913-1.c new file mode 100644 index 000000000..5e33f50f5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030913-1.c @@ -0,0 +1,26 @@ +/* Assignments via pointers pointing to global variables were being killed + by SSA-DCE. Test contributed by Paul Brook */ + +int glob; + +void +fn2(int ** q) +{ + *q = &glob; +} + +void test() +{ + int *p; + + fn2(&p); + + *p=42; +} + +int main() +{ + test(); + if (glob != 42) abort(); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030914-1.c b/gcc/testsuite/gcc.c-torture/execute/20030914-1.c new file mode 100644 index 000000000..ab1c1541d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030914-1.c @@ -0,0 +1,26 @@ +/* On IRIX 6, PB is passed partially in registers and partially on the + stack, with an odd number of words in the register part. Check that + the long double stack argument (PC) is still accessed properly. */ + +struct s { int val[16]; }; + +long double f (int pa, struct s pb, long double pc) +{ + int i; + + for (i = 0; i < 16; i++) + pc += pb.val[i]; + return pc; +} + +int main () +{ + struct s x; + int i; + + for (i = 0; i < 16; i++) + x.val[i] = i + 1; + if (f (1, x, 10000.0L) != 10136.0L) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030914-2.c b/gcc/testsuite/gcc.c-torture/execute/20030914-2.c new file mode 100644 index 000000000..38a81982f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030914-2.c @@ -0,0 +1,21 @@ +/* On IRIX 6, PA is passed partially in registers and partially on the + stack. We therefore have two potential uses of pretend_args_size: + one for the partial argument and one for the varargs save area. + Make sure that these uses don't conflict. */ + +struct s { int i[18]; }; + +int f (struct s pa, int pb, ...) +{ + return pb; +} + +struct s gs; + +int main () +{ + if (f (gs, 0x1234) != 0x1234) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030916-1.c b/gcc/testsuite/gcc.c-torture/execute/20030916-1.c new file mode 100644 index 000000000..8b460c6dd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030916-1.c @@ -0,0 +1,35 @@ +/* "i" overflows in f(). Check that x[i] is not treated as a giv. */ +#include + +#if CHAR_BIT == 8 + +void f (unsigned int *x) +{ + unsigned char i; + int j; + + i = 0x10; + for (j = 0; j < 0x10; j++) + { + i += 0xe8; + x[i] = 0; + i -= 0xe7; + } +} + +int main () +{ + unsigned int x[256]; + int i; + + for (i = 0; i < 256; i++) + x[i] = 1; + f (x); + for (i = 0; i < 256; i++) + if (x[i] != (i >= 0x08 && i < 0xf8)) + abort (); + exit (0); +} +#else +int main () { exit (0); } +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/20030920-1.c b/gcc/testsuite/gcc.c-torture/execute/20030920-1.c new file mode 100644 index 000000000..2d22115c9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030920-1.c @@ -0,0 +1,15 @@ +extern void abort (void); + +int main() +{ + int hicount = 0; + unsigned char *c; + char *str = "\x7f\xff"; + for (c = (unsigned char *)str; *c ; c++) { + if (!(((unsigned int)(*c)) < 0x80)) hicount++; + } + if (hicount != 1) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20030928-1.c b/gcc/testsuite/gcc.c-torture/execute/20030928-1.c new file mode 100644 index 000000000..77216c9fe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030928-1.c @@ -0,0 +1,32 @@ +#include + +#if INT_MAX <= 32767 +int main () { exit (0); } +#else +void get_addrs (const char**x, int *y) +{ + x[0] = "a1111" + (y[0] - 0x10000) * 2; + x[1] = "a1112" + (y[1] - 0x20000) * 2; + x[2] = "a1113" + (y[2] - 0x30000) * 2; + x[3] = "a1114" + (y[3] - 0x40000) * 2; + x[4] = "a1115" + (y[4] - 0x50000) * 2; + x[5] = "a1116" + (y[5] - 0x60000) * 2; + x[6] = "a1117" + (y[6] - 0x70000) * 2; + x[7] = "a1118" + (y[7] - 0x80000) * 2; +} + +int main () +{ + const char *x[8]; + int y[8]; + int i; + + for (i = 0; i < 8; i++) + y[i] = 0x10000 * (i + 1); + get_addrs (x, y); + for (i = 0; i < 8; i++) + if (*x[i] != 'a') + abort (); + exit (0); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/20031003-1.c b/gcc/testsuite/gcc.c-torture/execute/20031003-1.c new file mode 100644 index 000000000..5d172e7e6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20031003-1.c @@ -0,0 +1,33 @@ +/* PR optimization/9325 */ + +#include + +extern void abort (void); + +int f1() +{ + return (int)2147483648.0f; +} + +int f2() +{ + return (int)(float)(2147483647); +} + +int main() +{ +#if INT_MAX == 2147483647 + if (f1() != 2147483647) + abort (); +#ifdef __SPU__ + /* SPU float rounds towards zero. */ + if (f2() != 0x7fffff80) + abort (); +#else + if (f2() != 2147483647) + abort (); +#endif +#endif + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20031010-1.c b/gcc/testsuite/gcc.c-torture/execute/20031010-1.c new file mode 100644 index 000000000..54457f964 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20031010-1.c @@ -0,0 +1,34 @@ +/* A reminder to process ops in generate_expr_as_of_bb exactly once. */ + +long __attribute__((noinline)) +foo (long ct, long cf, _Bool p1, _Bool p2, _Bool p3) +{ + long diff; + + diff = ct - cf; + + if (p1) + { + if (p2) + { + if (p3) + { + long tmp = ct; + ct = cf; + cf = tmp; + } + diff = ct - cf; + } + + return diff; + } + + abort (); +} + +int main () +{ + if (foo(2, 3, 1, 1, 1) == 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20031011-1.c b/gcc/testsuite/gcc.c-torture/execute/20031011-1.c new file mode 100644 index 000000000..9aa40b8a0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20031011-1.c @@ -0,0 +1,31 @@ +/* Check that MAX_EXPR and MIN_EXPR are working properly. */ + +#define MAX(X,Y) ((X) > (Y) ? (X) : (Y)) +#define MIN(X,Y) ((X) < (Y) ? (X) : (Y)) + +extern void abort (void); + +int main() +{ + int ll_bitsize, ll_bitpos; + int rl_bitsize, rl_bitpos; + int end_bit; + + ll_bitpos = 32; ll_bitsize = 32; + rl_bitpos = 0; rl_bitsize = 32; + + end_bit = MAX (ll_bitpos + ll_bitsize, rl_bitpos + rl_bitsize); + if (end_bit != 64) + abort (); + end_bit = MAX (rl_bitpos + rl_bitsize, ll_bitpos + ll_bitsize); + if (end_bit != 64) + abort (); + end_bit = MIN (ll_bitpos + ll_bitsize, rl_bitpos + rl_bitsize); + if (end_bit != 32) + abort (); + end_bit = MIN (rl_bitpos + rl_bitsize, ll_bitpos + ll_bitsize); + if (end_bit != 32) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20031012-1.c b/gcc/testsuite/gcc.c-torture/execute/20031012-1.c new file mode 100644 index 000000000..a1f3de8ba --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20031012-1.c @@ -0,0 +1,32 @@ +/* PR optimization/8750 + Used to fail under Cygwin with + -O2 -fomit-frame-pointer + Testcase by David B. Trout */ + +#if defined(STACK_SIZE) && STACK_SIZE < 16000 +#define ARRAY_SIZE (STACK_SIZE / 2) +#define STRLEN (ARRAY_SIZE - 9) +#else +#define ARRAY_SIZE 15000 +#define STRLEN 13371 +#endif + +extern void *memset (void *, int, __SIZE_TYPE__); +extern void abort (void); + +static void foo () +{ + char a[ARRAY_SIZE]; + + a[0]=0; + memset( &a[0], 0xCD, STRLEN ); + a[STRLEN]=0; + if (strlen(a) != STRLEN) + abort (); +} + +int main ( int argc, char* argv[] ) +{ + foo(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20031020-1.c b/gcc/testsuite/gcc.c-torture/execute/20031020-1.c new file mode 100644 index 000000000..526ca0402 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20031020-1.c @@ -0,0 +1,23 @@ +/* PR target/12654 + The Alpha backend tried to do a >= 1024 as (a - 1024) >= 0, which fails + for very large negative values. */ +/* Origin: tg@swox.com */ + +#include + +extern void abort (void); + +void __attribute__((noinline)) +foo (long x) +{ + if (x >= 1024) + abort (); +} + +int +main () +{ + foo (LONG_MIN); + foo (LONG_MIN + 10000); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20031201-1.c b/gcc/testsuite/gcc.c-torture/execute/20031201-1.c new file mode 100644 index 000000000..7c8e0ea29 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20031201-1.c @@ -0,0 +1,76 @@ +/* Copyright (C) 2003 Free Software Foundation. + PR target/13256 + STRICT_LOW_PART was handled incorrectly in delay slots. + Origin: Hans-Peter Nilsson. */ + +typedef struct { unsigned int e0 : 16; unsigned int e1 : 16; } s1; +typedef struct { unsigned int e0 : 16; unsigned int e1 : 16; } s2; +typedef struct { s1 i12; s2 i16; } io; +static int test_length = 2; +static io *i; +static int m = 1; +static int d = 1; +static unsigned long test_t0; +static unsigned long test_t1; +void test(void) __attribute__ ((__noinline__)); +extern int f1 (void *port) __attribute__ ((__noinline__)); +extern void f0 (void) __attribute__ ((__noinline__)); +int +f1 (void *port) +{ + int fail_count = 0; + unsigned long tlen; + s1 x0 = {0}; + s2 x1 = {0}; + + i = port; + x0.e0 = x1.e0 = 32; + i->i12 = x0; + i->i16 = x1; + do f0(); while (test_t1); + x0.e0 = x1.e0 = 8; + i->i12 = x0; + i->i16 = x1; + test (); + if (m) + { + unsigned long e = 1000000000 / 460800 * test_length; + tlen = test_t1 - test_t0; + if (((tlen-e) & 0x7FFFFFFF) > 1000) + f0(); + } + if (d) + { + unsigned long e = 1000000000 / 460800 * test_length; + tlen = test_t1 - test_t0; + if (((tlen - e) & 0x7FFFFFFF) > 1000) + f0(); + } + return fail_count != 0 ? 1 : 0; +} + +int +main () +{ + io io0; + f1 (&io0); + abort (); +} + +void +test (void) +{ + io *iop = i; + if (iop->i12.e0 != 8 || iop->i16.e0 != 8) + abort (); + exit (0); +} + +void +f0 (void) +{ + static int washere = 0; + io *iop = i; + if (washere++ || iop->i12.e0 != 32 || iop->i16.e0 != 32) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20031204-1.c b/gcc/testsuite/gcc.c-torture/execute/20031204-1.c new file mode 100644 index 000000000..a9c2f0195 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20031204-1.c @@ -0,0 +1,49 @@ +/* PR optimization/13260 */ + +#include + +typedef unsigned long u32; + +u32 in_aton(const char* x) +{ + return 0x0a0b0c0d; +} + +u32 root_nfs_parse_addr(char *name) +{ + u32 addr; + int octets = 0; + char *cp, *cq; + + cp = cq = name; + while (octets < 4) { + while (*cp >= '0' && *cp <= '9') + cp++; + if (cp == cq || cp - cq > 3) + break; + if (*cp == '.' || octets == 3) + octets++; + if (octets < 4) + cp++; + cq = cp; + } + + if (octets == 4 && (*cp == ':' || *cp == '\0')) { + if (*cp == ':') + *cp++ = '\0'; + addr = in_aton(name); + strcpy(name, cp); + } else + addr = (-1); + + return addr; +} + +int +main() +{ + static char addr[] = "10.11.12.13:/hello"; + u32 result = root_nfs_parse_addr(addr); + if (result != 0x0a0b0c0d) { abort(); } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20031211-1.c b/gcc/testsuite/gcc.c-torture/execute/20031211-1.c new file mode 100644 index 000000000..2361509a0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20031211-1.c @@ -0,0 +1,13 @@ +struct a { unsigned int bitfield : 1; }; + +unsigned int x; + +main() +{ + struct a a = {0}; + x = 0xbeef; + a.bitfield |= x; + if (a.bitfield != 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20031211-2.c b/gcc/testsuite/gcc.c-torture/execute/20031211-2.c new file mode 100644 index 000000000..555b17d9a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20031211-2.c @@ -0,0 +1,19 @@ +struct a +{ + unsigned int bitfield : 3; +}; + +int main() +{ + struct a a; + + a.bitfield = 131; + foo (a.bitfield); + exit (0); +} + +foo(unsigned int z) +{ + if (z != 3) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20031214-1.c b/gcc/testsuite/gcc.c-torture/execute/20031214-1.c new file mode 100644 index 000000000..e52200c01 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20031214-1.c @@ -0,0 +1,32 @@ +/* PR optimization/10312 */ +/* Originator: Peter van Hoof

*/ + +/* Verify that the strength reduction pass doesn't find + illegitimate givs. */ + +struct +{ + double a; + int n[2]; +} g = { 0., { 1, 2}}; + +int k = 0; + +void +b (int *j) +{ +} + +int +main () +{ + int j; + + for (j = 0; j < 2; j++) + k = (k > g.n[j]) ? k : g.n[j]; + + k++; + b (&j); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20031215-1.c b/gcc/testsuite/gcc.c-torture/execute/20031215-1.c new file mode 100644 index 000000000..d62177b26 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20031215-1.c @@ -0,0 +1,38 @@ +/* PR middle-end/13400 */ +/* The following test used to fail at run-time with a write to read-only + memory, caused by if-conversion converting a conditional write into an + unconditional write. */ + +typedef struct {int c, l; char ch[3];} pstr; +const pstr ao = {2, 2, "OK"}; +const pstr * const a = &ao; + +void test1(void) +{ + if (a->ch[a->l]) { + ((char *)a->ch)[a->l] = 0; + } +} + +void test2(void) +{ + if (a->ch[a->l]) { + ((char *)a->ch)[a->l] = -1; + } +} + +void test3(void) +{ + if (a->ch[a->l]) { + ((char *)a->ch)[a->l] = 1; + } +} + +int main(void) +{ + test1(); + test2(); + test3(); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20031216-1.c b/gcc/testsuite/gcc.c-torture/execute/20031216-1.c new file mode 100644 index 000000000..709f0166a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20031216-1.c @@ -0,0 +1,23 @@ +/* PR optimization/13313 */ +/* Origin: Mike Lerwill */ + +extern void abort(void); + +void DisplayNumber (unsigned long v) +{ + if (v != 0x9aL) + abort(); +} + +unsigned long ReadNumber (void) +{ + return 0x009a0000L; +} + +int main (void) +{ + unsigned long tmp; + tmp = (ReadNumber() & 0x00ff0000L) >> 16; + DisplayNumber (tmp); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20040208-1.c b/gcc/testsuite/gcc.c-torture/execute/20040208-1.c new file mode 100644 index 000000000..023575910 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040208-1.c @@ -0,0 +1,10 @@ +int main () +{ + long double x; + + x = 0x1.0p-500L; + x *= 0x1.0p-522L; + if (x != 0x1.0p-1022L) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20040208-2.c b/gcc/testsuite/gcc.c-torture/execute/20040208-2.c new file mode 100644 index 000000000..d8a5afc94 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040208-2.c @@ -0,0 +1,11 @@ +int main () +{ + long double x, y; + + x = 0x1.fffffffffffff8p1022L; + x *= 2; + y = 0x1.fffffffffffff8p1023L; + if (memcmp (&x, &y, sizeof (x)) != 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20040208-2.x b/gcc/testsuite/gcc.c-torture/execute/20040208-2.x new file mode 100644 index 000000000..6c7d3d550 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040208-2.x @@ -0,0 +1 @@ +return [expr ![istarget mips*-*-irix6*]] diff --git a/gcc/testsuite/gcc.c-torture/execute/20040218-1.c b/gcc/testsuite/gcc.c-torture/execute/20040218-1.c new file mode 100644 index 000000000..4d1541af8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040218-1.c @@ -0,0 +1,37 @@ +/* PR target/14209. Bug in cris.md, shrinking access size of + postincrement. + Origin: . */ + +long int xb (long int *y) __attribute__ ((__noinline__)); +long int xw (long int *y) __attribute__ ((__noinline__)); +short int yb (short int *y) __attribute__ ((__noinline__)); + +long int xb (long int *y) +{ + long int xx = *y & 255; + return xx + y[1]; +} + +long int xw (long int *y) +{ + long int xx = *y & 65535; + return xx + y[1]; +} + +short int yb (short int *y) +{ + short int xx = *y & 255; + return xx + y[1]; +} + +int main (void) +{ + long int y[] = {-1, 16000}; + short int yw[] = {-1, 16000}; + + if (xb (y) != 16255 + || xw (y) != 81535 + || yb (yw) != 16255) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20040223-1.c b/gcc/testsuite/gcc.c-torture/execute/20040223-1.c new file mode 100644 index 000000000..940ec0dcf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040223-1.c @@ -0,0 +1,16 @@ +#include +#include + +void +a(void *x,int y) +{ + if (y != 1234) + abort (); +} + +int +main() +{ + a(strcpy(alloca(100),"abc"),1234); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20040302-1.c b/gcc/testsuite/gcc.c-torture/execute/20040302-1.c new file mode 100644 index 000000000..07056c43f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040302-1.c @@ -0,0 +1,24 @@ +int code[]={0,0,0,0,1}; + +void foo(int x) { + volatile int b; + b = 0xffffffff; +} + +void bar(int *pc) { + static const void *l[] = {&&lab0, &&end}; + + foo(0); + goto *l[*pc]; + lab0: + foo(0); + pc++; + goto *l[*pc]; + end: + return; +} + +int main() { + bar(code); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20040307-1.c b/gcc/testsuite/gcc.c-torture/execute/20040307-1.c new file mode 100644 index 000000000..8ab8008bb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040307-1.c @@ -0,0 +1,25 @@ +int main() +{ + int b = 0; + + struct { + unsigned int bit0:1; + unsigned int bit1:1; + unsigned int bit2:1; + unsigned int bit3:1; + unsigned int bit4:1; + unsigned int bit5:1; + unsigned int bit6:1; + unsigned int bit7:1; + } sdata = {0x01}; + + while ( sdata.bit0-- > 0 ) { + b++ ; + if ( b > 100 ) break; + } + + if (b != 1) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20040308-1.c b/gcc/testsuite/gcc.c-torture/execute/20040308-1.c new file mode 100644 index 000000000..4c63535e7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040308-1.c @@ -0,0 +1,21 @@ +/* This used to fail on SPARC with an unaligned memory access. */ + +void foo(int n) +{ + struct S { + int i[n]; + unsigned int b:1; + int i2; + } __attribute__ ((packed)) __attribute__ ((aligned (4))); + + struct S s; + + s.i2 = 0; +} + +int main(void) +{ + foo(4); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20040309-1.c b/gcc/testsuite/gcc.c-torture/execute/20040309-1.c new file mode 100644 index 000000000..49fa79560 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040309-1.c @@ -0,0 +1,24 @@ +extern void abort (); + +int foo(unsigned short x) +{ + unsigned short y; + y = x > 32767 ? x - 32768 : 0; + return y; +} + +int main() +{ + if (foo (0) != 0) + abort (); + if (foo (32767) != 0) + abort (); + if (foo (32768) != 0) + abort (); + if (foo (32769) != 1) + abort (); + if (foo (65535) != 32767) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20040311-1.c b/gcc/testsuite/gcc.c-torture/execute/20040311-1.c new file mode 100644 index 000000000..013d869ab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040311-1.c @@ -0,0 +1,68 @@ +/* Copyright (C) 2004 Free Software Foundation. + + Check that constant folding and RTL simplification of -(x >> y) doesn't + break anything and produces the expected results. + + Written by Roger Sayle, 11th March 2004. */ + +extern void abort (void); + +#define INT_BITS (sizeof(int)*8) + +int test1(int x) +{ + return -(x >> (INT_BITS-1)); +} + +int test2(unsigned int x) +{ + return -((int)(x >> (INT_BITS-1))); +} + +int test3(int x) +{ + int y; + y = INT_BITS-1; + return -(x >> y); +} + +int test4(unsigned int x) +{ + int y; + y = INT_BITS-1; + return -((int)(x >> y)); +} + +int main() +{ + if (test1(0) != 0) + abort (); + if (test1(1) != 0) + abort (); + if (test1(-1) != 1) + abort (); + + if (test2(0) != 0) + abort (); + if (test2(1) != 0) + abort (); + if (test2((unsigned int)-1) != -1) + abort (); + + if (test3(0) != 0) + abort (); + if (test3(1) != 0) + abort (); + if (test3(-1) != 1) + abort (); + + if (test4(0) != 0) + abort (); + if (test4(1) != 0) + abort (); + if (test4((unsigned int)-1) != -1) + abort (); + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20040313-1.c b/gcc/testsuite/gcc.c-torture/execute/20040313-1.c new file mode 100644 index 000000000..c05fe730f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040313-1.c @@ -0,0 +1,17 @@ +/* PR middle-end/14470 */ +/* Origin: Lodewijk Voge */ + +extern void abort(void); + +int main() +{ + int t[1025] = { 1024 }, d; + + d = 0; + d = t[d]++; + if (t[0] != 1025) + abort(); + if (d != 1024) + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20040319-1.c b/gcc/testsuite/gcc.c-torture/execute/20040319-1.c new file mode 100644 index 000000000..357932d9b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040319-1.c @@ -0,0 +1,17 @@ +int +blah (int zzz) +{ + int foo; + if (zzz >= 0) + return 1; + foo = (zzz >= 0 ? (zzz) : -(zzz)); + return foo; +} + +main() +{ + if (blah (-1) != 1) + abort (); + else + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20040331-1.c b/gcc/testsuite/gcc.c-torture/execute/20040331-1.c new file mode 100644 index 000000000..2e8f9e867 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040331-1.c @@ -0,0 +1,20 @@ +/* PR c++/14755 */ +extern void abort (void); +extern void exit (int); + +int +main (void) +{ +#if __INT_MAX__ >= 2147483647 + struct { int count: 31; } s = { 0 }; + while (s.count--) + abort (); +#elif __INT_MAX__ >= 32767 + struct { int count: 15; } s = { 0 }; + while (s.count--) + abort (); +#else + /* Don't bother because __INT_MAX__ is too small. */ +#endif + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20040409-1.c b/gcc/testsuite/gcc.c-torture/execute/20040409-1.c new file mode 100644 index 000000000..1e81edb36 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040409-1.c @@ -0,0 +1,142 @@ +#include + +extern void abort (); + +int test1(int x) +{ + return x ^ INT_MIN; +} + +unsigned int test1u(unsigned int x) +{ + return x ^ (unsigned int)INT_MIN; +} + +int test2(int x) +{ + return x + INT_MIN; +} + +unsigned int test2u(unsigned int x) +{ + return x + (unsigned int)INT_MIN; +} + +int test3(int x) +{ + return x - INT_MIN; +} + +unsigned int test3u(unsigned int x) +{ + return x - (unsigned int)INT_MIN; +} + +int test4(int x) +{ + int y = INT_MIN; + return x ^ y; +} + +unsigned int test4u(unsigned int x) +{ + unsigned int y = (unsigned int)INT_MIN; + return x ^ y; +} + +int test5(int x) +{ + int y = INT_MIN; + return x + y; +} + +unsigned int test5u(unsigned int x) +{ + unsigned int y = (unsigned int)INT_MIN; + return x + y; +} + +int test6(int x) +{ + int y = INT_MIN; + return x - y; +} + +unsigned int test6u(unsigned int x) +{ + unsigned int y = (unsigned int)INT_MIN; + return x - y; +} + + + +void test(int a, int b) +{ + if (test1(a) != b) + abort(); + if (test2(a) != b) + abort(); + if (test3(a) != b) + abort(); + if (test4(a) != b) + abort(); + if (test5(a) != b) + abort(); + if (test6(a) != b) + abort(); +} + +void testu(unsigned int a, unsigned int b) +{ + if (test1u(a) != b) + abort(); + if (test2u(a) != b) + abort(); + if (test3u(a) != b) + abort(); + if (test4u(a) != b) + abort(); + if (test5u(a) != b) + abort(); + if (test6u(a) != b) + abort(); +} + + +int main() +{ +#if INT_MAX == 2147483647 + test(0x00000000,0x80000000); + test(0x80000000,0x00000000); + test(0x12345678,0x92345678); + test(0x92345678,0x12345678); + test(0x7fffffff,0xffffffff); + test(0xffffffff,0x7fffffff); + + testu(0x00000000,0x80000000); + testu(0x80000000,0x00000000); + testu(0x12345678,0x92345678); + testu(0x92345678,0x12345678); + testu(0x7fffffff,0xffffffff); + testu(0xffffffff,0x7fffffff); +#endif + +#if INT_MAX == 32767 + test(0x0000,0x8000); + test(0x8000,0x0000); + test(0x1234,0x9234); + test(0x9234,0x1234); + test(0x7fff,0xffff); + test(0xffff,0x7fff); + + testu(0x0000,0x8000); + testu(0x8000,0x0000); + testu(0x1234,0x9234); + testu(0x9234,0x1234); + testu(0x7fff,0xffff); + testu(0xffff,0x7fff); +#endif + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20040409-2.c b/gcc/testsuite/gcc.c-torture/execute/20040409-2.c new file mode 100644 index 000000000..c83ff1adf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040409-2.c @@ -0,0 +1,243 @@ +#include + +extern void abort (); + +int test1(int x) +{ + return (x ^ INT_MIN) ^ 0x1234; +} + +unsigned int test1u(unsigned int x) +{ + return (x ^ (unsigned int)INT_MIN) ^ 0x1234; +} + +int test2(int x) +{ + return (x ^ 0x1234) ^ INT_MIN; +} + +unsigned int test2u(unsigned int x) +{ + return (x ^ 0x1234) ^ (unsigned int)INT_MIN; +} + +int test3(int x) +{ + return (x + INT_MIN) ^ 0x1234; +} + +unsigned int test3u(unsigned int x) +{ + return (x + (unsigned int)INT_MIN) ^ 0x1234; +} + +int test4(int x) +{ + return (x ^ 0x1234) + INT_MIN; +} + +unsigned int test4u(unsigned int x) +{ + return (x ^ 0x1234) + (unsigned int)INT_MIN; +} + +int test5(int x) +{ + return (x - INT_MIN) ^ 0x1234; +} + +unsigned int test5u(unsigned int x) +{ + return (x - (unsigned int)INT_MIN) ^ 0x1234; +} + +int test6(int x) +{ + return (x ^ 0x1234) - INT_MIN; +} + +unsigned int test6u(unsigned int x) +{ + return (x ^ 0x1234) - (unsigned int)INT_MIN; +} + +int test7(int x) +{ + int y = INT_MIN; + int z = 0x1234; + return (x ^ y) ^ z; +} + +unsigned int test7u(unsigned int x) +{ + unsigned int y = (unsigned int)INT_MIN; + unsigned int z = 0x1234; + return (x ^ y) ^ z; +} + +int test8(int x) +{ + int y = 0x1234; + int z = INT_MIN; + return (x ^ y) ^ z; +} + +unsigned int test8u(unsigned int x) +{ + unsigned int y = 0x1234; + unsigned int z = (unsigned int)INT_MIN; + return (x ^ y) ^ z; +} + +int test9(int x) +{ + int y = INT_MIN; + int z = 0x1234; + return (x + y) ^ z; +} + +unsigned int test9u(unsigned int x) +{ + unsigned int y = (unsigned int)INT_MIN; + unsigned int z = 0x1234; + return (x + y) ^ z; +} + +int test10(int x) +{ + int y = 0x1234; + int z = INT_MIN; + return (x ^ y) + z; +} + +unsigned int test10u(unsigned int x) +{ + unsigned int y = 0x1234; + unsigned int z = (unsigned int)INT_MIN; + return (x ^ y) + z; +} + +int test11(int x) +{ + int y = INT_MIN; + int z = 0x1234; + return (x - y) ^ z; +} + +unsigned int test11u(unsigned int x) +{ + unsigned int y = (unsigned int)INT_MIN; + unsigned int z = 0x1234; + return (x - y) ^ z; +} + +int test12(int x) +{ + int y = 0x1234; + int z = INT_MIN; + return (x ^ y) - z; +} + +unsigned int test12u(unsigned int x) +{ + unsigned int y = 0x1234; + unsigned int z = (unsigned int)INT_MIN; + return (x ^ y) - z; +} + + +void test(int a, int b) +{ + if (test1(a) != b) + abort(); + if (test2(a) != b) + abort(); + if (test3(a) != b) + abort(); + if (test4(a) != b) + abort(); + if (test5(a) != b) + abort(); + if (test6(a) != b) + abort(); + if (test7(a) != b) + abort(); + if (test8(a) != b) + abort(); + if (test9(a) != b) + abort(); + if (test10(a) != b) + abort(); + if (test11(a) != b) + abort(); + if (test12(a) != b) + abort(); +} + +void testu(unsigned int a, unsigned int b) +{ + if (test1u(a) != b) + abort(); + if (test2u(a) != b) + abort(); + if (test3u(a) != b) + abort(); + if (test4u(a) != b) + abort(); + if (test5u(a) != b) + abort(); + if (test6u(a) != b) + abort(); + if (test7u(a) != b) + abort(); + if (test8u(a) != b) + abort(); + if (test9u(a) != b) + abort(); + if (test10u(a) != b) + abort(); + if (test11u(a) != b) + abort(); + if (test12u(a) != b) + abort(); +} + + +int main() +{ +#if INT_MAX == 2147483647 + test(0x00000000,0x80001234); + test(0x00001234,0x80000000); + test(0x80000000,0x00001234); + test(0x80001234,0x00000000); + test(0x7fffffff,0xffffedcb); + test(0xffffffff,0x7fffedcb); + + testu(0x00000000,0x80001234); + testu(0x00001234,0x80000000); + testu(0x80000000,0x00001234); + testu(0x80001234,0x00000000); + testu(0x7fffffff,0xffffedcb); + testu(0xffffffff,0x7fffedcb); +#endif + +#if INT_MAX == 32767 + test(0x0000,0x9234); + test(0x1234,0x8000); + test(0x8000,0x1234); + test(0x9234,0x0000); + test(0x7fff,0xedcb); + test(0xffff,0x6dcb); + + testu(0x0000,0x9234); + testu(0x8000,0x1234); + testu(0x1234,0x8000); + testu(0x9234,0x0000); + testu(0x7fff,0xedcb); + testu(0xffff,0x6dcb); +#endif + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20040409-3.c b/gcc/testsuite/gcc.c-torture/execute/20040409-3.c new file mode 100644 index 000000000..07aa99cee --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040409-3.c @@ -0,0 +1,142 @@ +#include + +extern void abort (); + +int test1(int x) +{ + return ~(x ^ INT_MIN); +} + +unsigned int test1u(unsigned int x) +{ + return ~(x ^ (unsigned int)INT_MIN); +} + +int test2(int x) +{ + return ~(x + INT_MIN); +} + +unsigned int test2u(unsigned int x) +{ + return ~(x + (unsigned int)INT_MIN); +} + +int test3(int x) +{ + return ~(x - INT_MIN); +} + +unsigned int test3u(unsigned int x) +{ + return ~(x - (unsigned int)INT_MIN); +} + +int test4(int x) +{ + int y = INT_MIN; + return ~(x ^ y); +} + +unsigned int test4u(unsigned int x) +{ + unsigned int y = (unsigned int)INT_MIN; + return ~(x ^ y); +} + +int test5(int x) +{ + int y = INT_MIN; + return ~(x + y); +} + +unsigned int test5u(unsigned int x) +{ + unsigned int y = (unsigned int)INT_MIN; + return ~(x + y); +} + +int test6(int x) +{ + int y = INT_MIN; + return ~(x - y); +} + +unsigned int test6u(unsigned int x) +{ + unsigned int y = (unsigned int)INT_MIN; + return ~(x - y); +} + + + +void test(int a, int b) +{ + if (test1(a) != b) + abort(); + if (test2(a) != b) + abort(); + if (test3(a) != b) + abort(); + if (test4(a) != b) + abort(); + if (test5(a) != b) + abort(); + if (test6(a) != b) + abort(); +} + +void testu(unsigned int a, unsigned int b) +{ + if (test1u(a) != b) + abort(); + if (test2u(a) != b) + abort(); + if (test3u(a) != b) + abort(); + if (test4u(a) != b) + abort(); + if (test5u(a) != b) + abort(); + if (test6u(a) != b) + abort(); +} + + +int main() +{ +#if INT_MAX == 2147483647 + test(0x00000000,0x7fffffff); + test(0x80000000,0xffffffff); + test(0x12345678,0x6dcba987); + test(0x92345678,0xedcba987); + test(0x7fffffff,0x00000000); + test(0xffffffff,0x80000000); + + testu(0x00000000,0x7fffffff); + testu(0x80000000,0xffffffff); + testu(0x12345678,0x6dcba987); + testu(0x92345678,0xedcba987); + testu(0x7fffffff,0x00000000); + testu(0xffffffff,0x80000000); +#endif + +#if INT_MAX == 32767 + test(0x0000,0x7fff); + test(0x8000,0xffff); + test(0x1234,0x6dcb); + test(0x9234,0xedcb); + test(0x7fff,0x0000); + test(0xffff,0x8000); + + testu(0x0000,0x7fff); + testu(0x8000,0xffff); + testu(0x1234,0x6dcb); + testu(0x9234,0xedcb); + testu(0x7fff,0x0000); + testu(0xffff,0x8000); +#endif + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20040411-1.c b/gcc/testsuite/gcc.c-torture/execute/20040411-1.c new file mode 100644 index 000000000..8db456229 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040411-1.c @@ -0,0 +1,23 @@ +int +sub1 (int i, int j) +{ + typedef int c[i+2]; + int x[10], y[10]; + + if (j == 2) + { + memcpy (x, y, 10 * sizeof (int)); + return sizeof (c); + } + else + return sizeof (c) * 3; +} + +int +main () +{ + if (sub1 (20, 3) != 66 * sizeof (int)) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20040423-1.c b/gcc/testsuite/gcc.c-torture/execute/20040423-1.c new file mode 100644 index 000000000..ace797e79 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040423-1.c @@ -0,0 +1,30 @@ +int +sub1 (int i, int j) +{ + typedef struct + { + int c[i+2]; + }c; + int x[10], y[10]; + + if (j == 2) + { + memcpy (x, y, 10 * sizeof (int)); + return sizeof (c); + } + else + return sizeof (c) * 3; +} + +int +main () +{ + typedef struct + { + int c[22]; + }c; + if (sub1 (20, 3) != sizeof (c)*3) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20040520-1.c b/gcc/testsuite/gcc.c-torture/execute/20040520-1.c new file mode 100644 index 000000000..b42483714 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040520-1.c @@ -0,0 +1,17 @@ +/* PR 15454 */ + +void abort (); +int main () { + int foo; + int bar (void) + { + int baz = 0; + if (foo!=45) + baz = foo; + return baz; + } + foo = 1; + if (!bar ()) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20040625-1.c b/gcc/testsuite/gcc.c-torture/execute/20040625-1.c new file mode 100644 index 000000000..c426055db --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040625-1.c @@ -0,0 +1,20 @@ +/* From PR target/16176 */ +struct __attribute__ ((packed)) s { struct s *next; }; + +struct s * __attribute__ ((noinline)) +maybe_next (struct s *s, int t) +{ + if (t) + s = s->next; + return s; +} + +int main () +{ + struct s s1, s2; + + s1.next = &s2; + if (maybe_next (&s1, 1) != &s2) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20040629-1.c b/gcc/testsuite/gcc.c-torture/execute/20040629-1.c new file mode 100644 index 000000000..6b3e90692 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040629-1.c @@ -0,0 +1,139 @@ +/* Test arithmetics on bitfields. */ +#ifndef T + +extern void abort (void); +extern void exit (int); + +#ifndef FIELDS1 +#define FIELDS1 +#endif +#ifndef FIELDS2 +#define FIELDS2 +#endif + +struct { FIELDS1 unsigned int i : 6, j : 11, k : 15; FIELDS2 } b; +struct { FIELDS1 unsigned int i : 5, j : 1, k : 26; FIELDS2 } c; +struct { FIELDS1 unsigned int i : 16, j : 8, k : 8; FIELDS2 } d; + +unsigned int ret1 (void) { return b.i; } +unsigned int ret2 (void) { return b.j; } +unsigned int ret3 (void) { return b.k; } +unsigned int ret4 (void) { return c.i; } +unsigned int ret5 (void) { return c.j; } +unsigned int ret6 (void) { return c.k; } +unsigned int ret7 (void) { return d.i; } +unsigned int ret8 (void) { return d.j; } +unsigned int ret9 (void) { return d.k; } + +#define T(n, pre, post, op) \ +void fn1_##n (unsigned int x) { pre b.i post; } \ +void fn2_##n (unsigned int x) { pre b.j post; } \ +void fn3_##n (unsigned int x) { pre b.k post; } \ +void fn4_##n (unsigned int x) { pre c.i post; } \ +void fn5_##n (unsigned int x) { pre c.j post; } \ +void fn6_##n (unsigned int x) { pre c.k post; } \ +void fn7_##n (unsigned int x) { pre d.i post; } \ +void fn8_##n (unsigned int x) { pre d.j post; } \ +void fn9_##n (unsigned int x) { pre d.k post; } + +#include "20040629-1.c" +#undef T + +#define FAIL(n, i) abort () + +int +main (void) +{ +#define T(n, pre, post, op) \ + b.i = 51; \ + b.j = 636; \ + b.k = 31278; \ + c.i = 21; \ + c.j = 1; \ + c.k = 33554432; \ + d.i = 26812; \ + d.j = 156; \ + d.k = 187; \ + fn1_##n (3); \ + if (ret1 () != (op (51, 3) & ((1 << 6) - 1))) \ + FAIL (n, 1); \ + b.i = 51; \ + fn2_##n (251); \ + if (ret2 () != (op (636, 251) & ((1 << 11) - 1))) \ + FAIL (n, 2); \ + b.j = 636; \ + fn3_##n (13279); \ + if (ret3 () != (op (31278, 13279) & ((1 << 15) - 1))) \ + FAIL (n, 3); \ + b.j = 31278; \ + fn4_##n (24); \ + if (ret4 () != (op (21, 24) & ((1 << 5) - 1))) \ + FAIL (n, 4); \ + c.i = 21; \ + fn5_##n (1); \ + if (ret5 () != (op (1, 1) & ((1 << 1) - 1))) \ + FAIL (n, 5); \ + c.j = 1; \ + fn6_##n (264151); \ + if (ret6 () != (op (33554432, 264151) & ((1 << 26) - 1))) \ + FAIL (n, 6); \ + c.k = 33554432; \ + fn7_##n (713); \ + if (ret7 () != (op (26812, 713) & ((1 << 16) - 1))) \ + FAIL (n, 7); \ + d.i = 26812; \ + fn8_##n (17); \ + if (ret8 () != (op (156, 17) & ((1 << 8) - 1))) \ + FAIL (n, 8); \ + d.j = 156; \ + fn9_##n (199); \ + if (ret9 () != (op (187, 199) & ((1 << 8) - 1))) \ + FAIL (n, 9); \ + d.k = 187; + +#include "20040629-1.c" +#undef T + return 0; +} + +#else + +#ifndef opadd +#define opadd(x, y) (x + y) +#define opsub(x, y) (x - y) +#define opinc(x, y) (x + 1) +#define opdec(x, y) (x - 1) +#define opand(x, y) (x & y) +#define opior(x, y) (x | y) +#define opxor(x, y) (x ^ y) +#define opdiv(x, y) (x / y) +#define oprem(x, y) (x % y) +#define opadd3(x, y) (x + 3) +#define opsub7(x, y) (x - 7) +#define opand21(x, y) (x & 21) +#define opior19(x, y) (x | 19) +#define opxor37(x, y) (x ^ 37) +#define opdiv17(x, y) (x / 17) +#define oprem19(x, y) (x % 19) +#endif + +T(1, , += x, opadd) +T(2, ++, , opinc) +T(3, , ++, opinc) +T(4, , -= x, opsub) +T(5, --, , opdec) +T(6, , --, opdec) +T(7, , &= x, opand) +T(8, , |= x, opior) +T(9, , ^= x, opxor) +T(a, , /= x, opdiv) +T(b, , %= x, oprem) +T(c, , += 3, opadd3) +T(d, , -= 7, opsub7) +T(e, , &= 21, opand21) +T(f, , |= 19, opior19) +T(g, , ^= 37, opxor37) +T(h, , /= 17, opdiv17) +T(i, , %= 19, oprem19) + +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/20040629-1.x b/gcc/testsuite/gcc.c-torture/execute/20040629-1.x new file mode 100644 index 000000000..121fcfecc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040629-1.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_int16] } { + return 1 +} + +return 0; diff --git a/gcc/testsuite/gcc.c-torture/execute/20040703-1.c b/gcc/testsuite/gcc.c-torture/execute/20040703-1.c new file mode 100644 index 000000000..eba358d35 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040703-1.c @@ -0,0 +1,147 @@ +/* PR 16341 */ + +#define PART_PRECISION (sizeof (cpp_num_part) * 8) + +typedef unsigned int cpp_num_part; +typedef struct cpp_num cpp_num; +struct cpp_num +{ + cpp_num_part high; + cpp_num_part low; + int unsignedp; /* True if value should be treated as unsigned. */ + int overflow; /* True if the most recent calculation overflowed. */ +}; + +static int +num_positive (cpp_num num, unsigned int precision) +{ + if (precision > PART_PRECISION) + { + precision -= PART_PRECISION; + return (num.high & (cpp_num_part) 1 << (precision - 1)) == 0; + } + + return (num.low & (cpp_num_part) 1 << (precision - 1)) == 0; +} + +static cpp_num +num_trim (cpp_num num, unsigned int precision) +{ + if (precision > PART_PRECISION) + { + precision -= PART_PRECISION; + if (precision < PART_PRECISION) + num.high &= ((cpp_num_part) 1 << precision) - 1; + } + else + { + if (precision < PART_PRECISION) + num.low &= ((cpp_num_part) 1 << precision) - 1; + num.high = 0; + } + + return num; +} + +/* Shift NUM, of width PRECISION, right by N bits. */ +static cpp_num +num_rshift (cpp_num num, unsigned int precision, unsigned int n) +{ + cpp_num_part sign_mask; + int x = num_positive (num, precision); + + if (num.unsignedp || x) + sign_mask = 0; + else + sign_mask = ~(cpp_num_part) 0; + + if (n >= precision) + num.high = num.low = sign_mask; + else + { + /* Sign-extend. */ + if (precision < PART_PRECISION) + num.high = sign_mask, num.low |= sign_mask << precision; + else if (precision < 2 * PART_PRECISION) + num.high |= sign_mask << (precision - PART_PRECISION); + + if (n >= PART_PRECISION) + { + n -= PART_PRECISION; + num.low = num.high; + num.high = sign_mask; + } + + if (n) + { + num.low = (num.low >> n) | (num.high << (PART_PRECISION - n)); + num.high = (num.high >> n) | (sign_mask << (PART_PRECISION - n)); + } + } + + num = num_trim (num, precision); + num.overflow = 0; + return num; +} + #define num_zerop(num) ((num.low | num.high) == 0) +#define num_eq(num1, num2) (num1.low == num2.low && num1.high == num2.high) + +cpp_num +num_lshift (cpp_num num, unsigned int precision, unsigned int n) +{ + if (n >= precision) + { + num.overflow = !num.unsignedp && !num_zerop (num); + num.high = num.low = 0; + } + else + { + cpp_num orig; + unsigned int m = n; + + orig = num; + if (m >= PART_PRECISION) + { + m -= PART_PRECISION; + num.high = num.low; + num.low = 0; + } + if (m) + { + num.high = (num.high << m) | (num.low >> (PART_PRECISION - m)); + num.low <<= m; + } + num = num_trim (num, precision); + + if (num.unsignedp) + num.overflow = 0; + else + { + cpp_num maybe_orig = num_rshift (num, precision, n); + num.overflow = !num_eq (orig, maybe_orig); + } + } + + return num; +} + +unsigned int precision = 64; +unsigned int n = 16; + +cpp_num num = { 0, 3, 0, 0 }; + +int main() +{ + cpp_num res = num_lshift (num, 64, n); + + if (res.low != 0x30000) + abort (); + + if (res.high != 0) + abort (); + + if (res.overflow != 0) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20040703-1.x b/gcc/testsuite/gcc.c-torture/execute/20040703-1.x new file mode 100644 index 000000000..121fcfecc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040703-1.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_int16] } { + return 1 +} + +return 0; diff --git a/gcc/testsuite/gcc.c-torture/execute/20040704-1.c b/gcc/testsuite/gcc.c-torture/execute/20040704-1.c new file mode 100644 index 000000000..c6b23d032 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040704-1.c @@ -0,0 +1,14 @@ +/* PR 16348: Make sure that condition-first false loops DTRT. */ + +extern void abort (); + +int main() +{ + for (; 0 ;) + { + abort (); + label: + return 0; + } + goto label; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20040705-1.c b/gcc/testsuite/gcc.c-torture/execute/20040705-1.c new file mode 100644 index 000000000..a9ba88ec2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040705-1.c @@ -0,0 +1,2 @@ +#define FIELDS1 long long l; +#include "20040629-1.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/20040705-1.x b/gcc/testsuite/gcc.c-torture/execute/20040705-1.x new file mode 100644 index 000000000..121fcfecc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040705-1.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_int16] } { + return 1 +} + +return 0; diff --git a/gcc/testsuite/gcc.c-torture/execute/20040705-2.c b/gcc/testsuite/gcc.c-torture/execute/20040705-2.c new file mode 100644 index 000000000..a36fb6a68 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040705-2.c @@ -0,0 +1,2 @@ +#define FIELDS2 long long l; +#include "20040629-1.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/20040705-2.x b/gcc/testsuite/gcc.c-torture/execute/20040705-2.x new file mode 100644 index 000000000..121fcfecc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040705-2.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_int16] } { + return 1 +} + +return 0; diff --git a/gcc/testsuite/gcc.c-torture/execute/20040706-1.c b/gcc/testsuite/gcc.c-torture/execute/20040706-1.c new file mode 100644 index 000000000..6b0ab36ac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040706-1.c @@ -0,0 +1,9 @@ +int main () +{ + int i; + for (i = 0; i < 10; i++) + continue; + if (i < 10) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20040707-1.c b/gcc/testsuite/gcc.c-torture/execute/20040707-1.c new file mode 100644 index 000000000..6fc15cc24 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040707-1.c @@ -0,0 +1,12 @@ +struct s { char c1, c2; }; +void foo (struct s s) +{ + static struct s s1; + s1 = s; +} +int main () +{ + static struct s s2; + foo (s2); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20040709-1.c b/gcc/testsuite/gcc.c-torture/execute/20040709-1.c new file mode 100644 index 000000000..455313ade --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040709-1.c @@ -0,0 +1,147 @@ +/* Test arithmetics on bitfields. */ + +extern void abort (void); +extern void exit (int); + +unsigned int +myrnd (void) +{ + static unsigned int s = 1388815473; + s *= 1103515245; + s += 12345; + return (s / 65536) % 2048; +} + +#define T(S) \ +struct S s##S; \ +struct S retme##S (struct S x) \ +{ \ + return x; \ +} \ + \ +unsigned int fn1##S (unsigned int x) \ +{ \ + struct S y = s##S; \ + y.k += x; \ + y = retme##S (y); \ + return y.k; \ +} \ + \ +unsigned int fn2##S (unsigned int x) \ +{ \ + struct S y = s##S; \ + y.k += x; \ + y.k %= 15; \ + return y.k; \ +} \ + \ +unsigned int retit##S (void) \ +{ \ + return s##S.k; \ +} \ + \ +unsigned int fn3##S (unsigned int x) \ +{ \ + s##S.k += x; \ + return retit##S (); \ +} \ + \ +void test##S (void) \ +{ \ + int i; \ + unsigned int mask, v, a, r; \ + struct S x; \ + char *p = (char *) &s##S; \ + for (i = 0; i < sizeof (s##S); ++i) \ + *p++ = myrnd (); \ + if (__builtin_classify_type (s##S.l) == 8) \ + s##S.l = 5.25; \ + s##S.k = -1; \ + mask = s##S.k; \ + v = myrnd (); \ + a = myrnd (); \ + s##S.k = v; \ + x = s##S; \ + r = fn1##S (a); \ + if (x.i != s##S.i || x.j != s##S.j \ + || x.k != s##S.k || x.l != s##S.l \ + || ((v + a) & mask) != r) \ + abort (); \ + v = myrnd (); \ + a = myrnd (); \ + s##S.k = v; \ + x = s##S; \ + r = fn2##S (a); \ + if (x.i != s##S.i || x.j != s##S.j \ + || x.k != s##S.k || x.l != s##S.l \ + || ((((v + a) & mask) % 15) & mask) != r) \ + abort (); \ + v = myrnd (); \ + a = myrnd (); \ + s##S.k = v; \ + x = s##S; \ + r = fn3##S (a); \ + if (x.i != s##S.i || x.j != s##S.j \ + || s##S.k != r || x.l != s##S.l \ + || ((v + a) & mask) != r) \ + abort (); \ +} + +struct A { unsigned int i : 6, l : 1, j : 10, k : 15; }; T(A) +struct B { unsigned int i : 6, j : 11, k : 15; unsigned int l; }; T(B) +struct C { unsigned int l; unsigned int i : 6, j : 11, k : 15; }; T(C) +struct D { unsigned long long l : 6, i : 6, j : 23, k : 29; }; T(D) +struct E { unsigned long long l, i : 12, j : 23, k : 29; }; T(E) +struct F { unsigned long long i : 12, j : 23, k : 29, l; }; T(F) +struct G { unsigned int i : 12, j : 13, k : 7; unsigned long long l; }; T(G) +struct H { unsigned int i : 12, j : 11, k : 9; unsigned long long l; }; T(H) +struct I { unsigned short i : 1, j : 6, k : 9; unsigned long long l; }; T(I) +struct J { unsigned short i : 1, j : 8, k : 7; unsigned short l; }; T(J) +struct K { unsigned int k : 6, l : 1, j : 10, i : 15; }; T(K) +struct L { unsigned int k : 6, j : 11, i : 15; unsigned int l; }; T(L) +struct M { unsigned int l; unsigned int k : 6, j : 11, i : 15; }; T(M) +struct N { unsigned long long l : 6, k : 6, j : 23, i : 29; }; T(N) +struct O { unsigned long long l, k : 12, j : 23, i : 29; }; T(O) +struct P { unsigned long long k : 12, j : 23, i : 29, l; }; T(P) +struct Q { unsigned int k : 12, j : 13, i : 7; unsigned long long l; }; T(Q) +struct R { unsigned int k : 12, j : 11, i : 9; unsigned long long l; }; T(R) +struct S { unsigned short k : 1, j : 6, i : 9; unsigned long long l; }; T(S) +struct T { unsigned short k : 1, j : 8, i : 7; unsigned short l; }; T(T) +struct U { unsigned short j : 6, k : 1, i : 9; unsigned long long l; }; T(U) +struct V { unsigned short j : 8, k : 1, i : 7; unsigned short l; }; T(V) +struct W { long double l; unsigned int k : 12, j : 13, i : 7; }; T(W) +struct X { unsigned int k : 12, j : 13, i : 7; long double l; }; T(X) +struct Y { unsigned int k : 12, j : 11, i : 9; long double l; }; T(Y) +struct Z { long double l; unsigned int j : 13, i : 7, k : 12; }; T(Z) + +int +main (void) +{ + testA (); + testB (); + testC (); + testD (); + testE (); + testF (); + testG (); + testH (); + testI (); + testJ (); + testK (); + testL (); + testM (); + testN (); + testO (); + testP (); + testQ (); + testR (); + testS (); + testT (); + testU (); + testV (); + testW (); + testX (); + testY (); + testZ (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20040709-1.x b/gcc/testsuite/gcc.c-torture/execute/20040709-1.x new file mode 100644 index 000000000..121fcfecc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040709-1.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_int16] } { + return 1 +} + +return 0; diff --git a/gcc/testsuite/gcc.c-torture/execute/20040709-2.c b/gcc/testsuite/gcc.c-torture/execute/20040709-2.c new file mode 100644 index 000000000..6ae1f2dad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040709-2.c @@ -0,0 +1,148 @@ +/* Test arithmetics on bitfields. */ + +extern void abort (void); +extern void exit (int); + +unsigned int +myrnd (void) +{ + static unsigned int s = 1388815473; + s *= 1103515245; + s += 12345; + return (s / 65536) % 2048; +} + +#define T(S) \ +struct S s##S; \ +struct S retme##S (struct S x) \ +{ \ + return x; \ +} \ + \ +unsigned int fn1##S (unsigned int x) \ +{ \ + struct S y = s##S; \ + y.k += x; \ + y = retme##S (y); \ + return y.k; \ +} \ + \ +unsigned int fn2##S (unsigned int x) \ +{ \ + struct S y = s##S; \ + y.k += x; \ + y.k %= 15; \ + return y.k; \ +} \ + \ +unsigned int retit##S (void) \ +{ \ + return s##S.k; \ +} \ + \ +unsigned int fn3##S (unsigned int x) \ +{ \ + s##S.k += x; \ + return retit##S (); \ +} \ + \ +void test##S (void) \ +{ \ + int i; \ + unsigned int mask, v, a, r; \ + struct S x; \ + char *p = (char *) &s##S; \ + for (i = 0; i < sizeof (s##S); ++i) \ + *p++ = myrnd (); \ + if (__builtin_classify_type (s##S.l) == 8) \ + s##S.l = 5.25; \ + s##S.k = -1; \ + mask = s##S.k; \ + v = myrnd (); \ + a = myrnd (); \ + s##S.k = v; \ + x = s##S; \ + r = fn1##S (a); \ + if (x.i != s##S.i || x.j != s##S.j \ + || x.k != s##S.k || x.l != s##S.l \ + || ((v + a) & mask) != r) \ + abort (); \ + v = myrnd (); \ + a = myrnd (); \ + s##S.k = v; \ + x = s##S; \ + r = fn2##S (a); \ + if (x.i != s##S.i || x.j != s##S.j \ + || x.k != s##S.k || x.l != s##S.l \ + || ((((v + a) & mask) % 15) & mask) != r) \ + abort (); \ + v = myrnd (); \ + a = myrnd (); \ + s##S.k = v; \ + x = s##S; \ + r = fn3##S (a); \ + if (x.i != s##S.i || x.j != s##S.j \ + || s##S.k != r || x.l != s##S.l \ + || ((v + a) & mask) != r) \ + abort (); \ +} + +#define pck __attribute__((packed)) +struct pck A { unsigned short i : 1, l : 1, j : 3, k : 11; }; T(A) +struct pck B { unsigned short i : 4, j : 1, k : 11; unsigned int l; }; T(B) +struct pck C { unsigned int l; unsigned short i : 4, j : 1, k : 11; }; T(C) +struct pck D { unsigned long long l : 6, i : 6, j : 23, k : 29; }; T(D) +struct pck E { unsigned long long l, i : 12, j : 23, k : 29; }; T(E) +struct pck F { unsigned long long i : 12, j : 23, k : 29, l; }; T(F) +struct pck G { unsigned short i : 1, j : 1, k : 6; unsigned long long l; }; T(G) +struct pck H { unsigned short i : 6, j : 2, k : 8; unsigned long long l; }; T(H) +struct pck I { unsigned short i : 1, j : 6, k : 1; unsigned long long l; }; T(I) +struct pck J { unsigned short i : 1, j : 8, k : 7; unsigned short l; }; T(J) +struct pck K { unsigned int k : 6, l : 1, j : 10, i : 15; }; T(K) +struct pck L { unsigned int k : 6, j : 11, i : 15; unsigned int l; }; T(L) +struct pck M { unsigned int l; unsigned short k : 6, j : 11, i : 15; }; T(M) +struct pck N { unsigned long long l : 6, k : 6, j : 23, i : 29; }; T(N) +struct pck O { unsigned long long l, k : 12, j : 23, i : 29; }; T(O) +struct pck P { unsigned long long k : 12, j : 23, i : 29, l; }; T(P) +struct pck Q { unsigned short k : 12, j : 1, i : 3; unsigned long long l; }; T(Q) +struct pck R { unsigned short k : 2, j : 11, i : 3; unsigned long long l; }; T(R) +struct pck S { unsigned short k : 1, j : 6, i : 9; unsigned long long l; }; T(S) +struct pck T { unsigned short k : 1, j : 8, i : 7; unsigned short l; }; T(T) +struct pck U { unsigned short j : 6, k : 1, i : 9; unsigned long long l; }; T(U) +struct pck V { unsigned short j : 8, k : 1, i : 7; unsigned short l; }; T(V) +struct pck W { long double l; unsigned int k : 12, j : 13, i : 7; }; T(W) +struct pck X { unsigned int k : 12, j : 13, i : 7; long double l; }; T(X) +struct pck Y { unsigned int k : 12, j : 11, i : 9; long double l; }; T(Y) +struct pck Z { long double l; unsigned int j : 13, i : 7, k : 12; }; T(Z) + +int +main (void) +{ + testA (); + testB (); + testC (); + testD (); + testE (); + testF (); + testG (); + testH (); + testI (); + testJ (); + testK (); + testL (); + testM (); + testN (); + testO (); + testP (); + testQ (); + testR (); + testS (); + testT (); + testU (); + testV (); + testW (); + testX (); + testY (); + testZ (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20040709-2.x b/gcc/testsuite/gcc.c-torture/execute/20040709-2.x new file mode 100644 index 000000000..121fcfecc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040709-2.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_int16] } { + return 1 +} + +return 0; diff --git a/gcc/testsuite/gcc.c-torture/execute/20040805-1.c b/gcc/testsuite/gcc.c-torture/execute/20040805-1.c new file mode 100644 index 000000000..f09fc49a2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040805-1.c @@ -0,0 +1,31 @@ +#if __INT_MAX__ < 32768 || (defined(STACK_SIZE) && STACK_SIZE < 0x12000) +int main () { exit (0); } +#else +int a[2] = { 2, 3 }; + +static int __attribute__((noinline)) +bar (int x, void *b) +{ + a[0]++; + return x; +} + +static int __attribute__((noinline)) +foo (int x) +{ + char buf[0x10000]; + int y = a[0]; + a[1] = y; + x = bar (x, buf); + y = bar (y, buf); + return x + y; +} + +int +main () +{ + if (foo (100) != 102) + abort (); + exit (0); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/20040811-1.c b/gcc/testsuite/gcc.c-torture/execute/20040811-1.c new file mode 100644 index 000000000..62f377a2f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040811-1.c @@ -0,0 +1,19 @@ +/* Ensure that we deallocate X when branching back before its + declaration. */ + +void *volatile p; + +int +main (void) +{ + int n = 0; + lab:; + int x[n % 1000 + 1]; + x[0] = 1; + x[n % 1000] = 2; + p = x; + n++; + if (n < 1000000) + goto lab; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20040811-1.x b/gcc/testsuite/gcc.c-torture/execute/20040811-1.x new file mode 100644 index 000000000..121fcfecc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040811-1.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_int16] } { + return 1 +} + +return 0; diff --git a/gcc/testsuite/gcc.c-torture/execute/20040820-1.c b/gcc/testsuite/gcc.c-torture/execute/20040820-1.c new file mode 100644 index 000000000..366607c82 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040820-1.c @@ -0,0 +1,24 @@ +/* PR rtl-optimization/17099 */ + +extern void exit (int); +extern void abort (void); + +void +check (int a) +{ + if (a != 1) + abort (); +} + +void +test (int a, int b) +{ + check ((a ? 1 : 0) | (b ? 2 : 0)); +} + +int +main (void) +{ + test (1, 0); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20040823-1.c b/gcc/testsuite/gcc.c-torture/execute/20040823-1.c new file mode 100644 index 000000000..83bf4027a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040823-1.c @@ -0,0 +1,29 @@ +/* Ensure that we create VUSE operands also for noreturn functions. */ + +#include +#include + +int *pwarn; + +void bla (void) __attribute__ ((noreturn)); + +void bla (void) +{ + if (!*pwarn) + abort (); + + exit (0); +} + +int main (void) +{ + int warn; + + memset (&warn, 0, sizeof (warn)); + + pwarn = &warn; + + warn = 1; + + bla (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20040831-1.c b/gcc/testsuite/gcc.c-torture/execute/20040831-1.c new file mode 100644 index 000000000..39773b34b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040831-1.c @@ -0,0 +1,14 @@ +/* This testcase was being miscompiled, because operand_equal_p + returned that (unsigned long) d and (long) d are equal. */ +extern void abort (void); +extern void exit (int); + +int +main (void) +{ + double d = -12.0; + long l = (d > 10000) ? (unsigned long) d : (long) d; + if (l != -12) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20040917-1.c b/gcc/testsuite/gcc.c-torture/execute/20040917-1.c new file mode 100644 index 000000000..73bc6c647 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040917-1.c @@ -0,0 +1,32 @@ +/* submitted by kenneth zadeck */ + +static int test_var; + +/* the idea here is that not only is inlinable, inlinable but since it + is static, the cgraph node will not be marked as output. The + current version of the code ignores these cgraph nodes. */ + +void not_inlinable() __attribute__((noinline)); + +static void +inlinable () +{ + test_var = -10; +} + +void +not_inlinable () +{ + inlinable(); +} + +main () +{ + test_var = 10; + /* Variable test_var should be considered call-clobbered by the call + to not_inlinable(). */ + not_inlinable (); + if (test_var == 10) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20041011-1.c b/gcc/testsuite/gcc.c-torture/execute/20041011-1.c new file mode 100644 index 000000000..4524de943 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20041011-1.c @@ -0,0 +1,60 @@ +typedef unsigned long long ull; +volatile int gvol[32]; +ull gull; + +#define MULTI(X) \ + X( 1), X( 2), X( 3), X( 4), X( 5), X( 6), X( 7), X( 8), X( 9), X(10), \ + X(11), X(12), X(13), X(14), X(15), X(16), X(17), X(18), X(19), X(20), \ + X(21), X(22), X(23), X(24), X(25), X(26), X(27), X(28), X(29), X(30) + +#define DECLARE(INDEX) x##INDEX +#define COPYIN(INDEX) x##INDEX = gvol[INDEX] +#define COPYOUT(INDEX) gvol[INDEX] = x##INDEX + +#define BUILD_TEST(NAME, N) \ + ull __attribute__((noinline)) \ + NAME (int n, ull x) \ + { \ + while (n--) \ + { \ + int MULTI (DECLARE); \ + MULTI (COPYIN); \ + MULTI (COPYOUT); \ + x += N; \ + } \ + return x; \ + } + +#define RUN_TEST(NAME, N) \ + if (NAME (3, ~0ULL) != N * 3 - 1) \ + abort (); \ + if (NAME (3, 0xffffffffULL) \ + != N * 3 + 0xffffffffULL) \ + abort (); + +#define DO_TESTS(DO_TEST) \ + DO_TEST (t1, -2048) \ + DO_TEST (t2, -513) \ + DO_TEST (t3, -512) \ + DO_TEST (t4, -511) \ + DO_TEST (t5, -1) \ + DO_TEST (t6, 1) \ + DO_TEST (t7, 511) \ + DO_TEST (t8, 512) \ + DO_TEST (t9, 513) \ + DO_TEST (t10, gull) \ + DO_TEST (t11, -gull) + +DO_TESTS (BUILD_TEST) + +ull neg (ull x) { return -x; } + +int +main () +{ + gull = 100; + DO_TESTS (RUN_TEST) + if (neg (gull) != -100ULL) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20041019-1.c b/gcc/testsuite/gcc.c-torture/execute/20041019-1.c new file mode 100644 index 000000000..3c56b31e9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20041019-1.c @@ -0,0 +1,52 @@ +test_store_ccp (int i) +{ + int *p, a, b, c; + + if (i < 5) + p = &a; + else if (i > 8) + p = &b; + else + p = &c; + + *p = 10; + b = 3; + + /* STORE-CCP was wrongfully propagating 10 into *p. */ + return *p + 2; +} + + +test_store_copy_prop (int i) +{ + int *p, a, b, c; + + if (i < 5) + p = &a; + else if (i > 8) + p = &b; + else + p = &c; + + *p = i; + b = i + 1; + + /* STORE-COPY-PROP was wrongfully propagating i into *p. */ + return *p; +} + + +main() +{ + int x; + + x = test_store_ccp (10); + if (x == 12) + abort (); + + x = test_store_copy_prop (9); + if (x == 9) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20041112-1.c b/gcc/testsuite/gcc.c-torture/execute/20041112-1.c new file mode 100644 index 000000000..0c6251ca3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20041112-1.c @@ -0,0 +1,40 @@ +/* This was failing on Alpha because the comparison (p != -1) was rewritten + as (p+1 != 0) and p+1 isn't allowed to wrap for pointers. */ + +extern void abort(void); + +typedef __SIZE_TYPE__ size_t; + +int global; + +static void *foo(int p) +{ + if (p == 0) + { + global++; + return &global; + } + + return (void *)(size_t)-1; +} + +int bar(void) +{ + void *p; + + p = foo(global); + if (p != (void *)(size_t)-1) + return 1; + + global++; + return 0; +} + +int main(void) +{ + global = 1; + if (bar () != 0) + abort(); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20041113-1.c b/gcc/testsuite/gcc.c-torture/execute/20041113-1.c new file mode 100644 index 000000000..8c0795004 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20041113-1.c @@ -0,0 +1,24 @@ +#include + +void test (int x, ...) +{ + va_list ap; + int i; + va_start (ap, x); + if (va_arg (ap, int) != 1) + abort (); + if (va_arg (ap, int) != 2) + abort (); + if (va_arg (ap, int) != 3) + abort (); + if (va_arg (ap, int) != 4) + abort (); +} + +double a = 40.0; + +int main(int argc, char *argv[]) +{ + test(0, 1, 2, 3, (int)(a / 10.0)); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20041114-1.c b/gcc/testsuite/gcc.c-torture/execute/20041114-1.c new file mode 100644 index 000000000..4f82f8aa2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20041114-1.c @@ -0,0 +1,35 @@ +/* Verify that + + var <= 0 || ((long unsigned) (unsigned) (var - 1) < MAX_UNSIGNED_INT) + + gets folded to 1. */ + +#include + +void abort (void); +void link_failure (void); + +volatile int v; + +void +foo (int var) +{ + if (!(var <= 0 + || ((long unsigned) (unsigned) (var - 1) < UINT_MAX))) + link_failure (); +} + +int +main (int argc, char **argv) +{ + foo (v); + return 0; +} + +#ifndef __OPTIMIZE__ +void +link_failure (void) +{ + abort (); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/20041124-1.c b/gcc/testsuite/gcc.c-torture/execute/20041124-1.c new file mode 100644 index 000000000..51ce2536e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20041124-1.c @@ -0,0 +1,10 @@ +struct s { _Complex unsigned short x; }; +struct s gs = { 100 + 200i }; +struct s __attribute__((noinline)) foo (void) { return gs; } + +int main () +{ + if (foo ().x != gs.x) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20041126-1.c b/gcc/testsuite/gcc.c-torture/execute/20041126-1.c new file mode 100644 index 000000000..58855ae8c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20041126-1.c @@ -0,0 +1,26 @@ +extern int abs (int); +extern void abort (void); + +void +check (int *p) +{ + int i; + for (i = 0; i < 5; ++i) + if (p[i]) + abort (); + for (; i < 10; ++i) + if (p[i] != i + 1) + abort (); +} + +int +main (void) +{ + int a[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + int i; + + for (i = -5; i < 0; i++) + a[abs (i - 10) - 11] = 0; + check (a); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20041201-1.c b/gcc/testsuite/gcc.c-torture/execute/20041201-1.c new file mode 100644 index 000000000..ec588b23d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20041201-1.c @@ -0,0 +1,15 @@ +/* PR rtl-opt/15289 */ + +typedef struct { _Complex char a; _Complex char b; } Scc2; + +Scc2 s = { 1+2i, 3+4i }; + +int checkScc2 (Scc2 s) +{ + return s.a != 1+2i || s.b != 3+4i; +} + +int main (void) +{ + return checkScc2 (s); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20041210-1.c b/gcc/testsuite/gcc.c-torture/execute/20041210-1.c new file mode 100644 index 000000000..ef266a0a2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20041210-1.c @@ -0,0 +1,14 @@ +/* The FR-V port used to fail this test because the andcc patterns + wrongly claimed to set the C and V flags. */ +#include + +int x[4] = { INT_MIN / 2, INT_MAX, 2, 4 }; + +int +main () +{ + if (x[0] < x[1]) + if ((x[2] & x[3]) < 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20041212-1.c b/gcc/testsuite/gcc.c-torture/execute/20041212-1.c new file mode 100644 index 000000000..ea2d0fbd7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20041212-1.c @@ -0,0 +1,15 @@ +/* A function pointer compared with a void pointer should not be canonicalized. + See PR middle-end/17564. */ +void *f (void) __attribute__ ((__noinline__)); +void * +f (void) +{ + return f; +} +int +main (void) +{ + if (f () != f) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20041213-2.c b/gcc/testsuite/gcc.c-torture/execute/20041213-2.c new file mode 100644 index 000000000..212d6384b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20041213-2.c @@ -0,0 +1,32 @@ +/* PR tree-optimization/18694 + + The dominator optimization didn't take the PHI evaluation order + into account when threading an edge. */ + +extern void abort (void) __attribute__((noreturn)); +extern void exit (int) __attribute__((noreturn)); + +void __attribute__((noinline)) +foo (int i) +{ + int next_n = 1; + int j = 0; + + for (; i != 0; i--) + { + int n; + + for (n = next_n; j < n; j++) + next_n++; + + if (j != n) + abort (); + } +} + +int +main (void) +{ + foo (2); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20041214-1.c b/gcc/testsuite/gcc.c-torture/execute/20041214-1.c new file mode 100644 index 000000000..89df2be8e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20041214-1.c @@ -0,0 +1,68 @@ +typedef long unsigned int size_t; +extern void abort (void); +extern char *strcpy (char *, const char *); +extern int strcmp (const char *, const char *); +typedef __builtin_va_list va_list; +static const char null[] = "(null)"; +int g (char *s, const char *format, va_list ap) +{ + const char *f; + const char *string; + char spec; + static const void *step0_jumps[] = { + &&do_precision, + &&do_form_integer, + &&do_form_string, + }; + f = format; + if (*f == '\0') + goto all_done; + do + { + spec = (*++f); + goto *(step0_jumps[2]); + + /* begin switch table. */ + do_precision: + ++f; + __builtin_va_arg (ap, int); + spec = *f; + goto *(step0_jumps[2]); + + do_form_integer: + __builtin_va_arg (ap, unsigned long int); + goto end; + + do_form_string: + string = __builtin_va_arg (ap, const char *); + strcpy (s, string); + + /* End of switch table. */ + end: + ++f; + } + while (*f != '\0'); + +all_done: + return 0; +} + +void +f (char *s, const char *f, ...) +{ + va_list ap; + __builtin_va_start (ap, f); + g (s, f, ap); + __builtin_va_end (ap); +} + +int +main (void) +{ + char buf[10]; + f (buf, "%s", "asdf", 0); + if (strcmp (buf, "asdf")) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20041218-1.c b/gcc/testsuite/gcc.c-torture/execute/20041218-1.c new file mode 100644 index 000000000..4d113e455 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20041218-1.c @@ -0,0 +1,117 @@ +/* PR rtl-optimization/16968 */ +/* Testcase by Jakub Jelinek */ + +struct T +{ + unsigned int b, c, *d; + unsigned char e; +}; +struct S +{ + unsigned int a; + struct T f; +}; +struct U +{ + struct S g, h; +}; +struct V +{ + unsigned int i; + struct U j; +}; + +extern void exit (int); +extern void abort (void); + +void * +dummy1 (void *x) +{ + return ""; +} + +void * +dummy2 (void *x, void *y) +{ + exit (0); +} + +struct V * +baz (unsigned int x) +{ + static struct V v; + __builtin_memset (&v, 0x55, sizeof (v)); + return &v; +} + +int +check (void *x, struct S *y) +{ + if (y->a || y->f.b || y->f.c || y->f.d || y->f.e) + abort (); + return 1; +} + +static struct V * +bar (unsigned int x, void *y) +{ + const struct T t = { 0, 0, (void *) 0, 0 }; + struct V *u; + void *v; + v = dummy1 (y); + if (!v) + return (void *) 0; + + u = baz (sizeof (struct V)); + u->i = x; + u->j.g.a = 0; + u->j.g.f = t; + u->j.h.a = 0; + u->j.h.f = t; + + if (!check (v, &u->j.g) || !check (v, &u->j.h)) + return (void *) 0; + return u; +} + +int +foo (unsigned int *x, unsigned int y, void **z) +{ + void *v; + unsigned int i, j; + + *z = v = (void *) 0; + + for (i = 0; i < y; i++) + { + struct V *c; + + j = *x; + + switch (j) + { + case 1: + c = bar (j, x); + break; + default: + c = 0; + break; + } + if (c) + v = dummy2 (v, c); + else + return 1; + } + + *z = v; + return 0; +} + +int +main (void) +{ + unsigned int one = 1; + void *p; + foo (&one, 1, &p); + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20041218-2.c b/gcc/testsuite/gcc.c-torture/execute/20041218-2.c new file mode 100644 index 000000000..d44b54db9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20041218-2.c @@ -0,0 +1,15 @@ +extern void abort (void); + +int test(int n) +{ + struct s { char b[n]; } __attribute__((packed)); + n++; + return sizeof(struct s); +} + +int main() +{ + if (test(123) != 123) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050104-1.c b/gcc/testsuite/gcc.c-torture/execute/20050104-1.c new file mode 100644 index 000000000..6083e9c06 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050104-1.c @@ -0,0 +1,23 @@ +/* PR tree-optimization/19060 */ + +void abort (void); + +static +long long min () +{ + return -__LONG_LONG_MAX__ - 1; +} + +void +foo (long long j) +{ + if (j > 10 || j < min ()) + abort (); +} + +int +main (void) +{ + foo (10); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050106-1.c b/gcc/testsuite/gcc.c-torture/execute/20050106-1.c new file mode 100644 index 000000000..e49732de4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050106-1.c @@ -0,0 +1,19 @@ +/* PR tree-optimization/19283 */ + +void abort (void); + +static inline unsigned short +foo (unsigned int *p) +{ + return *p; +}; + +unsigned int u; + +int +main () +{ + if ((foo (&u) & 0x8000) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050107-1.c b/gcc/testsuite/gcc.c-torture/execute/20050107-1.c new file mode 100644 index 000000000..903c54a25 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050107-1.c @@ -0,0 +1,25 @@ +typedef enum { C = 1, D = 2 } B; +extern void abort (void); + +struct S +{ + B __attribute__ ((mode (byte))) a; + B __attribute__ ((mode (byte))) b; +}; + +void +foo (struct S *x) +{ + if (x->a != C || x->b != D) + abort (); +} + +int +main (void) +{ + struct S s; + s.a = C; + s.b = D; + foo (&s); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050111-1.c b/gcc/testsuite/gcc.c-torture/execute/20050111-1.c new file mode 100644 index 000000000..d6089f1bd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050111-1.c @@ -0,0 +1,39 @@ +/* PR middle-end/19084, rtl-optimization/19348 */ + +unsigned int +foo (unsigned long long x) +{ + unsigned int u; + + if (x == 0) + return 0; + u = (unsigned int) (x >> 32); + return u; +} + +unsigned long long +bar (unsigned short x) +{ + return (unsigned long long) x << 32; +} + +extern void abort (void); + +int +main (void) +{ + if (sizeof (long long) != 8) + return 0; + + if (foo (0) != 0) + abort (); + if (foo (0xffffffffULL) != 0) + abort (); + if (foo (0x25ff00ff00ULL) != 0x25) + abort (); + if (bar (0) != 0) + abort (); + if (bar (0x25) != 0x2500000000ULL) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050119-1.c b/gcc/testsuite/gcc.c-torture/execute/20050119-1.c new file mode 100644 index 000000000..55f33a065 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050119-1.c @@ -0,0 +1,37 @@ +/* PR c/19342 */ +typedef enum { A, B, C, D } E; + +struct S { + E __attribute__ ((mode (__byte__))) a; + E __attribute__ ((mode (__byte__))) b; + E __attribute__ ((mode (__byte__))) c; + E __attribute__ ((mode (__byte__))) d; +}; + +extern void abort (void); +extern void exit (int); + +void +foo (struct S *s) +{ + if (s->a != s->b) + abort (); + if (s->c != C) + abort (); +} + +int +main (void) +{ + struct S s[2]; + s[0].a = B; + s[0].b = B; + s[0].c = C; + s[0].d = D; + s[1].a = D; + s[1].b = C; + s[1].c = B; + s[1].d = A; + foo (s); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050119-2.c b/gcc/testsuite/gcc.c-torture/execute/20050119-2.c new file mode 100644 index 000000000..568109cb2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050119-2.c @@ -0,0 +1,40 @@ +/* PR middle-end/19874 */ +typedef enum { A, B, C, D } E; + +struct S { + E __attribute__ ((mode (__byte__))) a; + E __attribute__ ((mode (__byte__))) b; + E __attribute__ ((mode (__byte__))) c; + E __attribute__ ((mode (__byte__))) d; +}; + +extern void abort (void); +extern void exit (int); + +E +foo (struct S *s) +{ + if (s->a != s->b) + abort (); + if (s->c != C) + abort (); + return s->d; +} + +int +main (void) +{ + struct S s[2]; + s[0].a = B; + s[0].b = B; + s[0].c = C; + s[0].d = D; + s[1].a = D; + s[1].b = C; + s[1].c = B; + s[1].d = A; + if (foo (s) != D) + abort (); + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20050121-1.c b/gcc/testsuite/gcc.c-torture/execute/20050121-1.c new file mode 100644 index 000000000..9d5dec416 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050121-1.c @@ -0,0 +1,63 @@ +/* PR middle-end/19551 */ + +extern void abort (); + +#define T(type, name) \ +__attribute__((pure)) _Complex type \ +foo_##name (int x) \ +{ \ + _Complex type r; \ + __real r = x + 1; \ + __imag r = x - 1; \ + return r; \ +} \ + \ +void \ +bar_##name (type *x) \ +{ \ + *x = __real foo_##name (5); \ +} \ + \ +void \ +baz_##name (type *x) \ +{ \ + *x = __imag foo_##name (5); \ +} + +typedef long double ldouble_t; +typedef long long llong; + +T (float, float) +T (double, double) +T (long double, ldouble_t) +T (char, char) +T (short, short) +T (int, int) +T (long, long) +T (long long, llong) +#undef T + +int +main (void) +{ +#define T(type, name) \ + { \ + type var = 0; \ + bar_##name (&var); \ + if (var != 6) \ + abort (); \ + var = 0; \ + baz_##name (&var); \ + if (var != 4) \ + abort (); \ + } + T (float, float) + T (double, double) + T (long double, ldouble_t) + T (char, char) + T (short, short) + T (int, int) + T (long, long) + T (long long, llong) + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050124-1.c b/gcc/testsuite/gcc.c-torture/execute/20050124-1.c new file mode 100644 index 000000000..9d039ef66 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050124-1.c @@ -0,0 +1,41 @@ +/* PR rtl-optimization/19579 */ + +extern void abort (void); + +int +foo (int i, int j) +{ + int k = i + 1; + + if (j) + { + if (k > 0) + k++; + else if (k < 0) + k--; + } + + return k; +} + +int +main (void) +{ + if (foo (-2, 0) != -1) + abort (); + if (foo (-1, 0) != 0) + abort (); + if (foo (0, 0) != 1) + abort (); + if (foo (1, 0) != 2) + abort (); + if (foo (-2, 1) != -2) + abort (); + if (foo (-1, 1) != 0) + abort (); + if (foo (0, 1) != 2) + abort (); + if (foo (1, 1) != 3) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050125-1.c b/gcc/testsuite/gcc.c-torture/execute/20050125-1.c new file mode 100644 index 000000000..3dc15b537 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050125-1.c @@ -0,0 +1,35 @@ +/* Verify that the CALL sideeffect isn't optimized away. */ +/* Contributed by Greg Parker 25 Jan 2005 */ + +#include +#include + +struct parse { + char *next; + char *end; + int error; +}; + +int seterr(struct parse *p, int err) +{ + p->error = err; + return 0; +} + +void bracket_empty(struct parse *p) +{ + if (((p->next < p->end) && (*p->next++) == ']') || seterr(p, 7)) { } +} + +int main(int argc __attribute__((unused)), char **argv __attribute__((unused))) +{ + struct parse p; + p.next = p.end = (char *)0x12345; + + p.error = 0; + bracket_empty(&p); + if (p.error != 7) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050131-1.c b/gcc/testsuite/gcc.c-torture/execute/20050131-1.c new file mode 100644 index 000000000..9fae91181 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050131-1.c @@ -0,0 +1,18 @@ +/* Verify that we do not lose side effects on a MOD expression. */ + +#include +#include + +int +foo (int a) +{ + int x = 0 % a++; + return a; +} + +main() +{ + if (foo (9) != 10) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050203-1.c b/gcc/testsuite/gcc.c-torture/execute/20050203-1.c new file mode 100644 index 000000000..0b3827794 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050203-1.c @@ -0,0 +1,29 @@ +/* Reduced testcase extracted from Samba source code. */ + +#include + +static void __attribute__((__noinline__)) + foo (unsigned char *p) { + *p = 0x81; +} + +static void __attribute__((__noinline__)) + bar (int x) { + asm (""); +} + +int main() { + unsigned char b; + + foo(&b); + if (b & 0x80) + { + bar (b & 0x7f); + exit (0); + } + else + { + bar (b & 1); + abort (); + } +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050215-1.c b/gcc/testsuite/gcc.c-torture/execute/20050215-1.c new file mode 100644 index 000000000..f4920ce5f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050215-1.c @@ -0,0 +1,25 @@ +/* PR middle-end/19857 */ + +typedef struct { char c[8]; } V +#ifdef __ELF__ + __attribute__ ((aligned (8))) +#endif + ; +typedef __SIZE_TYPE__ size_t; +V v; +void abort (void); + +int +main (void) +{ + V *w = &v; + if (((size_t) ((float *) ((size_t) w & ~(size_t) 3)) % 8) != 0 + || ((size_t) w & 1)) + { +#ifndef __ELF__ + if (((size_t) &v & 7) == 0) +#endif + abort (); + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050218-1.c b/gcc/testsuite/gcc.c-torture/execute/20050218-1.c new file mode 100644 index 000000000..104174f92 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050218-1.c @@ -0,0 +1,30 @@ +/* PR tree-optimization/19828 */ +typedef __SIZE_TYPE__ size_t; +extern size_t strlen (const char *s); +extern int strncmp (const char *s1, const char *s2, size_t n); +extern void abort (void); + +const char *a[16] = { "a", "bc", "de", "fgh" }; + +int +foo (char *x, const char *y, size_t n) +{ + size_t i, j = 0; + for (i = 0; i < n; i++) + { + if (strncmp (x + j, a[i], strlen (a[i])) != 0) + return 2; + j += strlen (a[i]); + if (y) + j += strlen (y); + } + return 0; +} + +int +main (void) +{ + if (foo ("abcde", (const char *) 0, 3) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050224-1.c b/gcc/testsuite/gcc.c-torture/execute/20050224-1.c new file mode 100644 index 000000000..681200364 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050224-1.c @@ -0,0 +1,33 @@ +/* Origin: Mikael Pettersson and the Linux kernel. */ + +extern void abort (void); +unsigned long a = 0xc0000000, b = 0xd0000000; +unsigned long c = 0xc01bb958, d = 0xc0264000; +unsigned long e = 0xc0288000, f = 0xc02d4378; + +void +foo (int x, int y, int z) +{ + if (x != 245 || y != 36 || z != 444) + abort (); +} + +int +main (void) +{ + unsigned long g; + int h = 0, i = 0, j = 0; + + if (sizeof (unsigned long) < 4) + return 0; + + for (g = a; g < b; g += 0x1000) + if (g < c) + h++; + else if (g >= d && g < e) + j++; + else if (g < f) + i++; + foo (i, j, h); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050316-1.c b/gcc/testsuite/gcc.c-torture/execute/20050316-1.c new file mode 100644 index 000000000..2a1c6254d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050316-1.c @@ -0,0 +1,69 @@ +/* PR rtl-optimization/16104 */ + +extern void abort (void); + +typedef int V2SI __attribute__ ((vector_size (8))); +typedef unsigned int V2USI __attribute__ ((vector_size (8))); +typedef short V2HI __attribute__ ((vector_size (4))); +typedef unsigned int V2UHI __attribute__ ((vector_size (4))); + +int +test1 (void) +{ + return (long long) (V2SI) 0LL; +} + +int +test2 (V2SI x) +{ + return (long long) x; +} + +V2SI +test3 (void) +{ + return (V2SI) (long long) (int) (V2HI) 0; +} + +V2SI +test4 (V2HI x) +{ + return (V2SI) (long long) (int) x; +} + +V2SI +test5 (V2USI x) +{ + return (V2SI) x; +} + +int +main (void) +{ + if (sizeof (short) != 2 || sizeof (int) != 4 || sizeof (long long) != 8) + return 0; + + if (test1 () != 0) + abort (); + + V2SI x = { 2, 2 }; + if (test2 (x) != 2) + abort (); + + union { V2SI x; int y[2]; V2USI z; long long l; } u; + u.x = test3 (); + if (u.y[0] != 0 || u.y[1] != 0) + abort (); + + V2HI y = { 4, 4 }; + union { V2SI x; long long y; } v; + v.x = test4 (y); + if (v.y != 0x40004) + abort (); + + V2USI z = { 6, 6 }; + u.x = test5 (z); + if (u.y[0] != 6 || u.y[1] != 6) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050316-1.x b/gcc/testsuite/gcc.c-torture/execute/20050316-1.x new file mode 100644 index 000000000..121fcfecc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050316-1.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_int16] } { + return 1 +} + +return 0; diff --git a/gcc/testsuite/gcc.c-torture/execute/20050316-2.c b/gcc/testsuite/gcc.c-torture/execute/20050316-2.c new file mode 100644 index 000000000..c6487774d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050316-2.c @@ -0,0 +1,49 @@ +extern void abort (void); + +typedef int V2SI __attribute__ ((vector_size (8))); +typedef unsigned int V2USI __attribute__ ((vector_size (8))); +typedef float V2SF __attribute__ ((vector_size (8))); +typedef short V2HI __attribute__ ((vector_size (4))); +typedef unsigned int V2UHI __attribute__ ((vector_size (4))); + +long long +test1 (V2SF x) +{ + return (long long) (V2SI) x; +} + +long long +test2 (V2SF x) +{ + return (long long) x; +} + +long long +test3 (V2SI x) +{ + return (long long) (V2SF) x; +} + +int +main (void) +{ + if (sizeof (short) != 2 || sizeof (int) != 4 || sizeof (long long) != 8) + return 0; + + V2SF x = { 2.0, 2.0 }; + union { long long l; float f[2]; int i[2]; } u; + u.l = test1 (x); + if (u.f[0] != 2.0 || u.f[1] != 2.0) + abort (); + + V2SF y = { 6.0, 6.0 }; + u.l = test2 (y); + if (u.f[0] != 6.0 || u.f[1] != 6.0) + abort (); + + V2SI z = { 4, 4 }; + u.l = test3 (z); + if (u.i[0] != 4 || u.i[1] != 4) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050316-2.x b/gcc/testsuite/gcc.c-torture/execute/20050316-2.x new file mode 100644 index 000000000..f5b4aaae3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050316-2.x @@ -0,0 +1,9 @@ +# This testcase generates MMX instructions together with x87 instructions. +# Currently, there is no "emms" generated to switch between register sets, +# so the testcase fails for targets where MMX insns are enabled. + +if { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } { + set additional_flags "-mno-mmx" +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/20050316-3.c b/gcc/testsuite/gcc.c-torture/execute/20050316-3.c new file mode 100644 index 000000000..773243f22 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050316-3.c @@ -0,0 +1,36 @@ +extern void abort (void); + +typedef int V2SI __attribute__ ((vector_size (8))); +typedef unsigned int V2USI __attribute__ ((vector_size (8))); +typedef short V2HI __attribute__ ((vector_size (4))); +typedef unsigned int V2UHI __attribute__ ((vector_size (4))); + +V2USI +test1 (V2SI x) +{ + return (V2USI) (V2SI) (long long) x; +} + +long long +test2 (V2SI x) +{ + return (long long) (V2USI) (V2SI) (long long) x; +} + +int +main (void) +{ + if (sizeof (short) != 2 || sizeof (int) != 4 || sizeof (long long) != 8) + return 0; + + union { V2SI x; int y[2]; V2USI z; long long l; } u; + V2SI a = { -3, -3 }; + u.z = test1 (a); + if (u.y[0] != -3 || u.y[1] != -3) + abort (); + + u.l = test2 (a); + if (u.y[0] != -3 || u.y[1] != -3) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050410-1.c b/gcc/testsuite/gcc.c-torture/execute/20050410-1.c new file mode 100644 index 000000000..c4cd85279 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050410-1.c @@ -0,0 +1,13 @@ +int s = 200; +int __attribute__((noinline)) +foo (void) +{ + return (signed char) (s - 100) - 5; +} +int +main (void) +{ + if (foo () != 95) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050502-1.c b/gcc/testsuite/gcc.c-torture/execute/20050502-1.c new file mode 100644 index 000000000..331fe5ff7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050502-1.c @@ -0,0 +1,67 @@ +/* PR rtl-optimization/21330 */ + +extern void abort (void); +extern int strcmp (const char *, const char *); + +int +__attribute__((noinline)) +bar (const char **x) +{ + return *(*x)++; +} + +int +__attribute__((noinline)) +baz (int c) +{ + return c != '@'; +} + +void +__attribute__((noinline)) +foo (const char **w, char *x, _Bool y, _Bool z) +{ + char c = bar (w); + int i = 0; + + while (1) + { + x[i++] = c; + c = bar (w); + if (y && c == '\'') + break; + if (z && c == '\"') + break; + if (!y && !z && !baz (c)) + break; + } + x[i] = 0; +} + +int +main (void) +{ + char buf[64]; + const char *p; + p = "abcde'fgh"; + foo (&p, buf, 1, 0); + if (strcmp (p, "fgh") != 0 || strcmp (buf, "abcde") != 0) + abort (); + p = "ABCDEFG\"HI"; + foo (&p, buf, 0, 1); + if (strcmp (p, "HI") != 0 || strcmp (buf, "ABCDEFG") != 0) + abort (); + p = "abcd\"e'fgh"; + foo (&p, buf, 1, 1); + if (strcmp (p, "e'fgh") != 0 || strcmp (buf, "abcd") != 0) + abort (); + p = "ABCDEF'G\"HI"; + foo (&p, buf, 1, 1); + if (strcmp (p, "G\"HI") != 0 || strcmp (buf, "ABCDEF") != 0) + abort (); + p = "abcdef@gh"; + foo (&p, buf, 0, 0); + if (strcmp (p, "gh") != 0 || strcmp (buf, "abcdef") != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050502-2.c b/gcc/testsuite/gcc.c-torture/execute/20050502-2.c new file mode 100644 index 000000000..eedcb6a31 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050502-2.c @@ -0,0 +1,34 @@ +/* PR target/21297 */ +typedef __SIZE_TYPE__ size_t; +extern int memcmp (const char *, const char *, size_t); +extern void abort (); + +void +foo (char *x) +{ + int i; + for (i = 0; i < 2; i++); + x[i + i] = '\0'; +} + +void +bar (char *x) +{ + int i; + for (i = 0; i < 2; i++); + x[i + i + i + i] = '\0'; +} + +int +main (void) +{ + char x[] = "IJKLMNOPQR"; + foo (x); + if (memcmp (x, "IJKL\0NOPQR", sizeof x) != 0) + abort (); + x[4] = 'M'; + bar (x); + if (memcmp (x, "IJKLMNOP\0R", sizeof x) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050604-1.c b/gcc/testsuite/gcc.c-torture/execute/20050604-1.c new file mode 100644 index 000000000..70097aa14 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050604-1.c @@ -0,0 +1,39 @@ +/* PR regression/21897 */ + +extern void abort (void); + +typedef short v4hi __attribute__ ((vector_size (8))); +typedef float v4sf __attribute__ ((vector_size (16))); + +union +{ + v4hi v; + short s[4]; +} u; + +union +{ + v4sf v; + float f[4]; +} v; + +void +foo (void) +{ + unsigned int i; + for (i = 0; i < 2; i++) + u.v += (v4hi) { 12, 14 }; + for (i = 0; i < 2; i++) + v.v += (v4sf) { 18.0, 20.0, 22 }; +} + +int +main (void) +{ + foo (); + if (u.s[0] != 24 || u.s[1] != 28 || u.s[2] || u.s[3]) + abort (); + if (v.f[0] != 36.0 || v.f[1] != 40.0 || v.f[2] != 44.0 || v.f[3] != 0.0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050604-1.x b/gcc/testsuite/gcc.c-torture/execute/20050604-1.x new file mode 100644 index 000000000..f5b4aaae3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050604-1.x @@ -0,0 +1,9 @@ +# This testcase generates MMX instructions together with x87 instructions. +# Currently, there is no "emms" generated to switch between register sets, +# so the testcase fails for targets where MMX insns are enabled. + +if { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } { + set additional_flags "-mno-mmx" +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/20050607-1.c b/gcc/testsuite/gcc.c-torture/execute/20050607-1.c new file mode 100644 index 000000000..41579bbba --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050607-1.c @@ -0,0 +1,16 @@ +/* PR middle-end/21850 */ + +extern void abort (void); + +typedef int V2SI __attribute__ ((vector_size (8))); + +int +main (void) +{ +#if (__INT_MAX__ == 2147483647) \ + && (__LONG_LONG_MAX__ == 9223372036854775807LL) + if (((int)(long long)(V2SI){ 2, 2 }) != 2) + abort (); +#endif + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050613-1.c b/gcc/testsuite/gcc.c-torture/execute/20050613-1.c new file mode 100644 index 000000000..f1b4e94c3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050613-1.c @@ -0,0 +1,27 @@ +/* PR tree-optimization/22043 */ + +extern void abort (void); + +struct A { int i; int j; int k; int l; }; +struct B { struct A a; int r[1]; }; +struct C { struct A a; int r[0]; }; +struct D { struct A a; int r[]; }; + +void +foo (struct A *x) +{ + if (x->i != 0 || x->j != 5 || x->k != 0 || x->l != 0) + abort (); +} + +int +main () +{ + struct B b = { .a.j = 5 }; + struct C c = { .a.j = 5 }; + struct D d = { .a.j = 5 }; + foo (&b.a); + foo (&c.a); + foo (&d.a); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050713-1.c b/gcc/testsuite/gcc.c-torture/execute/20050713-1.c new file mode 100644 index 000000000..4d669cb8e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050713-1.c @@ -0,0 +1,56 @@ +/* Test that sibling call is not used if there is an argument overlap. */ + +extern void abort (void); + +struct S +{ + int a, b, c; +}; + +int +foo2 (struct S x, struct S y) +{ + if (x.a != 3 || x.b != 4 || x.c != 5) + abort (); + if (y.a != 6 || y.b != 7 || y.c != 8) + abort (); + return 0; +} + +int +foo3 (struct S x, struct S y, struct S z) +{ + foo2 (x, y); + if (z.a != 9 || z.b != 10 || z.c != 11) + abort (); + return 0; +} + +int +bar2 (struct S x, struct S y) +{ + return foo2 (y, x); +} + +int +bar3 (struct S x, struct S y, struct S z) +{ + return foo3 (y, x, z); +} + +int +baz3 (struct S x, struct S y, struct S z) +{ + return foo3 (y, z, x); +} + +int +main (void) +{ + struct S a = { 3, 4, 5 }, b = { 6, 7, 8 }, c = { 9, 10, 11 }; + + bar2 (b, a); + bar3 (b, a, c); + baz3 (c, a, b); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050826-1.c b/gcc/testsuite/gcc.c-torture/execute/20050826-1.c new file mode 100644 index 000000000..bc7f94032 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050826-1.c @@ -0,0 +1,44 @@ +/* PR rtl-optimization/23561 */ + +struct A +{ + char a1[1]; + char a2[5]; + char a3[1]; + char a4[2048 - 7]; +} a; + +typedef __SIZE_TYPE__ size_t; +extern void *memset (void *, int, size_t); +extern void *memcpy (void *, const void *, size_t); +extern int memcmp (const void *, const void *, size_t); +extern void abort (void); + +void +bar (struct A *x) +{ + size_t i; + if (memcmp (x, "\1HELLO\1", sizeof "\1HELLO\1")) + abort (); + for (i = 0; i < sizeof (x->a4); i++) + if (x->a4[i]) + abort (); +} + +int +foo (void) +{ + memset (&a, 0, sizeof (a)); + a.a1[0] = 1; + memcpy (a.a2, "HELLO", sizeof "HELLO"); + a.a3[0] = 1; + bar (&a); + return 0; +} + +int +main (void) +{ + foo (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050826-2.c b/gcc/testsuite/gcc.c-torture/execute/20050826-2.c new file mode 100644 index 000000000..039804985 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050826-2.c @@ -0,0 +1,62 @@ +/* PR rtl-optimization/23560 */ + +struct rtattr +{ + unsigned short rta_len; + unsigned short rta_type; +}; + +__attribute__ ((noinline)) +int inet_check_attr (void *r, struct rtattr **rta) +{ + int i; + + for (i = 1; i <= 14; i++) + { + struct rtattr *attr = rta[i - 1]; + if (attr) + { + if (attr->rta_len - sizeof (struct rtattr) < 4) + return -22; + if (i != 9 && i != 8) + rta[i - 1] = attr + 1; + } + } + return 0; +} + +extern void abort (void); + +int +main (void) +{ + struct rtattr rt[2]; + struct rtattr *rta[14]; + int i; + + rt[0].rta_len = sizeof (struct rtattr) + 8; + rt[0].rta_type = 0; + rt[1] = rt[0]; + for (i = 0; i < 14; i++) + rta[i] = &rt[0]; + if (inet_check_attr (0, rta) != 0) + abort (); + for (i = 0; i < 14; i++) + if (rta[i] != &rt[i != 7 && i != 8]) + abort (); + for (i = 0; i < 14; i++) + rta[i] = &rt[0]; + rta[1] = 0; + rt[1].rta_len -= 8; + rta[5] = &rt[1]; + if (inet_check_attr (0, rta) != -22) + abort (); + for (i = 0; i < 14; i++) + if (i == 1 && rta[i] != 0) + abort (); + else if (i != 1 && i <= 5 && rta[i] != &rt[1]) + abort (); + else if (i > 5 && rta[i] != &rt[0]) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050929-1.c b/gcc/testsuite/gcc.c-torture/execute/20050929-1.c new file mode 100644 index 000000000..7be2eb813 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050929-1.c @@ -0,0 +1,20 @@ +/* PR middle-end/24109 */ + +extern void abort (void); + +struct A { int i; int j; }; +struct B { struct A *a; struct A *b; }; +struct C { struct B *c; struct A *d; }; +struct C e = { &(struct B) { &(struct A) { 1, 2 }, &(struct A) { 3, 4 } }, &(struct A) { 5, 6 } }; + +int +main (void) +{ + if (e.c->a->i != 1 || e.c->a->j != 2) + abort (); + if (e.c->b->i != 3 || e.c->b->j != 4) + abort (); + if (e.d->i != 5 || e.d->j != 6) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20051012-1.c b/gcc/testsuite/gcc.c-torture/execute/20051012-1.c new file mode 100644 index 000000000..f12f42913 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20051012-1.c @@ -0,0 +1,24 @@ +extern void abort (void); + +struct type +{ + int *a; + + int b:16; + unsigned int p:9; +} t; + +unsigned int +foo () +{ + return t.p; +} + +int +main (void) +{ + t.p = 8; + if (foo (t) != 8) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20051021-1.c b/gcc/testsuite/gcc.c-torture/execute/20051021-1.c new file mode 100644 index 000000000..0cd2c89ad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20051021-1.c @@ -0,0 +1,28 @@ +/* Verify that TRUTH_AND_EXPR is not wrongly changed to TRUTH_ANDIF_EXPR. */ + +extern void abort (void); + +int count = 0; + +int foo1(void) +{ + count++; + return 0; +} + +int foo2(void) +{ + count++; + return 0; +} + +int main(void) +{ + if ((foo1() == 1) & (foo2() == 1)) + abort (); + + if (count != 2) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20051104-1.c b/gcc/testsuite/gcc.c-torture/execute/20051104-1.c new file mode 100644 index 000000000..16578778c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20051104-1.c @@ -0,0 +1,17 @@ +/* PR rtl-optimization/23567 */ + +struct +{ + int len; + char *name; +} s; + +int +main (void) +{ + s.len = 0; + s.name = ""; + if (s.name [s.len] != 0) + s.name [s.len] = 0; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20051110-1.c b/gcc/testsuite/gcc.c-torture/execute/20051110-1.c new file mode 100644 index 000000000..9fa3df847 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20051110-1.c @@ -0,0 +1,31 @@ +void add_unwind_adjustsp (long); +void abort (void); + +unsigned char bytes[5]; + +void +add_unwind_adjustsp (long offset) +{ + int n; + unsigned long o; + + o = (long) ((offset - 0x204) >> 2); + + n = 0; + while (o) + { + bytes[n] = o & 0x7f; + o >>= 7; + if (o) + bytes[n] |= 0x80; + n++; + } +} + +int main(void) +{ + add_unwind_adjustsp (4132); + if (bytes[0] != 0x88 || bytes[1] != 0x07) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20051110-2.c b/gcc/testsuite/gcc.c-torture/execute/20051110-2.c new file mode 100644 index 000000000..57bfeeb03 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20051110-2.c @@ -0,0 +1,39 @@ +void add_unwind_adjustsp (long); +void abort (void); + +unsigned char bytes[5]; + +int flag; + +void +add_unwind_adjustsp (long offset) +{ + int n; + unsigned long o; + + o = (long) ((offset - 0x204) >> 2); + + n = 0; + do + { +a: + bytes[n] = o & 0x7f; + o >>= 7; + if (o) + { + bytes[n] |= 0x80; + if (flag) + goto a; + } + n++; + } + while (o); +} + +int main(void) +{ + add_unwind_adjustsp (4132); + if (bytes[0] != 0x88 || bytes[1] != 0x07) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20051113-1.c b/gcc/testsuite/gcc.c-torture/execute/20051113-1.c new file mode 100644 index 000000000..6a289fdf2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20051113-1.c @@ -0,0 +1,71 @@ +extern void *malloc(__SIZE_TYPE__); +extern void *memset(void *, int, __SIZE_TYPE__); +typedef struct +{ + short a; + unsigned short b; + unsigned short c; + unsigned long long Count; + long long Count2; +} __attribute__((packed)) Struct1; + +typedef struct +{ + short a; + unsigned short b; + unsigned short c; + unsigned long long d; + long long e; + long long f; +} __attribute__((packed)) Struct2; + +typedef union +{ + Struct1 a; + Struct2 b; +} Union; + +typedef struct +{ + int Count; + Union List[0]; +} __attribute__((packed)) Struct3; + +unsigned long long Sum (Struct3 *instrs) __attribute__((noinline)); +unsigned long long Sum (Struct3 *instrs) +{ + unsigned long long count = 0; + int i; + + for (i = 0; i < instrs->Count; i++) { + count += instrs->List[i].a.Count; + } + return count; +} +long long Sum2 (Struct3 *instrs) __attribute__((noinline)); +long long Sum2 (Struct3 *instrs) +{ + long long count = 0; + int i; + + for (i = 0; i < instrs->Count; i++) { + count += instrs->List[i].a.Count2; + } + return count; +} +main() { + Struct3 *p = malloc (sizeof (int) + 3 * sizeof(Union)); + memset(p, 0, sizeof(int) + 3*sizeof(Union)); + p->Count = 3; + p->List[0].a.Count = 555; + p->List[1].a.Count = 999; + p->List[2].a.Count = 0x101010101ULL; + p->List[0].a.Count2 = 555; + p->List[1].a.Count2 = 999; + p->List[2].a.Count2 = 0x101010101LL; + if (Sum(p) != 555 + 999 + 0x101010101ULL) + abort(); + if (Sum2(p) != 555 + 999 + 0x101010101LL) + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20051215-1.c b/gcc/testsuite/gcc.c-torture/execute/20051215-1.c new file mode 100644 index 000000000..143a449d0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20051215-1.c @@ -0,0 +1,28 @@ +/* PR rtl-optimization/24899 */ + +extern void abort (void); + +__attribute__ ((noinline)) int +foo (int x, int y, int *z) +{ + int a, b, c, d; + + a = b = 0; + for (d = 0; d < y; d++) + { + if (z) + b = d * *z; + for (c = 0; c < x; c++) + a += b; + } + + return a; +} + +int +main (void) +{ + if (foo (3, 2, 0) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20060102-1.c b/gcc/testsuite/gcc.c-torture/execute/20060102-1.c new file mode 100644 index 000000000..04b6a67d9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20060102-1.c @@ -0,0 +1,17 @@ +extern void abort (); + +int f(int x) +{ + return (x >> (sizeof (x) * __CHAR_BIT__ - 1)) ? -1 : 1; +} + +volatile int one = 1; +int main (void) +{ + /* Test that the function above returns different values for + different signs. */ + if (f(one) == f(-one)) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20060110-1.c b/gcc/testsuite/gcc.c-torture/execute/20060110-1.c new file mode 100644 index 000000000..112528ecf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20060110-1.c @@ -0,0 +1,16 @@ +extern void abort (void); + +long long +f (long long a) +{ + return (a << 32) >> 32; +} +long long a = 0x1234567876543210LL; +long long b = (0x1234567876543210LL << 32) >> 32; +int +main () +{ + if (f (a) != b) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20060110-2.c b/gcc/testsuite/gcc.c-torture/execute/20060110-2.c new file mode 100644 index 000000000..bf60f9436 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20060110-2.c @@ -0,0 +1,19 @@ +extern void abort (void); + +long long +f (long long a, long long b) +{ + return ((a + b) << 32) >> 32; +} + +long long a = 0x1234567876543210LL; +long long b = 0x2345678765432101LL; +long long c = ((0x1234567876543210LL + 0x2345678765432101LL) << 32) >> 32; + +int +main () +{ + if (f (a, b) != c) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20060127-1.c b/gcc/testsuite/gcc.c-torture/execute/20060127-1.c new file mode 100644 index 000000000..fe73253a5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20060127-1.c @@ -0,0 +1,17 @@ +void abort (); + +void +f (long long a) +{ + if ((a & 0xffffffffLL) != 0) + abort (); +} + +long long a = 0x1234567800000000LL; + +int +main () +{ + f (a); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20060412-1.c b/gcc/testsuite/gcc.c-torture/execute/20060412-1.c new file mode 100644 index 000000000..a4cc4d450 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20060412-1.c @@ -0,0 +1,33 @@ +extern void abort (void); + +struct S +{ + long o; +}; + +struct T +{ + long o; + struct S m[82]; +}; + +struct T t; + +int +main () +{ + struct S *p, *q; + + p = (struct S *) &t; + p = &((struct T *) p)->m[0]; + q = p + 82; + while (--q > p) + q->o = -1; + q->o = 0; + + if (q > p) + abort (); + if (q - p > 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20060420-1.c b/gcc/testsuite/gcc.c-torture/execute/20060420-1.c new file mode 100644 index 000000000..53393d170 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20060420-1.c @@ -0,0 +1,73 @@ +extern void abort (void); + +typedef float v4flt __attribute__ ((vector_size (16))); + +void __attribute__ ((noinline)) foo (float *dst, float **src, int a, int n) +{ + int i, j; + int z = sizeof (v4flt) / sizeof (float); + unsigned m = sizeof (v4flt) - 1; + + for (j = 0; j < n && (((unsigned long) dst + j) & m); ++j) + { + float t = src[0][j]; + for (i = 1; i < a; ++i) + t += src[i][j]; + dst[j] = t; + } + + for (; j < (n - (4 * z - 1)); j += 4 * z) + { + v4flt t0 = *(v4flt *) (src[0] + j + 0 * z); + v4flt t1 = *(v4flt *) (src[0] + j + 1 * z); + v4flt t2 = *(v4flt *) (src[0] + j + 2 * z); + v4flt t3 = *(v4flt *) (src[0] + j + 3 * z); + for (i = 1; i < a; ++i) + { + t0 += *(v4flt *) (src[i] + j + 0 * z); + t1 += *(v4flt *) (src[i] + j + 1 * z); + t2 += *(v4flt *) (src[i] + j + 2 * z); + t3 += *(v4flt *) (src[i] + j + 3 * z); + } + *(v4flt *) (dst + j + 0 * z) = t0; + *(v4flt *) (dst + j + 1 * z) = t1; + *(v4flt *) (dst + j + 2 * z) = t2; + *(v4flt *) (dst + j + 3 * z) = t3; + } + for (; j < n; ++j) + { + float t = src[0][j]; + for (i = 1; i < a; ++i) + t += src[i][j]; + dst[j] = t; + } +} + +float buffer[64]; + +int +main (void) +{ + int i; + float *dst, *src[2]; + char *cptr; + + cptr = (char *)buffer; + cptr += (-(long int) buffer & (16 * sizeof (float) - 1)); + dst = (float *)cptr; + src[0] = dst + 16; + src[1] = dst + 32; + for (i = 0; i < 16; ++i) + { + src[0][i] = (float) i + 11 * (float) i; + src[1][i] = (float) i + 12 * (float) i; + } + foo (dst, src, 2, 16); + for (i = 0; i < 16; ++i) + { + float e = (float) i + 11 * (float) i + (float) i + 12 * (float) i; + if (dst[i] != e) + abort (); + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20060905-1.c b/gcc/testsuite/gcc.c-torture/execute/20060905-1.c new file mode 100644 index 000000000..eac884fe5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20060905-1.c @@ -0,0 +1,35 @@ +/* PR rtl-optimization/28386 */ +/* Origin: Volker Reichelt */ + +extern void abort(void); + +volatile char s[256][3]; + +char g; + +static void dummy(char a) +{ + g = a; +} + +static int foo(void) +{ + int i, j=0; + + for (i = 0; i < 256; i++) + if (i >= 128 && i < 256) + { + dummy (s[i - 128][0]); + ++j; + } + + return j; +} + +int main(void) +{ + if (foo () != 128) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20060910-1.c b/gcc/testsuite/gcc.c-torture/execute/20060910-1.c new file mode 100644 index 000000000..78bf30139 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20060910-1.c @@ -0,0 +1,37 @@ +/* PR rtl-optimization/28636 */ +/* Origin: Andreas Schwab */ + +extern void abort(void); + +struct input_ty +{ + unsigned char *buffer_position; + unsigned char *buffer_end; +}; + +int input_getc_complicated (struct input_ty *x) { return 0; } + +int check_header (struct input_ty *deeper) +{ + unsigned len; + for (len = 0; len < 6; len++) + if (((deeper)->buffer_position < (deeper)->buffer_end + ? *((deeper)->buffer_position)++ + : input_getc_complicated((deeper))) < 0) + return 0; + return 1; +} + +struct input_ty s; +unsigned char b[6]; + +int main (void) +{ + s.buffer_position = b; + s.buffer_end = b + sizeof b; + if (!check_header(&s)) + abort(); + if (s.buffer_position != s.buffer_end) + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20060929-1.c b/gcc/testsuite/gcc.c-torture/execute/20060929-1.c new file mode 100644 index 000000000..76c447fd5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20060929-1.c @@ -0,0 +1,44 @@ +/* PR c/29154 */ + +extern void abort (void); + +void +foo (int **p, int *q) +{ + *(*p++)++ = *q++; +} + +void +bar (int **p, int *q) +{ + **p = *q++; + *(*p++)++; +} + +void +baz (int **p, int *q) +{ + **p = *q++; + (*p++)++; +} + +int +main (void) +{ + int i = 42, j = 0; + int *p = &i; + foo (&p, &j); + if (p - 1 != &i || j != 0 || i != 0) + abort (); + i = 43; + p = &i; + bar (&p, &j); + if (p - 1 != &i || j != 0 || i != 0) + abort (); + i = 44; + p = &i; + baz (&p, &j); + if (p - 1 != &i || j != 0 || i != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20060930-1.c b/gcc/testsuite/gcc.c-torture/execute/20060930-1.c new file mode 100644 index 000000000..f12ee55dd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20060930-1.c @@ -0,0 +1,42 @@ +/* PR rtl-optimization/28096 */ +/* Origin: Jan Stein */ + +extern void abort (void); + +int bar (int, int) __attribute__((noinline)); +int bar (int a, int b) +{ + if (b != 1) + abort (); +} + +void foo(int, int) __attribute__((noinline)); +void foo (int e, int n) +{ + int i, bb2, bb5; + + if (e > 0) + e = -e; + + for (i = 0; i < n; i++) + { + if (e >= 0) + { + bb2 = 0; + bb5 = 0; + } + else + { + bb5 = -e; + bb2 = bb5; + } + + bar (bb5, bb2); + } +} + +int main(void) +{ + foo (1, 1); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20060930-2.c b/gcc/testsuite/gcc.c-torture/execute/20060930-2.c new file mode 100644 index 000000000..498f7811d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20060930-2.c @@ -0,0 +1,31 @@ +/* PR middle-end/29272 */ + +extern void abort (void); + +struct S { struct S *s; } s; +struct T { struct T *t; } t; + +static inline void +foo (void *s) +{ + struct T *p = s; + __builtin_memcpy (&p->t, &t.t, sizeof (t.t)); +} + +void * +__attribute__((noinline)) +bar (void *p, struct S *q) +{ + q->s = &s; + foo (p); + return q->s; +} + +int +main (void) +{ + t.t = &t; + if (bar (&s, &s) != (void *) &t) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20061031-1.c b/gcc/testsuite/gcc.c-torture/execute/20061031-1.c new file mode 100644 index 000000000..3db0a97f2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20061031-1.c @@ -0,0 +1,28 @@ +/* PR rtl-optimization/29631 */ +/* Origin: Falk Hueffner */ + +const signed char nunmap[] = { 17, -1, 1 }; + +__attribute__((noinline)) +void ff(int i) { + asm volatile(""); +} + +__attribute__((noinline)) +void f(short delta) +{ + short p0 = 2, s; + for (s = 0; s < 2; s++) + { + p0 += delta; + ff(s); + if (nunmap[p0] == 17) + asm volatile(""); + } +} + +int main(void) +{ + f(-1); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20061101-1.c b/gcc/testsuite/gcc.c-torture/execute/20061101-1.c new file mode 100644 index 000000000..23517282d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20061101-1.c @@ -0,0 +1,32 @@ +/* PR rtl-optimization/28970 */ +/* Origin: Peter Bergner */ + +extern void abort (void); + +int tar (int i) +{ + if (i != 36863) + abort (); + + return -1; +} + +void bug(int q, int bcount) +{ + int j = 0; + int outgo = 0; + + while(j != -1) + { + outgo++; + if (outgo > q-1) + outgo = q-1; + j = tar (outgo*bcount); + } +} + +int main(void) +{ + bug(5, 36863); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20061101-1.x b/gcc/testsuite/gcc.c-torture/execute/20061101-1.x new file mode 100644 index 000000000..4efed4c32 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20061101-1.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_int32plus] } { + return 0 +} + +return 1; diff --git a/gcc/testsuite/gcc.c-torture/execute/20061101-2.c b/gcc/testsuite/gcc.c-torture/execute/20061101-2.c new file mode 100644 index 000000000..d5b1046e5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20061101-2.c @@ -0,0 +1,32 @@ +/* PR rtl-optimization/28970 */ +/* Origin: Peter Bergner */ + +extern void abort (void); + +int tar (long i) +{ + if (i != 36863) + abort (); + + return -1; +} + +void bug(int q, long bcount) +{ + int j = 0; + int outgo = 0; + + while(j != -1) + { + outgo++; + if (outgo > q-1) + outgo = q-1; + j = tar (outgo*bcount); + } +} + +int main(void) +{ + bug(5, 36863); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20061220-1.c b/gcc/testsuite/gcc.c-torture/execute/20061220-1.c new file mode 100644 index 000000000..188f92cfc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20061220-1.c @@ -0,0 +1,72 @@ +/* PR middle-end/30262 */ +extern void abort (void); + +int +foo (void) +{ + unsigned int x = 0; + + void nested (void) + { + x = 254; + } + + nested (); + asm volatile ("" :: "r" (x)); + asm volatile ("" :: "m" (x)); + asm volatile ("" :: "mr" (x)); + asm volatile ("" : "=r" (x) : "0" (x)); + asm volatile ("" : "=m" (x) : "m" (x)); + return x; +} + +int +bar (void) +{ + unsigned int x = 0; + + void nested (void) + { + asm volatile ("" :: "r" (x)); + asm volatile ("" :: "m" (x)); + asm volatile ("" :: "mr" (x)); + x += 4; + asm volatile ("" : "=r" (x) : "0" (x)); + asm volatile ("" : "=m" (x) : "m" (x)); + } + + nested (); + return x; +} + +int +baz (void) +{ + unsigned int x = 0; + + void nested (void) + { + void nested2 (void) + { + asm volatile ("" :: "r" (x)); + asm volatile ("" :: "m" (x)); + asm volatile ("" :: "mr" (x)); + x += 4; + asm volatile ("" : "=r" (x) : "0" (x)); + asm volatile ("" : "=m" (x) : "m" (x)); + } + nested2 (); + nested2 (); + } + + nested (); + return x; +} + +int +main (void) +{ + if (foo () != 254 || bar () != 4 || baz () != 8) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20070201-1.c b/gcc/testsuite/gcc.c-torture/execute/20070201-1.c new file mode 100644 index 000000000..c676c3475 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20070201-1.c @@ -0,0 +1,20 @@ +/* PR middle-end/30473 */ + +extern int sprintf (char *, const char *, ...); +extern void abort (void); + +char * +foo (char *buf, char *p) +{ + sprintf (buf, "abcde", p++); + return p; +} + +int +main (void) +{ + char buf[6]; + if (foo (buf, &buf[2]) != &buf[3]) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20070212-1.c b/gcc/testsuite/gcc.c-torture/execute/20070212-1.c new file mode 100644 index 000000000..efda7f9cf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20070212-1.c @@ -0,0 +1,26 @@ +struct f +{ + int i; +}; + +int g(int i, int c, struct f *ff, int *p) +{ + int *t; + if (c) + t = &i; + else + t = &ff->i; + *p = 0; + return *t; +} + +extern void abort(void); + +int main() +{ + struct f f; + f.i = 1; + if (g(5, 0, &f, &f.i) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20070212-2.c b/gcc/testsuite/gcc.c-torture/execute/20070212-2.c new file mode 100644 index 000000000..a107d0efb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20070212-2.c @@ -0,0 +1,19 @@ +int f(int k, int i1, int j1) +{ + int *f1; + if(k) + f1 = &i1; + else + f1 = &j1; + i1 = 0; + return *f1; +} + +extern void abort (void); + +int main() +{ + if (f(1, 1, 2) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20070212-3.c b/gcc/testsuite/gcc.c-torture/execute/20070212-3.c new file mode 100644 index 000000000..174be2bd9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20070212-3.c @@ -0,0 +1,30 @@ +struct foo { int i; int j; }; + +int bar (struct foo *k, int k2, int f, int f2) +{ + int *p, *q; + int res; + if (f) + p = &k->i; + else + p = &k->j; + res = *p; + k->i = 1; + if (f2) + q = p; + else + q = &k2; + return res + *q; +} + +extern void abort (void); + +int main() +{ + struct foo k; + k.i = 0; + k.j = 1; + if (bar (&k, 1, 1, 1) != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20070424-1.c b/gcc/testsuite/gcc.c-torture/execute/20070424-1.c new file mode 100644 index 000000000..4a9f9c916 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20070424-1.c @@ -0,0 +1,27 @@ +extern void abort (void); +extern void exit (int); + +void do_exit (void) { exit (0); } +void do_abort (void) { abort (); } + +void foo (int x, int a) +{ + if (x < a) + goto doit; + do_exit (); + if (x != a) + goto doit; + + /* else */ + do_abort (); + return; + +doit: + do_abort (); +} + +int main() +{ + foo (1, 0); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20070517-1.c b/gcc/testsuite/gcc.c-torture/execute/20070517-1.c new file mode 100644 index 000000000..c81cbc639 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20070517-1.c @@ -0,0 +1,41 @@ +/* PR rtl-optimization/31691 */ +/* Origin: Chi-Hua Chen */ + +extern void abort (void); + +static int get_kind(int) __attribute__ ((noinline)); + +static int get_kind(int v) +{ + volatile int k = v; + return k; +} + +static int some_call(void) __attribute__ ((noinline)); + +static int some_call(void) +{ + return 0; +} + +static void example (int arg) +{ + int tmp, kind = get_kind (arg); + + if (kind == 9 || kind == 10 || kind == 5) + { + if (some_call() == 0) + { + if (kind == 9 || kind == 10) + tmp = arg; + else + abort(); + } + } +} + +int main(void) +{ + example(10); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20070614-1.c b/gcc/testsuite/gcc.c-torture/execute/20070614-1.c new file mode 100644 index 000000000..fa44f7fa3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20070614-1.c @@ -0,0 +1,33 @@ +extern void abort (void); + +_Complex v = 3.0 + 1.0iF; + +void +foo (_Complex z, int *x) +{ + if (z != v) + abort (); +} + +_Complex bar (_Complex z) __attribute__ ((pure)); +_Complex +bar (_Complex z) +{ + return v; +} + +int +baz (void) +{ + int a, i; + for (i = 0; i < 6; i++) + foo (bar (1.0iF * i), &a); + return 0; +} + +int +main () +{ + baz (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20070623-1.c b/gcc/testsuite/gcc.c-torture/execute/20070623-1.c new file mode 100644 index 000000000..e9c7d2a95 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20070623-1.c @@ -0,0 +1,41 @@ +#include + +int __attribute__((noinline)) nge(int a, int b) {return -(a >= b);} +int __attribute__((noinline)) ngt(int a, int b) {return -(a > b);} +int __attribute__((noinline)) nle(int a, int b) {return -(a <= b);} +int __attribute__((noinline)) nlt(int a, int b) {return -(a < b);} +int __attribute__((noinline)) neq(int a, int b) {return -(a == b);} +int __attribute__((noinline)) nne(int a, int b) {return -(a != b);} +int __attribute__((noinline)) ngeu(unsigned a, unsigned b) {return -(a >= b);} +int __attribute__((noinline)) ngtu(unsigned a, unsigned b) {return -(a > b);} +int __attribute__((noinline)) nleu(unsigned a, unsigned b) {return -(a <= b);} +int __attribute__((noinline)) nltu(unsigned a, unsigned b) {return -(a < b);} + + +int main() +{ + if (nge(INT_MIN, INT_MAX) != 0) abort(); + if (nge(INT_MAX, INT_MIN) != -1) abort(); + if (ngt(INT_MIN, INT_MAX) != 0) abort(); + if (ngt(INT_MAX, INT_MIN) != -1) abort(); + if (nle(INT_MIN, INT_MAX) != -1) abort(); + if (nle(INT_MAX, INT_MIN) != 0) abort(); + if (nlt(INT_MIN, INT_MAX) != -1) abort(); + if (nlt(INT_MAX, INT_MIN) != 0) abort(); + + if (neq(INT_MIN, INT_MAX) != 0) abort(); + if (neq(INT_MAX, INT_MIN) != 0) abort(); + if (nne(INT_MIN, INT_MAX) != -1) abort(); + if (nne(INT_MAX, INT_MIN) != -1) abort(); + + if (ngeu(0, ~0U) != 0) abort(); + if (ngeu(~0U, 0) != -1) abort(); + if (ngtu(0, ~0U) != 0) abort(); + if (ngtu(~0U, 0) != -1) abort(); + if (nleu(0, ~0U) != -1) abort(); + if (nleu(~0U, 0) != 0) abort(); + if (nltu(0, ~0U) != -1) abort(); + if (nltu(~0U, 0) != 0) abort(); + + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20070724-1.c b/gcc/testsuite/gcc.c-torture/execute/20070724-1.c new file mode 100644 index 000000000..011a903f8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20070724-1.c @@ -0,0 +1,11 @@ +void abort (void); + +static unsigned char magic[] = "\235"; +static unsigned char value = '\235'; + +int main() +{ + if (value != magic[0]) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20070824-1.c b/gcc/testsuite/gcc.c-torture/execute/20070824-1.c new file mode 100644 index 000000000..74eb58c05 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20070824-1.c @@ -0,0 +1,24 @@ +/* PR tree-optimization/33136 */ + +extern void abort (void); + +struct S +{ + struct S *a; + int b; +}; + +int +main (void) +{ + struct S *s = (struct S *) 0, **p, *n; + for (p = &s; *p; p = &(*p)->a); + n = (struct S *) __builtin_alloca (sizeof (*n)); + n->a = *p; + n->b = 1; + *p = n; + + if (!s) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20070919-1.c b/gcc/testsuite/gcc.c-torture/execute/20070919-1.c new file mode 100644 index 000000000..ade3d7e8e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20070919-1.c @@ -0,0 +1,41 @@ +/* PR c/33238 */ + +typedef __SIZE_TYPE__ size_t; +int memcmp (const void *, const void *, size_t); +void abort (void); + +void +__attribute__((noinline)) +bar (void *x, void *y) +{ + struct S { char w[8]; } *p = x, *q = y; + if (memcmp (p->w, "zyxwvut", 8) != 0) + abort (); + if (memcmp (q[0].w, "abcdefg", 8) != 0) + abort (); + if (memcmp (q[1].w, "ABCDEFG", 8) != 0) + abort (); + if (memcmp (q[2].w, "zyxwvut", 8) != 0) + abort (); + if (memcmp (q[3].w, "zyxwvut", 8) != 0) + abort (); +} + +void +__attribute__((noinline)) +foo (void *x, int y) +{ + struct S { char w[y]; } *p = x, a; + int i; + a = ({ struct S b; b = p[2]; p[3] = b; }); + bar (&a, x); +} + +int +main (void) +{ + struct S { char w[8]; } p[4] + = { "abcdefg", "ABCDEFG", "zyxwvut", "ZYXWVUT" }; + foo (p, 8); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20071011-1.c b/gcc/testsuite/gcc.c-torture/execute/20071011-1.c new file mode 100644 index 000000000..631658540 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20071011-1.c @@ -0,0 +1,19 @@ +extern void abort(void); +void foo(int *p) +{ + int x; + int y; + x = *p; + *p = 0; + y = *p; + if (x != y) + return; + abort (); +} + +int main() +{ + int a = 1; + foo(&a); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20071018-1.c b/gcc/testsuite/gcc.c-torture/execute/20071018-1.c new file mode 100644 index 000000000..ae13c731a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20071018-1.c @@ -0,0 +1,31 @@ +extern void abort(void); + +struct foo { + int rank; + char *name; +}; + +struct mem { + struct foo *x[4]; +}; + +void __attribute__((noinline)) bar(struct foo **f) +{ + *f = __builtin_malloc(sizeof(struct foo)); +} +struct foo * foo(int rank) +{ + void *x = __builtin_malloc(sizeof(struct mem)); + struct mem *as = x; + struct foo **upper = &as->x[rank * 8 - 1]; + *upper = 0; + bar(upper); + return *upper; +} + +int main() +{ + if (foo(0) == 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20071029-1.c b/gcc/testsuite/gcc.c-torture/execute/20071029-1.c new file mode 100644 index 000000000..6b895d60a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20071029-1.c @@ -0,0 +1,56 @@ +extern void exit (int); +extern void abort (void); + +typedef union +{ + struct + { + int f1, f2, f3, f4, f5, f6, f7, f8; + long int f9, f10; + int f11; + } f; + char s[56]; + long int a; +} T; + +__attribute__((noinline)) +void +test (T *t) +{ + static int i = 11; + if (t->f.f1 != i++) + abort (); + if (t->f.f2 || t->f.f3 || t->f.f4 || t->f.f5 || t->f.f6 + || t->f.f7 || t->f.f8 || t->f.f9 || t->f.f10 || t->f.f11) + abort (); + if (i == 20) + exit (0); +} + +__attribute__((noinline)) +void +foo (int i) +{ + T t; +again: + t = (T) { { ++i, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; + test (&t); + goto again; +} + +int +main (void) +{ + T *t1, *t2; + int cnt = 0; + t1 = (T *) 0; +loop: + t2 = t1; + t1 = & (T) { .f.f9 = cnt++ }; + if (cnt < 3) + goto loop; + if (t1 != t2 || t1->f.f9 != 2) + abort (); + foo (10); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20071030-1.c b/gcc/testsuite/gcc.c-torture/execute/20071030-1.c new file mode 100644 index 000000000..7be3cd8c8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20071030-1.c @@ -0,0 +1,79 @@ +/* PR target/11044 */ +/* Originator: Tim McGrath */ +/* Testcase contributed by Eric Botcazou */ + +/* Testcase copied from gcc.target/i386/loop-3.c */ + +extern void *memset (void *, int, __SIZE_TYPE__); +extern void abort (void); + +typedef struct +{ + unsigned char colormod; +} entity_state_t; + +typedef struct +{ + int num_entities; + entity_state_t *entities; +} packet_entities_t; + +typedef struct +{ + double senttime; + float ping_time; + packet_entities_t entities; +} client_frame_t; + +typedef enum +{ + cs_free, + cs_server, + cs_zombie, + cs_connected, + cs_spawned +} sv_client_state_t; + +typedef struct client_s +{ + sv_client_state_t state; + int ping; + client_frame_t frames[64]; +} client_t; + +int CalcPing (client_t *cl) +{ + float ping; + int count, i; + register client_frame_t *frame; + + if (cl->state == cs_server) + return cl->ping; + ping = 0; + count = 0; + for (frame = cl->frames, i = 0; i < 64; i++, frame++) { + if (frame->ping_time > 0) { + ping += frame->ping_time; + count++; + } + } + if (!count) + return 9999; + ping /= count; + + return ping * 1000; +} + +int main(void) +{ + client_t cl; + + memset(&cl, 0, sizeof(cl)); + + cl.frames[0].ping_time = 1.0f; + + if (CalcPing(&cl) != 1000) + abort(); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20071108-1.c b/gcc/testsuite/gcc.c-torture/execute/20071108-1.c new file mode 100644 index 000000000..f5460579b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20071108-1.c @@ -0,0 +1,53 @@ +/* PR tree-optimization/32575 */ + +extern void abort (void); + +struct S +{ + void *s1, *s2; + unsigned char s3, s4, s5; +}; + +__attribute__ ((noinline)) +void * +foo (void) +{ + static struct S s; + return &s; +} + +__attribute__ ((noinline)) +void * +bar () +{ + return (void *) 0; +} + +__attribute__ ((noinline)) +struct S * +test (void *a, void *b) +{ + struct S *p, q; + p = foo (); + if (p == 0) + { + p = &q; + __builtin_memset (p, 0, sizeof (*p)); + } + p->s1 = a; + p->s2 = b; + if (p == &q) + p = 0; + return p; +} + +int +main (void) +{ + int a; + int b; + struct S *z = test ((void *) &a, (void *) &b); + if (z == 0 || z->s1 != (void *) &a || z->s2 != (void *) &b || z->s3 || z->s4) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20071120-1.c b/gcc/testsuite/gcc.c-torture/execute/20071120-1.c new file mode 100644 index 000000000..ffe51aec8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20071120-1.c @@ -0,0 +1,81 @@ +extern void abort (void); + +void __attribute__((noinline,noreturn)) +vec_assert_fail (void) +{ + abort (); +} + +struct ggc_root_tab { + void *base; +}; + +typedef struct deferred_access_check {} VEC_deferred_access_check_gc; + +typedef struct deferred_access { + VEC_deferred_access_check_gc* deferred_access_checks; + int deferring_access_checks_kind; +} deferred_access; + +typedef struct VEC_deferred_access_base { + unsigned num; + deferred_access vec[1]; +} VEC_deferred_access_base; + +static __inline__ deferred_access * +VEC_deferred_access_base_last (VEC_deferred_access_base *vec_) +{ + (void)((vec_ && vec_->num) ? 0 : (vec_assert_fail (), 0)); + return &vec_->vec[vec_->num - 1]; +} + +static __inline__ void +VEC_deferred_access_base_pop (VEC_deferred_access_base *vec_) +{ + (void)((vec_->num) ? 0 : (vec_assert_fail (), 0)); + --vec_->num; +} + +void __attribute__((noinline)) +perform_access_checks (VEC_deferred_access_check_gc* p) +{ + abort (); +} + +typedef struct VEC_deferred_access_gc { + VEC_deferred_access_base base; +} VEC_deferred_access_gc; + +static VEC_deferred_access_gc *deferred_access_stack; +static unsigned deferred_access_no_check; + +const struct ggc_root_tab gt_pch_rs_gt_cp_semantics_h[] = { + { + &deferred_access_no_check + } +}; + +void __attribute__((noinline)) pop_to_parent_deferring_access_checks (void) +{ + if (deferred_access_no_check) + deferred_access_no_check--; + else + { + VEC_deferred_access_check_gc *checks; + deferred_access *ptr; + checks = (VEC_deferred_access_base_last(deferred_access_stack ? &deferred_access_stack->base : 0))->deferred_access_checks; + VEC_deferred_access_base_pop(deferred_access_stack ? &deferred_access_stack->base : 0); + ptr = VEC_deferred_access_base_last(deferred_access_stack ? &deferred_access_stack->base : 0); + if (ptr->deferring_access_checks_kind == 0) + perform_access_checks (checks); + } +} + +int main() +{ + deferred_access_stack = __builtin_malloc (sizeof(VEC_deferred_access_gc) + sizeof(deferred_access) * 8); + deferred_access_stack->base.num = 2; + deferred_access_stack->base.vec[0].deferring_access_checks_kind = 1; + pop_to_parent_deferring_access_checks (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20071202-1.c b/gcc/testsuite/gcc.c-torture/execute/20071202-1.c new file mode 100644 index 000000000..14fb8ec35 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20071202-1.c @@ -0,0 +1,25 @@ +extern void abort (void); +struct T { int t; int r[8]; }; +struct S { int a; int b; int c[6]; struct T d; }; + +__attribute__((noinline)) void +foo (struct S *s) +{ + *s = (struct S) { s->b, s->a, { 0, 0, 0, 0, 0, 0 }, s->d }; +} + +int +main (void) +{ + struct S s = { 6, 12, { 1, 2, 3, 4, 5, 6 }, + { 7, { 8, 9, 10, 11, 12, 13, 14, 15 } } }; + foo (&s); + if (s.a != 12 || s.b != 6 + || s.c[0] || s.c[1] || s.c[2] || s.c[3] || s.c[4] || s.c[5]) + abort (); + if (s.d.t != 7 || s.d.r[0] != 8 || s.d.r[1] != 9 || s.d.r[2] != 10 + || s.d.r[3] != 11 || s.d.r[4] != 12 || s.d.r[5] != 13 + || s.d.r[6] != 14 || s.d.r[7] != 15) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20071205-1.c b/gcc/testsuite/gcc.c-torture/execute/20071205-1.c new file mode 100644 index 000000000..fa19ec067 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20071205-1.c @@ -0,0 +1,17 @@ +/* PR middle-end/34337 */ + +extern void abort (void); + +int +foo (int x) +{ + return ((x << 8) & 65535) | 255; +} + +int +main (void) +{ + if (foo (0x32) != 0x32ff || foo (0x174) != 0x74ff) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20071210-1.c b/gcc/testsuite/gcc.c-torture/execute/20071210-1.c new file mode 100644 index 000000000..0d113c008 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20071210-1.c @@ -0,0 +1,67 @@ +/* PR rtl-optimization/34302 */ + +extern void abort (void); + +struct S +{ + int n1, n2, n3, n4; +}; + +__attribute__((noinline)) struct S +foo (int x, int y, int z) +{ + if (x != 10 || y != 9 || z != 8) + abort (); + struct S s = { 1, 2, 3, 4 }; + return s; +} + +__attribute__((noinline)) void ** +bar (void **u, int *v) +{ + void **w = u; + int *s = v, x, y, z; + void **p, **q; + static void *l[] = { &&lab1, &&lab1, &&lab2, &&lab3, &&lab4 }; + + if (!u) + return l; + + q = *w++; + goto *q; +lab2: + p = q; + q = *w++; + x = s[2]; + y = s[1]; + z = s[0]; + s -= 1; + struct S r = foo (x, y, z); + s[3] = r.n1; + s[2] = r.n2; + s[1] = r.n3; + s[0] = r.n4; + goto *q; +lab3: + p = q; + q = *w++; + s += 1; + s[0] = 23; +lab1: + goto *q; +lab4: + return 0; +} + +int +main (void) +{ + void **u = bar ((void **) 0, (int *) 0); + void *t[] = { u[2], u[4] }; + int s[] = { 7, 8, 9, 10, 11, 12 }; + if (bar (t, &s[1]) != (void **) 0 + || s[0] != 4 || s[1] != 3 || s[2] != 2 || s[3] != 1 + || s[4] != 11 || s[5] != 12) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20071211-1.c b/gcc/testsuite/gcc.c-torture/execute/20071211-1.c new file mode 100644 index 000000000..4a4f1fefc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20071211-1.c @@ -0,0 +1,23 @@ +extern void abort() __attribute__ ((noreturn)); + +struct s +{ + unsigned long long f1 : 40; +#if(__SIZEOF_INT__ >= 4) + unsigned int f2 : 24; +#else + unsigned long int f2 : 24; +#endif +} sv; + +int main() +{ + int f2; + sv.f2 = (1 << 24) - 1; + __asm__ volatile ("" : : : "memory"); + ++sv.f2; + f2 = sv.f2; + if (f2 != 0) + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20071213-1.c b/gcc/testsuite/gcc.c-torture/execute/20071213-1.c new file mode 100644 index 000000000..cbdfaa56c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20071213-1.c @@ -0,0 +1,53 @@ +/* PR target/34281 */ + +#include + +extern void abort (void); + +void +h (int x, va_list ap) +{ + switch (x) + { + case 1: + if (va_arg (ap, int) != 3 || va_arg (ap, int) != 4) + abort (); + return; + case 5: + if (va_arg (ap, int) != 9 || va_arg (ap, int) != 10) + abort (); + return; + default: + abort (); + } +} + +void +f1 (int i, long long int j, ...) +{ + va_list ap; + va_start (ap, j); + h (i, ap); + if (i != 1 || j != 2) + abort (); + va_end (ap); +} + +void +f2 (int i, int j, int k, long long int l, ...) +{ + va_list ap; + va_start (ap, l); + h (i, ap); + if (i != 5 || j != 6 || k != 7 || l != 8) + abort (); + va_end (ap); +} + +int +main () +{ + f1 (1, 2, 3, 4); + f2 (5, 6, 7, 8, 9, 10); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20071216-1.c b/gcc/testsuite/gcc.c-torture/execute/20071216-1.c new file mode 100644 index 000000000..a337b773a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20071216-1.c @@ -0,0 +1,38 @@ +/* PR rtl-optimization/34490 */ + +extern void abort (void); + +static int x; + +int +__attribute__((noinline)) +bar (void) +{ + return x; +} + +int +foo (void) +{ + long int b = bar (); + if ((unsigned long) b < -4095L) + return b; + if (-b != 38) + b = -2; + return b + 1; +} + +int +main (void) +{ + x = 26; + if (foo () != 26) + abort (); + x = -39; + if (foo () != -1) + abort (); + x = -38; + if (foo () != -37) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20071219-1.c b/gcc/testsuite/gcc.c-torture/execute/20071219-1.c new file mode 100644 index 000000000..4152711a3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20071219-1.c @@ -0,0 +1,71 @@ +/* PR c++/34459 */ + +extern void abort (void); +extern void *memset (void *s, int c, __SIZE_TYPE__ n); + +struct S +{ + char s[25]; +}; + +struct S *p; + +void __attribute__((noinline)) +foo (struct S *x, int set) +{ + int i; + for (i = 0; i < sizeof (x->s); ++i) + if (x->s[i] != 0) + abort (); + else if (set) + x->s[i] = set; + p = x; +} + +void __attribute__((noinline)) +test1 (void) +{ + struct S a; + memset (&a.s, '\0', sizeof (a.s)); + foo (&a, 0); + struct S b = a; + foo (&b, 1); + b = a; + b = b; + foo (&b, 0); +} + +void __attribute__((noinline)) +test2 (void) +{ + struct S a; + memset (&a.s, '\0', sizeof (a.s)); + foo (&a, 0); + struct S b = a; + foo (&b, 1); + b = a; + b = *p; + foo (&b, 0); +} + +void __attribute__((noinline)) +test3 (void) +{ + struct S a; + memset (&a.s, '\0', sizeof (a.s)); + foo (&a, 0); + struct S b = a; + foo (&b, 1); + *p = a; + *p = b; + foo (&b, 0); +} + +int +main (void) +{ + test1 (); + test2 (); + test3 (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20071220-1.c b/gcc/testsuite/gcc.c-torture/execute/20071220-1.c new file mode 100644 index 000000000..00c2fa57b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20071220-1.c @@ -0,0 +1,40 @@ +/* PR tree-optimization/29484 */ + +extern void abort (void); + +void *__attribute__((noinline)) +baz (void **lab) +{ + asm volatile ("" : "+r" (lab)); + return *lab; +} + +static inline +int bar (void) +{ + static void *b[] = { &&addr }; + void *p = baz (b); + goto *p; +addr: + return 17; +} + +int __attribute__((noinline)) +f1 (void) +{ + return bar (); +} + +int __attribute__((noinline)) +f2 (void) +{ + return bar (); +} + +int +main (void) +{ + if (f1 () != 17 || f1 () != 17 || f2 () != 17 || f2 () != 17) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20071220-2.c b/gcc/testsuite/gcc.c-torture/execute/20071220-2.c new file mode 100644 index 000000000..93fa9de02 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20071220-2.c @@ -0,0 +1,39 @@ +/* PR tree-optimization/29484 */ + +extern void abort (void); + +void *__attribute__((noinline)) +baz (void **lab) +{ + asm volatile ("" : "+r" (lab)); + return *lab; +} + +static inline +int bar (void) +{ + static void *b[] = { &&addr }; + baz (b); +addr: + return 17; +} + +int __attribute__((noinline)) +f1 (void) +{ + return bar (); +} + +int __attribute__((noinline)) +f2 (void) +{ + return bar (); +} + +int +main (void) +{ + if (f1 () != 17 || f1 () != 17 || f2 () != 17 || f2 () != 17) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20080117-1.c b/gcc/testsuite/gcc.c-torture/execute/20080117-1.c new file mode 100644 index 000000000..94b7c7531 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20080117-1.c @@ -0,0 +1,24 @@ +typedef struct gs_imager_state_s { + struct { + int half_width; + int cap; + float miter_limit; + } line_params; +} gs_imager_state; +static const gs_imager_state gstate_initial = { { 1 } }; +void gstate_path_memory(gs_imager_state *pgs) { + *pgs = gstate_initial; +} +int gs_state_update_overprint(void) +{ + return gstate_initial.line_params.half_width; +} + +extern void abort (void); +int main() +{ + if (gs_state_update_overprint() != 1) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20080122-1.c b/gcc/testsuite/gcc.c-torture/execute/20080122-1.c new file mode 100644 index 000000000..a2f7fed87 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20080122-1.c @@ -0,0 +1,35 @@ +/* PR rtl-optimization/34628 */ +/* Origin: Martin Michlmayr */ + +typedef unsigned short u16; +typedef unsigned char u8; + +static void +do_segfault(u8 in_buf[], const u8 out_buf[], const int len) +{ + int i; + + for (i = 0; i < len; i++) { + asm(""); + + in_buf[2*i] = ( out_buf[2*i] | out_buf[(2*i)+1]<<8 ) & 0xFF; + + asm(""); + + in_buf[(2*i)+1] = ( out_buf[2*i] | out_buf[(2*i)+1]<<8 ) >> 8; + + asm(""); + } +} + +int main(int argc, char *argv[]) +{ + u8 outbuf[32] = "buffer "; + u8 inbuf[32] = "\f"; + + asm(""); + do_segfault(inbuf, outbuf, 12); + asm(""); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20080222-1.c b/gcc/testsuite/gcc.c-torture/execute/20080222-1.c new file mode 100644 index 000000000..6db83ccdf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20080222-1.c @@ -0,0 +1,22 @@ +extern void abort (void); + +struct container +{ + unsigned char data[1]; +}; + +unsigned char space[6] = {1, 2, 3, 4, 5, 6}; + +int +foo (struct container *p) +{ + return p->data[4]; +} + +int +main () +{ + if (foo ((struct container *) space) != 5) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20080408-1.c b/gcc/testsuite/gcc.c-torture/execute/20080408-1.c new file mode 100644 index 000000000..9e1ff6395 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20080408-1.c @@ -0,0 +1,11 @@ +extern void abort (void); +int main () +{ + short ssi = 126; + unsigned short usi = 65280; + int fail = !(ssi < usi); + if (fail) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20080424-1.c b/gcc/testsuite/gcc.c-torture/execute/20080424-1.c new file mode 100644 index 000000000..4916d9075 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20080424-1.c @@ -0,0 +1,31 @@ +/* PR tree-optimization/36008 */ + +extern void abort (void); + +int g[48][3][3]; + +void __attribute__ ((noinline)) +bar (int x[3][3], int y[3][3]) +{ + static int i; + if (x != g[i + 8] || y != g[i++]) + abort (); +} + +static inline void __attribute__ ((always_inline)) +foo (int x[][3][3]) +{ + int i; + for (i = 0; i < 8; i++) + { + int k = i + 8; + bar (x[k], x[k - 8]); + } +} + +int +main () +{ + foo (g); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20080502-1.c b/gcc/testsuite/gcc.c-torture/execute/20080502-1.c new file mode 100644 index 000000000..ed9b2085e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20080502-1.c @@ -0,0 +1,16 @@ +/* PR target/36090 */ + +extern void abort (void); + +long double __attribute__ ((noinline)) foo (long double x) +{ + return __builtin_signbit (x) ? 3.1415926535897932384626433832795029L : 0.0; +} + +int +main (void) +{ + if (foo (-1.0L) != 3.1415926535897932384626433832795029L) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20080506-1.c b/gcc/testsuite/gcc.c-torture/execute/20080506-1.c new file mode 100644 index 000000000..4f6d6d81a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20080506-1.c @@ -0,0 +1,21 @@ +/* PR middle-end/36137 */ +extern void abort (void); + +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#define MAX(a, b) ((a) > (b) ? (a) : (b)) + +int +main () +{ + unsigned int u; + int i = -1; + + u = MAX ((unsigned int) MAX (i, 0), 1); + if (u != 1) + abort (); + + u = MIN ((unsigned int) MAX (i, 0), (unsigned int) i); + if (u != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20080506-2.c b/gcc/testsuite/gcc.c-torture/execute/20080506-2.c new file mode 100644 index 000000000..d2fac713b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20080506-2.c @@ -0,0 +1,21 @@ +/* PR middle-end/36013 */ + +extern void abort (void); + +void __attribute__((noinline)) +foo (int **__restrict p, int **__restrict q) +{ + *p[0] = 1; + *q[0] = 2; + if (*p[0] != 2) + abort (); +} + +int +main (void) +{ + int a; + int *p1 = &a, *p2 = &a; + foo (&p1, &p2); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20080519-1.c b/gcc/testsuite/gcc.c-torture/execute/20080519-1.c new file mode 100644 index 000000000..303c4e65f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20080519-1.c @@ -0,0 +1,58 @@ +extern void abort (void); + +typedef unsigned long HARD_REG_SET[2]; +HARD_REG_SET reg_class_contents[2]; + +struct du_chain +{ + struct du_chain *next_use; + int cl; +}; + +void __attribute__((noinline)) +merge_overlapping_regs (HARD_REG_SET *p) +{ + if ((*p)[0] != -1 || (*p)[1] != -1) + abort (); +} + +void __attribute__((noinline)) +regrename_optimize (struct du_chain *this) +{ + HARD_REG_SET this_unavailable; + unsigned long *scan_fp_; + int n_uses; + struct du_chain *last; + + this_unavailable[0] = 0; + this_unavailable[1] = 0; + + n_uses = 0; + for (last = this; last->next_use; last = last->next_use) + { + scan_fp_ = reg_class_contents[last->cl]; + n_uses++; + this_unavailable[0] |= ~ scan_fp_[0]; + this_unavailable[1] |= ~ scan_fp_[1]; + } + if (n_uses < 1) + return; + + scan_fp_ = reg_class_contents[last->cl]; + this_unavailable[0] |= ~ scan_fp_[0]; + this_unavailable[1] |= ~ scan_fp_[1]; + + merge_overlapping_regs (&this_unavailable); +} + +int main() +{ + struct du_chain du1 = { 0, 0 }; + struct du_chain du0 = { &du1, 1 }; + reg_class_contents[0][0] = -1; + reg_class_contents[0][1] = -1; + reg_class_contents[1][0] = 0; + reg_class_contents[1][1] = 0; + regrename_optimize (&du0); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20080522-1.c b/gcc/testsuite/gcc.c-torture/execute/20080522-1.c new file mode 100644 index 000000000..75bc533f5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20080522-1.c @@ -0,0 +1,43 @@ +/* This testcase is to make sure we have i in referenced vars and that we + properly compute aliasing for the loads and stores. */ + +extern void abort (void); + +static int i; +static int *p = &i; + +int __attribute__((noinline)) +foo(int *q) +{ + *p = 1; + *q = 2; + return *p; +} + +int __attribute__((noinline)) +bar(int *q) +{ + *q = 2; + *p = 1; + return *q; +} + +int main() +{ + int j = 0; + + if (foo(&i) != 2) + abort (); + if (bar(&i) != 1) + abort (); + if (foo(&j) != 1) + abort (); + if (j != 2) + abort (); + if (bar(&j) != 2) + abort (); + if (j != 2) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20080529-1.c b/gcc/testsuite/gcc.c-torture/execute/20080529-1.c new file mode 100644 index 000000000..cd4298084 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20080529-1.c @@ -0,0 +1,17 @@ +/* PR target/36362 */ + +extern void abort (void); + +int +test (float c) +{ + return !!c * 7LL == 0; +} + +int +main (void) +{ + if (test (1.0f) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20080604-1.c b/gcc/testsuite/gcc.c-torture/execute/20080604-1.c new file mode 100644 index 000000000..5ba35cb2c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20080604-1.c @@ -0,0 +1,32 @@ +struct barstruct { char const* some_string; } x; +extern void abort (void); +void __attribute__((noinline)) +foo(void) +{ + if (!x.some_string) + abort (); +} +void baz(int b) +{ + struct barstruct bar; + struct barstruct* barptr; + if (b) + barptr = &bar; + else + { + barptr = &x + 1; + barptr = barptr - 1; + } + barptr->some_string = "Everything OK"; + foo(); + barptr->some_string = "Everything OK"; +} +int main() +{ + x.some_string = (void *)0; + baz(0); + if (!x.some_string) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20080719-1.c b/gcc/testsuite/gcc.c-torture/execute/20080719-1.c new file mode 100644 index 000000000..694abcbf9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20080719-1.c @@ -0,0 +1,65 @@ +typedef unsigned int u32; + +static const u32 deadfish = 0xdeadf155; + +static const u32 cfb_tab8_be[] = { + 0x00000000,0x000000ff,0x0000ff00,0x0000ffff, + 0x00ff0000,0x00ff00ff,0x00ffff00,0x00ffffff, + 0xff000000,0xff0000ff,0xff00ff00,0xff00ffff, + 0xffff0000,0xffff00ff,0xffffff00,0xffffffff +}; + +static const u32 cfb_tab8_le[] = { + 0x00000000,0xff000000,0x00ff0000,0xffff0000, + 0x0000ff00,0xff00ff00,0x00ffff00,0xffffff00, + 0x000000ff,0xff0000ff,0x00ff00ff,0xffff00ff, + 0x0000ffff,0xff00ffff,0x00ffffff,0xffffffff +}; + +static const u32 cfb_tab16_be[] = { + 0x00000000, 0x0000ffff, 0xffff0000, 0xffffffff +}; + +static const u32 cfb_tab16_le[] = { + 0x00000000, 0xffff0000, 0x0000ffff, 0xffffffff +}; + +static const u32 cfb_tab32[] = { + 0x00000000, 0xffffffff +}; + + + + + + +const u32 *xxx(int bpp) +{ + const u32 *tab; + +if (0) return &deadfish; + + switch (bpp) { + case 8: + tab = cfb_tab8_be; + break; + case 16: + tab = cfb_tab16_be; + break; + case 32: + default: + tab = cfb_tab32; + break; + } + + return tab; +} + +int main(void) +{ + const u32 *a = xxx(8); + int b = a[0]; + if (b != cfb_tab8_be[0]) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20080813-1.c b/gcc/testsuite/gcc.c-torture/execute/20080813-1.c new file mode 100644 index 000000000..9ef6bc2e2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20080813-1.c @@ -0,0 +1,30 @@ +/* PR middle-end/37103 */ + +extern void abort (void); + +void +foo (unsigned short x) +{ + signed char y = -1; + if (x == y) + abort (); +} + +void +bar (unsigned short x) +{ + unsigned char y = -1; + if (x == y) + abort (); +} + +int +main (void) +{ + if (sizeof (int) == sizeof (short)) + return 0; + foo (-1); + if (sizeof (short) > 1) + bar (-1); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20081103-1.c b/gcc/testsuite/gcc.c-torture/execute/20081103-1.c new file mode 100644 index 000000000..c458fbc4a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20081103-1.c @@ -0,0 +1,17 @@ +struct S { char c; char arr[4]; float f; }; + +char A[4] = { '1', '2', '3', '4' }; + +void foo (struct S s) +{ + if (__builtin_memcmp (s.arr, A, 4)) + __builtin_abort (); +} + +int main (void) +{ + struct S s; + __builtin_memcpy (s.arr, A, 4); + foo (s); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20081112-1.c b/gcc/testsuite/gcc.c-torture/execute/20081112-1.c new file mode 100644 index 000000000..1efe01685 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20081112-1.c @@ -0,0 +1,17 @@ +#include + +extern void abort (void); + +static __attribute__((noinline)) void foo (int a) +{ + int b = (a - 1) + INT_MIN; + + if (b != INT_MIN) + abort (); +} + +int main (void) +{ + foo (1); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20081117-1.c b/gcc/testsuite/gcc.c-torture/execute/20081117-1.c new file mode 100644 index 000000000..bff7464cb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20081117-1.c @@ -0,0 +1,24 @@ +extern void abort (void); + +struct s +{ + unsigned long long a:16; + unsigned long long b:32; + unsigned long long c:16; +}; + +__attribute__ ((noinline)) unsigned +f (struct s s, unsigned i) +{ + return s.b == i; +} + +struct s s = { 1, 0x87654321u, 2}; + +int +main () +{ + if (!f (s, 0x87654321u)) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20081117-1.x b/gcc/testsuite/gcc.c-torture/execute/20081117-1.x new file mode 100644 index 000000000..7378270cd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20081117-1.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_int16] } { + return 1 +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/20081218-1.c b/gcc/testsuite/gcc.c-torture/execute/20081218-1.c new file mode 100644 index 000000000..24b7bdd73 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20081218-1.c @@ -0,0 +1,39 @@ +struct A { int i, j; char pad[512]; } a; + +int __attribute__((noinline)) +foo (void) +{ + __builtin_memset (&a, 0x26, sizeof a); + return a.i; +} + +void __attribute__((noinline)) +bar (void) +{ + __builtin_memset (&a, 0x36, sizeof a); + a.i = 0x36363636; + a.j = 0x36373636; +} + +int +main (void) +{ + int i; + if (sizeof (int) != 4 || __CHAR_BIT__ != 8) + return 0; + + if (foo () != 0x26262626) + __builtin_abort (); + for (i = 0; i < sizeof a; i++) + if (((char *)&a)[i] != 0x26) + __builtin_abort (); + + bar (); + if (a.j != 0x36373636) + __builtin_abort (); + a.j = 0x36363636; + for (i = 0; i < sizeof a; i++) + if (((char *)&a)[i] != 0x36) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20090113-1.c b/gcc/testsuite/gcc.c-torture/execute/20090113-1.c new file mode 100644 index 000000000..9c5f01d71 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20090113-1.c @@ -0,0 +1,61 @@ +typedef struct descriptor_dimension +{ + int stride; + int lbound; + int ubound; +} descriptor_dimension; +typedef struct { + int *data; + int dtype; + descriptor_dimension dim[7]; +} gfc_array_i4; + +void +msum_i4 (gfc_array_i4 * const retarray, + gfc_array_i4 * const array, + const int * const pdim) +{ + int count[7]; + int extent[7]; + int * dest; + const int * base; + int dim; + int n; + int len; + + dim = (*pdim) - 1; + len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + + for (n = 0; n < dim; n++) + { + extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + count[n] = 0; + } + + dest = retarray->data; + base = array->data; + + do + { + int result = 0; + + for (n = 0; n < len; n++, base++) + result += *base; + *dest = result; + + count[0]++; + dest += 1; + } + while (count[0] != extent[0]); +} + +int main() +{ + int rdata[3]; + int adata[9]; + gfc_array_i4 retarray = { rdata, 265, { { 1, 1, 3 } } }; + gfc_array_i4 array = { adata, 266, { { 1, 1, 3 }, { 3, 1, 3 } } }; + int dim = 2; + msum_i4 (&retarray, &array, &dim); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20090113-2.c b/gcc/testsuite/gcc.c-torture/execute/20090113-2.c new file mode 100644 index 000000000..9871a66ff --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20090113-2.c @@ -0,0 +1,160 @@ +struct obstack {}; +struct bitmap_head_def; +typedef struct bitmap_head_def *bitmap; +typedef const struct bitmap_head_def *const_bitmap; +typedef unsigned long BITMAP_WORD; +typedef struct bitmap_obstack +{ + struct bitmap_element_def *elements; + struct bitmap_head_def *heads; + struct obstack obstack; +} bitmap_obstack; +typedef struct bitmap_element_def +{ + struct bitmap_element_def *next; + struct bitmap_element_def *prev; + unsigned int indx; + BITMAP_WORD bits[((128 + (8 * 8 * 1u) - 1) / (8 * 8 * 1u))]; +} bitmap_element; + +struct bitmap_descriptor; + +typedef struct bitmap_head_def { + bitmap_element *first; + bitmap_element *current; + unsigned int indx; + bitmap_obstack *obstack; +} bitmap_head; + +bitmap_element bitmap_zero_bits; + +typedef struct +{ + bitmap_element *elt1; + bitmap_element *elt2; + unsigned word_no; + BITMAP_WORD bits; +} bitmap_iterator; + +static void __attribute__((noinline)) +bmp_iter_set_init (bitmap_iterator *bi, const_bitmap map, + unsigned start_bit, unsigned *bit_no) +{ + bi->elt1 = map->first; + bi->elt2 = ((void *)0); + + while (1) + { + if (!bi->elt1) + { + bi->elt1 = &bitmap_zero_bits; + break; + } + + if (bi->elt1->indx >= start_bit / (((128 + (8 * 8 * 1u) - 1) / (8 * 8 * 1u)) * (8 * 8 * 1u))) + break; + bi->elt1 = bi->elt1->next; + } + + if (bi->elt1->indx != start_bit / (((128 + (8 * 8 * 1u) - 1) / (8 * 8 * 1u)) * (8 * 8 * 1u))) + start_bit = bi->elt1->indx * (((128 + (8 * 8 * 1u) - 1) / (8 * 8 * 1u)) * (8 * 8 * 1u)); + + bi->word_no = start_bit / (8 * 8 * 1u) % ((128 + (8 * 8 * 1u) - 1) / (8 * 8 * 1u)); + bi->bits = bi->elt1->bits[bi->word_no]; + bi->bits >>= start_bit % (8 * 8 * 1u); + + start_bit += !bi->bits; + + *bit_no = start_bit; +} + +static void __attribute__((noinline)) +bmp_iter_next (bitmap_iterator *bi, unsigned *bit_no) +{ + bi->bits >>= 1; + *bit_no += 1; +} + +static unsigned char __attribute__((noinline)) +bmp_iter_set_tail (bitmap_iterator *bi, unsigned *bit_no) +{ + while (!(bi->bits & 1)) + { + bi->bits >>= 1; + *bit_no += 1; + } + return 1; +} + +static __inline__ unsigned char +bmp_iter_set (bitmap_iterator *bi, unsigned *bit_no) +{ + unsigned bno = *bit_no; + BITMAP_WORD bits = bi->bits; + bitmap_element *elt1; + + if (bits) + { + while (!(bits & 1)) + { + bits >>= 1; + bno += 1; + } + *bit_no = bno; + return 1; + } + + *bit_no = ((bno + 64 - 1) / 64 * 64); + bi->word_no++; + + elt1 = bi->elt1; + while (1) + { + while (bi->word_no != 2) + { + bi->bits = elt1->bits[bi->word_no]; + if (bi->bits) + { + bi->elt1 = elt1; + return bmp_iter_set_tail (bi, bit_no); + } + *bit_no += 64; + bi->word_no++; + } + + elt1 = elt1->next; + if (!elt1) + { + bi->elt1 = elt1; + return 0; + } + *bit_no = elt1->indx * (2 * 64); + bi->word_no = 0; + } +} + +extern void abort (void); + +static void __attribute__((noinline)) catchme(int i) +{ + if (i != 0 && i != 64) + abort (); +} +static void __attribute__((noinline)) foobar (bitmap_head *chain) +{ + bitmap_iterator rsi; + unsigned int regno; + for (bmp_iter_set_init (&(rsi), (chain), (0), &(regno)); + bmp_iter_set (&(rsi), &(regno)); + bmp_iter_next (&(rsi), &(regno))) + catchme(regno); +} + +int main() +{ + bitmap_element elem = { (void *)0, (void *)0, 0, { 1, 1 } }; + bitmap_head live_throughout = { &elem, &elem, 0, (void *)0 }; + foobar (&live_throughout); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20090113-3.c b/gcc/testsuite/gcc.c-torture/execute/20090113-3.c new file mode 100644 index 000000000..f67bac241 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20090113-3.c @@ -0,0 +1,138 @@ +struct obstack {}; +struct bitmap_head_def; +typedef struct bitmap_head_def *bitmap; +typedef const struct bitmap_head_def *const_bitmap; +typedef unsigned long BITMAP_WORD; + +typedef struct bitmap_obstack +{ + struct bitmap_element_def *elements; + struct bitmap_head_def *heads; + struct obstack obstack; +} bitmap_obstack; +typedef struct bitmap_element_def +{ + struct bitmap_element_def *next; + struct bitmap_element_def *prev; + unsigned int indx; + BITMAP_WORD bits[(2)]; +} bitmap_element; + +struct bitmap_descriptor; + +typedef struct bitmap_head_def { + bitmap_element *first; + bitmap_element *current; + unsigned int indx; + bitmap_obstack *obstack; +} bitmap_head; + +bitmap_element bitmap_zero_bits; + +typedef struct +{ + bitmap_element *elt1; + bitmap_element *elt2; + unsigned word_no; + BITMAP_WORD bits; +} bitmap_iterator; + +static __attribute__((noinline)) void +bmp_iter_set_init (bitmap_iterator *bi, const_bitmap map, + unsigned start_bit, unsigned *bit_no) +{ + bi->elt1 = map->first; + bi->elt2 = ((void *)0); + + while (1) + { + if (!bi->elt1) + { + bi->elt1 = &bitmap_zero_bits; + break; + } + + if (bi->elt1->indx >= start_bit / (128u)) + break; + bi->elt1 = bi->elt1->next; + } + + if (bi->elt1->indx != start_bit / (128u)) + start_bit = bi->elt1->indx * (128u); + + bi->word_no = start_bit / 64u % (2); + bi->bits = bi->elt1->bits[bi->word_no]; + bi->bits >>= start_bit % 64u; + + start_bit += !bi->bits; + + *bit_no = start_bit; +} + +static __inline__ __attribute__((always_inline)) void +bmp_iter_next (bitmap_iterator *bi, unsigned *bit_no) +{ + bi->bits >>= 1; + *bit_no += 1; +} + +static __inline__ __attribute__((always_inline)) unsigned char +bmp_iter_set (bitmap_iterator *bi, unsigned *bit_no) +{ + if (bi->bits) + { + while (!(bi->bits & 1)) + { + bi->bits >>= 1; + *bit_no += 1; + } + return 1; + } + + *bit_no = ((*bit_no + 64u - 1) / 64u * 64u); + bi->word_no++; + + while (1) + { + while (bi->word_no != (2)) + { + bi->bits = bi->elt1->bits[bi->word_no]; + if (bi->bits) + { + while (!(bi->bits & 1)) + { + bi->bits >>= 1; + *bit_no += 1; + } + return 1; + } + *bit_no += 64u; + bi->word_no++; + } + + bi->elt1 = bi->elt1->next; + if (!bi->elt1) + return 0; + *bit_no = bi->elt1->indx * (128u); + bi->word_no = 0; + } +} + +static void __attribute__((noinline)) +foobar (bitmap_head *live_throughout) +{ + bitmap_iterator rsi; + unsigned int regno; + for (bmp_iter_set_init (&(rsi), (live_throughout), (0), &(regno)); + bmp_iter_set (&(rsi), &(regno)); + bmp_iter_next (&(rsi), &(regno))) + ; +} +int main() +{ + bitmap_element elem = { (void *)0, (void *)0, 0, { 1, 1 } }; + bitmap_head live_throughout = { &elem, &elem, 0, (void *)0 }; + foobar (&live_throughout); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20090207-1.c b/gcc/testsuite/gcc.c-torture/execute/20090207-1.c new file mode 100644 index 000000000..51a686028 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20090207-1.c @@ -0,0 +1,16 @@ +int foo(int i) +{ + int a[32]; + a[1] = 3; + a[0] = 1; + a[i] = 2; + return a[0]; +} +extern void abort (void); +int main() +{ + if (foo (0) != 2 + || foo (1) != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20090219-1.c b/gcc/testsuite/gcc.c-torture/execute/20090219-1.c new file mode 100644 index 000000000..a5f973f68 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20090219-1.c @@ -0,0 +1,29 @@ +/* On ARM, BAR used to get a bogus number in E due to stack + misalignment. */ + +extern void abort (void); +extern void exit (int); + +void +foo (void) +{ + int f = 0; + + void bar (int a, int b, int c, int d, int e) + { + if (e != 0) + { + f = 1; + abort (); + } + } + + bar (0, 0, 0, 0, 0); +} + +int +main (void) +{ + foo (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20090527-1.c b/gcc/testsuite/gcc.c-torture/execute/20090527-1.c new file mode 100644 index 000000000..d8e3711cd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20090527-1.c @@ -0,0 +1,38 @@ +typedef enum { POSITION_ASIS, POSITION_UNSPECIFIED } unit_position; + +typedef enum { STATUS_UNKNOWN, STATUS_UNSPECIFIED } unit_status; + +typedef struct +{ + unit_position position; + unit_status status; +} unit_flags; + +extern void abort (void); + +void +new_unit (unit_flags * flags) +{ + if (flags->status == STATUS_UNSPECIFIED) + flags->status = STATUS_UNKNOWN; + + if (flags->position == POSITION_UNSPECIFIED) + flags->position = POSITION_ASIS; + + switch (flags->status) + { + case STATUS_UNKNOWN: + break; + + default: + abort (); + } +} + +int main() +{ + unit_flags f; + f.status = STATUS_UNSPECIFIED; + new_unit (&f); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20090623-1.c b/gcc/testsuite/gcc.c-torture/execute/20090623-1.c new file mode 100644 index 000000000..09a5672cd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20090623-1.c @@ -0,0 +1,18 @@ +int * __restrict__ x; + +int foo (int y) +{ + *x = y; + return *x; +} + +extern void abort (void); + +int main() +{ + int i = 0; + x = &i; + if (foo(1) != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20090711-1.c b/gcc/testsuite/gcc.c-torture/execute/20090711-1.c new file mode 100644 index 000000000..5c3d93a37 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20090711-1.c @@ -0,0 +1,21 @@ +/* Used to be miscompiled at -O0 due to incorrect choice of sign extension + vs. zero extension. __attribute__ ((noinline)) added to try to make it + fail at higher optimization levels too. */ + +extern void abort (void); + +long long __attribute__ ((noinline)) +div (long long val) +{ + return val / 32768; +} + +int main (void) +{ + long long d1 = -990000000; + long long d2 = div(d1); + if (d2 != -30212) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20090814-1.c b/gcc/testsuite/gcc.c-torture/execute/20090814-1.c new file mode 100644 index 000000000..857393b57 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20090814-1.c @@ -0,0 +1,23 @@ +int __attribute__((noinline)) +bar (int *a) +{ + return *a; +} +int i; +int __attribute__((noinline)) +foo (int (*a)[2]) +{ + return bar (&(*a)[i]); +} + +extern void abort (void); +int a[2]; +int main() +{ + a[0] = -1; + a[1] = 42; + i = 1; + if (foo (&a) != 42) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20091229-1.c b/gcc/testsuite/gcc.c-torture/execute/20091229-1.c new file mode 100644 index 000000000..08d952f1b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20091229-1.c @@ -0,0 +1,2 @@ +long long foo(long long v) { return v / -0x080000000LL; } +void main() { if (foo(0x080000000LL) != -1) abort(); exit (0); } diff --git a/gcc/testsuite/gcc.c-torture/execute/20100209-1.c b/gcc/testsuite/gcc.c-torture/execute/20100209-1.c new file mode 100644 index 000000000..bf0597b2d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20100209-1.c @@ -0,0 +1,12 @@ +int bar(int foo) +{ + return (int)(((unsigned long long)(long long)foo) / 8); +} +extern void abort (void); +int main() +{ + if (sizeof (long long) > sizeof (int) + && bar(-1) != -1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20100316-1.c b/gcc/testsuite/gcc.c-torture/execute/20100316-1.c new file mode 100644 index 000000000..8367d7273 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20100316-1.c @@ -0,0 +1,24 @@ +struct Foo { + int i; + unsigned precision : 10; + unsigned blah : 3; +} f; + +int __attribute__((noinline,noclone)) +foo (struct Foo *p) +{ + struct Foo *q = p; + return (*q).precision; +} + +extern void abort (void); + +int main() +{ + f.i = -1; + f.precision = 0; + f.blah = -1; + if (foo (&f) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20100416-1.c b/gcc/testsuite/gcc.c-torture/execute/20100416-1.c new file mode 100644 index 000000000..8b5a6f45e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20100416-1.c @@ -0,0 +1,40 @@ +void abort(void); + +int +movegt(int x, int y, long long a) +{ + int i; + int ret = 0; + for (i = 0; i < y; i++) + { + if (a >= (long long) 0xf000000000000000LL) + ret = x; + else + ret = y; + } + return ret; +} + +struct test +{ + long long val; + int ret; +} tests[] = { + { 0xf000000000000000LL, -1 }, + { 0xefffffffffffffffLL, 1 }, + { 0xf000000000000001LL, -1 }, + { 0x0000000000000000LL, -1 }, + { 0x8000000000000000LL, 1 }, +}; + +int +main() +{ + int i; + for (i = 0; i < sizeof (tests) / sizeof (tests[0]); i++) + { + if (movegt (-1, 1, tests[i].val) != tests[i].ret) + abort (); + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20100430-1.c b/gcc/testsuite/gcc.c-torture/execute/20100430-1.c new file mode 100644 index 000000000..d29c6fa1a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20100430-1.c @@ -0,0 +1,51 @@ +/* This used to generate unaligned accesses at -O2 because of IVOPTS. */ + +struct packed_struct +{ + struct packed_struct1 + { + unsigned char cc11; + unsigned char cc12; + } __attribute__ ((packed)) pst1; + struct packed_struct2 + { + unsigned char cc21; + unsigned char cc22; + unsigned short ss[104]; + unsigned char cc23[13]; + } __attribute__ ((packed)) pst2[4]; +} __attribute__ ((packed)); + +typedef struct +{ + int ii; + struct packed_struct buf; +} info_t; + +static unsigned short g; + +static void __attribute__((noinline)) +dummy (unsigned short s) +{ + g = s; +} + +static int +foo (info_t *info) +{ + int i, j; + + for (i = 0; i < info->buf.pst1.cc11; i++) + for (j = 0; j < info->buf.pst2[i].cc22; j++) + dummy (info->buf.pst2[i].ss[j]); + + return 0; +} + +int main(void) +{ + info_t info; + info.buf.pst1.cc11 = 2; + info.buf.pst2[0].cc22 = info.buf.pst2[1].cc22 = 8; + return foo (&info); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20100708-1.c b/gcc/testsuite/gcc.c-torture/execute/20100708-1.c new file mode 100644 index 000000000..590a94a70 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20100708-1.c @@ -0,0 +1,29 @@ +/* PR middle-end/44843 */ +/* Verify that we don't use the alignment of struct S for inner accesses. */ + +struct S +{ + double for_alignment; + struct { int x, y, z; } a[16]; +}; + +void f(struct S *s) __attribute__((noinline)); + +void f(struct S *s) +{ + unsigned int i; + + for (i = 0; i < 16; ++i) + { + s->a[i].x = 0; + s->a[i].y = 0; + s->a[i].z = 0; + } +} + +int main (void) +{ + struct S s; + f (&s); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20100805-1.c b/gcc/testsuite/gcc.c-torture/execute/20100805-1.c new file mode 100644 index 000000000..5b476960e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20100805-1.c @@ -0,0 +1,15 @@ +unsigned int foo (unsigned int a, unsigned int b) +{ + unsigned i; + a = a & 1; + for (i = 0; i < b; ++i) + a = a << 1 | a >> (sizeof (unsigned int) * 8 - 1); + return a; +} +extern void abort (void); +int main() +{ + if (foo (1, sizeof (unsigned int) * 8 + 1) != 2) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20100827-1.c b/gcc/testsuite/gcc.c-torture/execute/20100827-1.c new file mode 100644 index 000000000..8a531b99b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20100827-1.c @@ -0,0 +1,23 @@ +extern void abort (void); +int __attribute__((noinline,noclone)) +foo (char *p) +{ + int h = 0; + do + { + if (*p == '\0') + break; + ++h; + if (p == 0) + abort (); + ++p; + } + while (1); + return h; +} +int main() +{ + if (foo("a") != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20101011-1.c b/gcc/testsuite/gcc.c-torture/execute/20101011-1.c new file mode 100644 index 000000000..7180e68b0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20101011-1.c @@ -0,0 +1,58 @@ +/* With -fnon-call-exceptions 0 / 0 should not be eliminated. The .x + file sets the option. */ + +#ifdef SIGNAL_SUPPRESS +# define DO_TEST 0 +#elif defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) || defined (__POWERPC__) || defined (__ppc) + /* On PPC division by zero does not trap. */ +# define DO_TEST 0 +#elif defined (__SPU__) + /* On SPU division by zero does not trap. */ +# define DO_TEST 0 +#elif defined (__sh__) + /* On SH division by zero does not trap. */ +# define DO_TEST 0 +#elif defined (__mips__) && !defined(__linux__) + /* MIPS divisions do trap by default, but libgloss targets do not + intercept the trap and raise a SIGFPE. The same is probably + true of other bare-metal environments, so restrict the test to + systems that use the Linux kernel. */ +# define DO_TEST 0 +#elif defined (__mips16) && defined(__linux__) + /* Not all Linux kernels deal correctly the breakpoints generated by + MIPS16 divisions by zero. They show up as a SIGTRAP instead. */ +# define DO_TEST 0 +#else +# define DO_TEST 1 +#endif + +#if DO_TEST + +#include + +void +sigfpe (int signum __attribute__ ((unused))) +{ + exit (0); +} + +#endif + +/* When optimizing, the compiler is smart enough to constant fold the + static unset variables i and j to produce 0 / 0, but it can't + eliminate the assignment to the global k. */ +static int i; +static int j; +int k; + +int +main () +{ +#if DO_TEST + signal (SIGFPE, sigfpe); + k = i / j; + abort (); +#else + exit (0); +#endif +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20101011-1.x b/gcc/testsuite/gcc.c-torture/execute/20101011-1.x new file mode 100644 index 000000000..b5c080dd3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20101011-1.x @@ -0,0 +1,2 @@ +set additional_flags "-fnon-call-exceptions" +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/20101013-1.c b/gcc/testsuite/gcc.c-torture/execute/20101013-1.c new file mode 100644 index 000000000..7d477aff0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20101013-1.c @@ -0,0 +1,36 @@ +/* PR rtl-optimization/45912 */ + +extern void abort (void); + +static void* __attribute__((noinline,noclone)) +get_addr_base_and_unit_offset (void *base, long long *i) +{ + *i = 0; + return base; +} + +static void* __attribute__((noinline,noclone)) +build_int_cst (void *base, long long offset) +{ + if (offset != 4) + abort (); + + return base; +} + +static void* __attribute__((noinline,noclone)) +build_ref_for_offset (void *base, long long offset) +{ + long long base_offset; + base = get_addr_base_and_unit_offset (base, &base_offset); + return build_int_cst (base, base_offset + offset / 8); +} + +int +main (void) +{ + void *ret = build_ref_for_offset ((void *)0, 32); + if (ret != (void *)0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20101025-1.c b/gcc/testsuite/gcc.c-torture/execute/20101025-1.c new file mode 100644 index 000000000..95361a924 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20101025-1.c @@ -0,0 +1,30 @@ +static int g_7; +static int *volatile g_6 = &g_7; +int g_3; + +static int f1 (int *p_58) +{ + return *p_58; +} + +void f2 (int i) __attribute__ ((noinline)); +void f2 (int i) +{ + g_3 = i; +} + +int f3 (void) __attribute__ ((noinline)); +int f3 (void) +{ + *g_6 = 1; + f2 (f1 (&g_7)); + return 0; +} + +int main () +{ + f3 (); + if (g_3 != 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20111208-1.c b/gcc/testsuite/gcc.c-torture/execute/20111208-1.c new file mode 100644 index 000000000..8bcb10acc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20111208-1.c @@ -0,0 +1,94 @@ +/* PR tree-optimization/51315 */ +/* Reported by Jurij Smakov */ + +typedef unsigned int size_t; + +extern void *memcpy (void *__restrict __dest, + __const void *__restrict __src, size_t __n) + __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strlen (__const char *__s) + __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + +typedef short int int16_t; +typedef int int32_t; + +extern void abort (void); + +int a; + +static void __attribute__ ((noinline,noclone)) +do_something (int item) +{ + a = item; +} + +int +pack_unpack (char *s, char *p) +{ + char *send, *pend; + char type; + int integer_size; + + send = s + strlen (s); + pend = p + strlen (p); + + while (p < pend) + { + type = *p++; + + switch (type) + { + case 's': + integer_size = 2; + goto unpack_integer; + + case 'l': + integer_size = 4; + goto unpack_integer; + + unpack_integer: + switch (integer_size) + { + case 2: + { + union + { + int16_t i; + char a[sizeof (int16_t)]; + } + v; + memcpy (v.a, s, sizeof (int16_t)); + s += sizeof (int16_t); + do_something (v.i); + } + break; + + case 4: + { + union + { + int32_t i; + char a[sizeof (int32_t)]; + } + v; + memcpy (v.a, s, sizeof (int32_t)); + s += sizeof (int32_t); + do_something (v.i); + } + break; + } + break; + } + } + return (int) *s; +} + +int +main (void) +{ + int n = pack_unpack ("\200\001\377\376\035\300", "sl"); + if (n != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20111212-1.c b/gcc/testsuite/gcc.c-torture/execute/20111212-1.c new file mode 100644 index 000000000..c46e6e946 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20111212-1.c @@ -0,0 +1,34 @@ +/* PR tree-optimization/50569 */ +/* Reported by Paul Koning */ +/* Reduced testcase by Mikael Pettersson */ + +struct event { + struct { + unsigned int sec; + } sent __attribute__((packed)); +}; + +void __attribute__((noinline,noclone)) frob_entry(char *buf) +{ + struct event event; + + __builtin_memcpy(&event, buf, sizeof(event)); + if (event.sent.sec < 64) { + event.sent.sec = -1U; + __builtin_memcpy(buf, &event, sizeof(event)); + } +} + +int main(void) +{ + union { + char buf[1 + sizeof(struct event)]; + int align; + } u; + + __builtin_memset(&u, 0, sizeof u); + + frob_entry(&u.buf[1]); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20120105-1.c b/gcc/testsuite/gcc.c-torture/execute/20120105-1.c new file mode 100644 index 000000000..115ba1509 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20120105-1.c @@ -0,0 +1,24 @@ +struct __attribute__((packed)) S +{ + int a, b, c; +}; + +static int __attribute__ ((noinline,noclone)) +extract(const char *p) +{ + struct S s; + __builtin_memcpy (&s, p, sizeof(struct S)); + return s.a; +} + +volatile int i; + +int main (void) +{ + char p[sizeof(struct S) + 1]; + + __builtin_memset (p, 0, sizeof(struct S) + 1); + i = extract (p + 1); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20120111-1.c b/gcc/testsuite/gcc.c-torture/execute/20120111-1.c new file mode 100644 index 000000000..eac086e3b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20120111-1.c @@ -0,0 +1,18 @@ +#include +#include + +uint32_t f0a (uint64_t arg2) __attribute__((noinline)); + +uint32_t +f0a (uint64_t arg) +{ + return ~(arg > -3); +} + +int main() { + uint32_t r1; + r1 = f0a (12094370573988097329ULL); + if (r1 != ~0U) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20120207-1.c b/gcc/testsuite/gcc.c-torture/execute/20120207-1.c new file mode 100644 index 000000000..c4716aeca --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20120207-1.c @@ -0,0 +1,27 @@ +/* PR middle-end/51994 */ +/* Testcase by Uros Bizjak */ + +extern char *strcpy (char *, const char *); +extern void abort (void); + +char __attribute__((noinline)) +test (int a) +{ + char buf[16]; + char *output = buf; + + strcpy (&buf[0], "0123456789"); + + output += a; + output -= 1; + + return output[0]; +} + +int main () +{ + if (test (2) != '1') + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20120427-1.c b/gcc/testsuite/gcc.c-torture/execute/20120427-1.c new file mode 100644 index 000000000..46ed76ae9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20120427-1.c @@ -0,0 +1,36 @@ +typedef struct sreal +{ + unsigned sig; /* Significant. */ + int exp; /* Exponent. */ +} sreal; + +sreal_compare (sreal *a, sreal *b) +{ + if (a->exp > b->exp) + return 1; + if (a->exp < b->exp) + return -1; + if (a->sig > b->sig) + return 1; + return -(a->sig < b->sig); +} + +sreal a[] = { + { 0, 0 }, + { 1, 0 }, + { 0, 1 }, + { 1, 1 } +}; + +int main() +{ + int i, j; + for (i = 0; i <= 3; i++) { + for (j = 0; j < 3; j++) { + if (i < j && sreal_compare(&a[i], &a[j]) != -1) abort(); + if (i == j && sreal_compare(&a[i], &a[j]) != 0) abort(); + if (i > j && sreal_compare(&a[i], &a[j]) != 1) abort(); + } + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/900409-1.c b/gcc/testsuite/gcc.c-torture/execute/900409-1.c new file mode 100644 index 000000000..3112effaf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/900409-1.c @@ -0,0 +1,20 @@ +long f1(long a){return a&0xff000000L;} +long f2 (long a){return a&~0xff000000L;} +long f3(long a){return a&0x000000ffL;} +long f4(long a){return a&~0x000000ffL;} +long f5(long a){return a&0x0000ffffL;} +long f6(long a){return a&~0x0000ffffL;} + +main () +{ + long a = 0x89ABCDEF; + + if (f1(a)!=0x89000000L|| + f2(a)!=0x00ABCDEFL|| + f3(a)!=0x000000EFL|| + f4(a)!=0x89ABCD00L|| + f5(a)!=0x0000CDEFL|| + f6(a)!=0x89AB0000L) + abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/920202-1.c b/gcc/testsuite/gcc.c-torture/execute/920202-1.c new file mode 100644 index 000000000..e30ce2fd5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920202-1.c @@ -0,0 +1,18 @@ +static int rule_text_needs_stack_pop = 0; +static int input_stack_pos = 1; + +f (void) +{ + rule_text_needs_stack_pop = 1; + + if (input_stack_pos <= 0) + return 1; + else + return 0; +} + +main () +{ + f (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/920302-1.c b/gcc/testsuite/gcc.c-torture/execute/920302-1.c new file mode 100644 index 000000000..44a1e9b67 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920302-1.c @@ -0,0 +1,42 @@ +short optab[5]; +char buf[10]; +execute (ip) + register short *ip; +{ +#ifndef NO_LABEL_VALUES + register void *base = &&x; + char *bp = buf; + static void *tab[] = {&&x, &&y, &&z}; + if (ip == 0) + { + int i; + for (i = 0; i < 3; ++i) + optab[i] = (short)(tab[i] - base); + return; + } +x: *bp++='x'; + goto *(base + *ip++); +y: *bp++='y'; + goto *(base + *ip++); +z: *bp++='z'; + *bp=0; + return; +#else + strcpy (buf, "xyxyz"); +#endif +} + +short p[5]; + +main () +{ + execute ((short *) 0); + p[0] = optab[1]; + p[1] = optab[0]; + p[2] = optab[1]; + p[3] = optab[2]; + execute (&p); + if (strcmp (buf, "xyxyz")) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/920409-1.c b/gcc/testsuite/gcc.c-torture/execute/920409-1.c new file mode 100644 index 000000000..938ce7d92 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920409-1.c @@ -0,0 +1 @@ +x(){signed char c=-1;return c<0;}main(){if(x()!=1)abort();exit(0);} diff --git a/gcc/testsuite/gcc.c-torture/execute/920410-1.c b/gcc/testsuite/gcc.c-torture/execute/920410-1.c new file mode 100644 index 000000000..f5180f06a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920410-1.c @@ -0,0 +1,6 @@ +#define STACK_REQUIREMENT (40000 * 4 + 256) +#if defined (STACK_SIZE) && STACK_SIZE < STACK_REQUIREMENT +main () { exit (0); } +#else +main(){int d[40000];d[0]=0;exit(0);} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/920411-1.c b/gcc/testsuite/gcc.c-torture/execute/920411-1.c new file mode 100644 index 000000000..e3e981001 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920411-1.c @@ -0,0 +1,24 @@ +long f (w) + char *w; +{ + long k, i, c = 0, x; + char *p = (char*) &x; + for (i = 0; i < 1; i++) + { + for (k = 0; k < sizeof (long); k++) + p[k] = w[k]; + c += x; + } + return c; +} + +main () +{ + int i; + char a[sizeof (long)]; + + for (i = sizeof (long); --i >= 0;) a[i] = ' '; + if (f (a) != ~0UL / (unsigned char) ~0 * ' ') + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/920415-1.c b/gcc/testsuite/gcc.c-torture/execute/920415-1.c new file mode 100644 index 000000000..2d6335aea --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920415-1.c @@ -0,0 +1,5 @@ +#ifndef NO_LABEL_VALUES +main(){__label__ l;void*x(){return&&l;}goto*x();abort();return;l:exit(0);} +#else +main(){ exit (0); } +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/920428-1.c b/gcc/testsuite/gcc.c-torture/execute/920428-1.c new file mode 100644 index 000000000..154af763a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920428-1.c @@ -0,0 +1,2 @@ +x(const char*s){char a[1];const char*ss=s;a[*s++]|=1;return(int)ss+1==(int)s;} +main(){if(x("")!=1)abort();exit(0);} diff --git a/gcc/testsuite/gcc.c-torture/execute/920428-2.c b/gcc/testsuite/gcc.c-torture/execute/920428-2.c new file mode 100644 index 000000000..f8c2e5f78 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920428-2.c @@ -0,0 +1,7 @@ +#if !defined (NO_LABEL_VALUES) && !defined (NO_TRAMPOLINES) +s(i){if(i>0){__label__ l1;int f(int i){if(i==2)goto l1;return 0;}return f(i);l1:;}return 1;} +x(){return s(0)==1&&s(1)==0&&s(2)==1;} +main(){if(x()!=1)abort();exit(0);} +#else +main(){ exit (0); } +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/920429-1.c b/gcc/testsuite/gcc.c-torture/execute/920429-1.c new file mode 100644 index 000000000..f37bf68bd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920429-1.c @@ -0,0 +1,3 @@ +typedef unsigned char t;int i,j; +t*f(t*p){t c;c=*p++;i=((c&2)?1:0);j=(c&7)+1;return p;} +main(){t*p0="ab",*p1;p1=f(p0);if(p0+1!=p1)abort();exit(0);} diff --git a/gcc/testsuite/gcc.c-torture/execute/920501-1.c b/gcc/testsuite/gcc.c-torture/execute/920501-1.c new file mode 100644 index 000000000..6f757cac5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920501-1.c @@ -0,0 +1,3 @@ +int s[2]; +x(){if(!s[0]){s[1+s[1]]=s[1];return 1;}} +main(){s[0]=s[1]=0;if(x(0)!=1)abort();exit(0);} diff --git a/gcc/testsuite/gcc.c-torture/execute/920501-2.c b/gcc/testsuite/gcc.c-torture/execute/920501-2.c new file mode 100644 index 000000000..d99eef289 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920501-2.c @@ -0,0 +1,114 @@ +unsigned long +gcd_ll (unsigned long long x, unsigned long long y) +{ + for (;;) + { + if (y == 0) + return (unsigned long) x; + x = x % y; + if (x == 0) + return (unsigned long) y; + y = y % x; + } +} + +unsigned long long +powmod_ll (unsigned long long b, unsigned e, unsigned long long m) +{ + unsigned t; + unsigned long long pow; + int i; + + if (e == 0) + return 1; + + /* Find the most significant bit in E. */ + t = e; + for (i = 0; t != 0; i++) + t >>= 1; + + /* The most sign bit in E is handled outside of the loop, by beginning + with B in POW, and decrementing I. */ + pow = b; + i -= 2; + + for (; i >= 0; i--) + { + pow = pow * pow % m; + if ((1 << i) & e) + pow = pow * b % m; + } + + return pow; +} + +unsigned long factab[10]; + +void +facts (t, a_int, x0, p) + unsigned long long t; + int a_int; + int x0; + unsigned p; +{ + unsigned long *xp = factab; + unsigned long long x, y; + unsigned long q = 1; + unsigned long long a = a_int; + int i; + unsigned long d; + int j = 1; + unsigned long tmp; + int jj = 0; + + x = x0; + y = x0; + + for (i = 1; i < 10000; i++) + { + x = powmod_ll (x, p, t) + a; + y = powmod_ll (y, p, t) + a; + y = powmod_ll (y, p, t) + a; + + if (x > y) + tmp = x - y; + else + tmp = y - x; + q = (unsigned long long) q * tmp % t; + + if (i == j) + { + jj += 1; + j += jj; + d = gcd_ll (q, t); + if (d != 1) + { + *xp++ = d; + t /= d; + if (t == 1) + { + return; + *xp = 0; + } + } + } + } +} + +main () +{ + unsigned long long t; + unsigned x0, a; + unsigned p; + + p = 27; + t = (1ULL << p) - 1; + + a = -1; + x0 = 3; + + facts (t, a, x0, p); + if (factab[0] != 7 || factab[1] != 73 || factab[2] != 262657) + abort(); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/920501-3.c b/gcc/testsuite/gcc.c-torture/execute/920501-3.c new file mode 100644 index 000000000..1031d7378 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920501-3.c @@ -0,0 +1,35 @@ +int tab[9]; +execute(oip, ip) + unsigned short *oip, *ip; +{ +#ifndef NO_LABEL_VALUES + int x = 0; + int *xp = tab; +base: + x++; + if (x == 4) + { + *xp = 0; + return; + } + *xp++ = ip - oip; + goto *(&&base + *ip++); +#else + tab[0] = 0; + tab[1] = 1; + tab[2] = 2; + tab[3] = 0; +#endif +} + +main() +{ + unsigned short ip[10]; + int i; + for (i = 0; i < 10; i++) + ip[i] = 0; + execute(ip, ip); + if (tab[0] != 0 || tab[1] != 1 || tab[2] != 2 || tab[3] != 0) + abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/920501-4.c b/gcc/testsuite/gcc.c-torture/execute/920501-4.c new file mode 100644 index 000000000..3524dd5c8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920501-4.c @@ -0,0 +1,27 @@ +#ifndef NO_LABEL_VALUES +int +x (int i) +{ + static const void *j[] = {&& x, && y, && z}; + + goto *j[i]; + + x: return 2; + y: return 3; + z: return 5; +} + +int +main (void) +{ + if ( x (0) != 2 + || x (1) != 3 + || x (2) != 5) + abort (); + + exit (0); +} +#else +int +main (void) { exit (0); } +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/920501-5.c b/gcc/testsuite/gcc.c-torture/execute/920501-5.c new file mode 100644 index 000000000..e352a9155 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920501-5.c @@ -0,0 +1,19 @@ +#ifndef NO_LABEL_VALUES +x (int i) +{ + void *j[] = {&&x, &&y, &&z}; + goto *j[i]; + x:return 2; + y:return 3; + z:return 5; + +} +main () +{ + if (x (0) != 2 || x (1) != 3 || x (2) != 5) + abort(); + exit(0); +} +#else +main(){ exit (0); } +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/920501-6.c b/gcc/testsuite/gcc.c-torture/execute/920501-6.c new file mode 100644 index 000000000..833624ff3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920501-6.c @@ -0,0 +1,91 @@ +#include + +/* Convert a decimal string to a long long unsigned. No error check is + performed. */ + +long long unsigned +str2llu (str) + char *str; +{ + long long unsigned acc; + int d; + acc = *str++ - '0'; + for (;;) + { + d = *str++; + if (d == '\0') + break; + d -= '0'; + acc = acc * 10 + d; + } + + return acc; +} + +/* isqrt(t) - computes the square root of t. (tege 86-10-27) */ + +long unsigned +sqrtllu (long long unsigned t) +{ + long long unsigned s; + long long unsigned b; + + for (b = 0, s = t; b++, (s >>= 1) != 0; ) + ; + + s = 1LL << (b >> 1); + + if (b & 1) + s += s >> 1; + + do + { + b = t / s; + s = (s + b) >> 1; + } + while (b < s); + + return s; +} + + +int plist (p0, p1, tab) + long long unsigned p0, p1; + long long unsigned *tab; +{ + long long unsigned p; + long unsigned d; + long unsigned s; + long long unsigned *xp = tab; + + for (p = p0; p <= p1; p += 2) + { + s = sqrtllu (p); + + for (d = 3; d <= s; d += 2) + { + long long unsigned q = p % d; + if (q == 0) + goto not_prime; + } + + *xp++ = p; + not_prime:; + } + *xp = 0; + return xp - tab; +} + +main (argc, argv) + int argc; + char *argv[]; +{ + long long tab[10]; + int nprimes; + nprimes = plist (str2llu ("1234111111"), str2llu ("1234111127"), tab); + + if(tab[0]!=1234111117LL||tab[1]!=1234111121LL||tab[2]!=1234111127LL||tab[3]!=0) + abort(); + + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/920501-7.c b/gcc/testsuite/gcc.c-torture/execute/920501-7.c new file mode 100644 index 000000000..c23717d79 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920501-7.c @@ -0,0 +1,30 @@ +#ifdef STACK_SIZE +#define DEPTH ((STACK_SIZE) / 512 + 1) +#else +#define DEPTH 1000 +#endif + +#if ! defined (NO_LABEL_VALUES) && !defined (NO_TRAMPOLINES) +x(a) +{ + __label__ xlab; + void y(a) + { + if (a==0) + goto xlab; + y (a-1); + } + y (a); + xlab:; + return a; +} +#endif + +main () +{ +#if ! defined (NO_LABEL_VALUES) && !defined (NO_TRAMPOLINES) + if (x (DEPTH) != DEPTH) + abort (); +#endif + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/920501-8.c b/gcc/testsuite/gcc.c-torture/execute/920501-8.c new file mode 100644 index 000000000..62780a08c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920501-8.c @@ -0,0 +1,38 @@ +#include +#include + +char buf[50]; +int +va (int a, double b, int c, ...) +{ + va_list ap; + int d, e, f, g, h, i, j, k, l, m, n, o, p; + va_start (ap, c); + + d = va_arg (ap, int); + e = va_arg (ap, int); + f = va_arg (ap, int); + g = va_arg (ap, int); + h = va_arg (ap, int); + i = va_arg (ap, int); + j = va_arg (ap, int); + k = va_arg (ap, int); + l = va_arg (ap, int); + m = va_arg (ap, int); + n = va_arg (ap, int); + o = va_arg (ap, int); + p = va_arg (ap, int); + + sprintf (buf, + "%d,%f,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", + a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p); + va_end (ap); +} + +main() +{ + va (1, 1.0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + if (strcmp ("1,1.000000,2,3,4,5,6,7,8,9,10,11,12,13,14,15", buf)) + abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/920501-8.x b/gcc/testsuite/gcc.c-torture/execute/920501-8.x new file mode 100644 index 000000000..f675fb66d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920501-8.x @@ -0,0 +1,5 @@ +# sprintf() does not support %f on m6811/m6812 target. +if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"]} { + return 1 +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/920501-9.c b/gcc/testsuite/gcc.c-torture/execute/920501-9.c new file mode 100644 index 000000000..f585ac6e0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920501-9.c @@ -0,0 +1,27 @@ +#include + +long long proc1(){return 1LL;} +long long proc2(){return 0x12345678LL;} +long long proc3(){return 0xaabbccdd12345678LL;} +long long proc4(){return -1LL;} +long long proc5(){return 0xaabbccddLL;} + +print_longlong(x,buf) + long long x; + char *buf; +{ + unsigned long l; + l= (x >> 32) & 0xffffffff; + if (l != 0) + sprintf(buf,"%lx%08.lx",l,((unsigned long)x & 0xffffffff)); + else + sprintf(buf,"%lx",((unsigned long)x & 0xffffffff)); +} + +main(){char buf[100]; +print_longlong(proc1(),buf);if(strcmp("1",buf))abort(); +print_longlong(proc2(),buf);if(strcmp("12345678",buf))abort(); +print_longlong(proc3(),buf);if(strcmp("aabbccdd12345678",buf))abort(); +print_longlong(proc4(),buf);if(strcmp("ffffffffffffffff",buf))abort(); +print_longlong(proc5(),buf);if(strcmp("aabbccdd",buf))abort(); +exit(0);} diff --git a/gcc/testsuite/gcc.c-torture/execute/920506-1.c b/gcc/testsuite/gcc.c-torture/execute/920506-1.c new file mode 100644 index 000000000..9a646a30f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920506-1.c @@ -0,0 +1,2 @@ +int l[]={0,1}; +main(){int*p=l;switch(*p++){case 0:exit(0);case 1:break;case 2:break;case 3:case 4:break;}abort();} diff --git a/gcc/testsuite/gcc.c-torture/execute/920520-1.c b/gcc/testsuite/gcc.c-torture/execute/920520-1.c new file mode 100644 index 000000000..068a12e92 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920520-1.c @@ -0,0 +1,36 @@ +foo(int *bar) +{ + *bar = 8; +} + +bugger() +{ + int oldDepth, newDepth; + + foo(&oldDepth); + + switch (oldDepth) + { + case 8: + case 500: + newDepth = 8; + break; + + case 5000: + newDepth = 500; + break; + + default: + newDepth = 17; + break; + } + + return newDepth - oldDepth; +} + +main() +{ + if (bugger() != 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/920603-1.c b/gcc/testsuite/gcc.c-torture/execute/920603-1.c new file mode 100644 index 000000000..bd27ca619 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920603-1.c @@ -0,0 +1,2 @@ +f(got){if(got!=0xffff)abort();} +main(){signed char c=-1;unsigned u=(unsigned short)c;f(u);exit(0);} diff --git a/gcc/testsuite/gcc.c-torture/execute/920604-1.c b/gcc/testsuite/gcc.c-torture/execute/920604-1.c new file mode 100644 index 000000000..d7d9be13f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920604-1.c @@ -0,0 +1,13 @@ +long long +mod (a, b) + long long a, b; +{ + return a % b; +} + +int +main () +{ + mod (1LL, 2LL); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/920612-1.c b/gcc/testsuite/gcc.c-torture/execute/920612-1.c new file mode 100644 index 000000000..a70c0d2e0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920612-1.c @@ -0,0 +1,2 @@ +f(j)int j;{return++j>0;} +main(){if(f((~0U)>>1))abort();exit(0);} diff --git a/gcc/testsuite/gcc.c-torture/execute/920612-2.c b/gcc/testsuite/gcc.c-torture/execute/920612-2.c new file mode 100644 index 000000000..9bbdce2e0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920612-2.c @@ -0,0 +1,15 @@ +main () +{ + int i = 0; + int a (int x) + { + while (x) + i++, x--; + return x; + } +#ifndef NO_TRAMPOLINES + if (a (2) != 0) + abort (); +#endif + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/920618-1.c b/gcc/testsuite/gcc.c-torture/execute/920618-1.c new file mode 100644 index 000000000..224f72089 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920618-1.c @@ -0,0 +1 @@ +main(){if(1.17549435e-38F<=1.1)exit(0);abort();} diff --git a/gcc/testsuite/gcc.c-torture/execute/920625-1.c b/gcc/testsuite/gcc.c-torture/execute/920625-1.c new file mode 100644 index 000000000..ae2f415de --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920625-1.c @@ -0,0 +1,38 @@ +#include + +typedef struct{double x,y;}point; +point pts[]={{1.0,2.0},{3.0,4.0},{5.0,6.0},{7.0,8.0}}; +static int va1(int nargs,...) +{ + va_list args; + int i; + point pi; + va_start(args,nargs); + for(i=0;i 1.84467440737096e+19) + abort(); + + if (16777217L != (float)16777217e0) + abort(); + + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/920710-1.x b/gcc/testsuite/gcc.c-torture/execute/920710-1.x new file mode 100644 index 000000000..b7612f787 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920710-1.x @@ -0,0 +1,6 @@ +# h8300 does not have long long +if { [istarget "h8300-*-*"] } { + return 1; +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/920711-1.c b/gcc/testsuite/gcc.c-torture/execute/920711-1.c new file mode 100644 index 000000000..aa83452da --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920711-1.c @@ -0,0 +1,2 @@ +f(long a){return (--a > 0);} +main(){if(f(0x80000000L)==0)abort();exit(0);} diff --git a/gcc/testsuite/gcc.c-torture/execute/920721-1.c b/gcc/testsuite/gcc.c-torture/execute/920721-1.c new file mode 100644 index 000000000..086b5463f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920721-1.c @@ -0,0 +1,2 @@ +long f(short a,short b){return (long)a/b;} +main(){if(f(-32768,-1)!=32768L)abort();else exit(0);} diff --git a/gcc/testsuite/gcc.c-torture/execute/920721-2.c b/gcc/testsuite/gcc.c-torture/execute/920721-2.c new file mode 100644 index 000000000..ed4e0bf87 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920721-2.c @@ -0,0 +1,2 @@ +f(){} +main(){int n=2;double x[n];f();exit(0);} diff --git a/gcc/testsuite/gcc.c-torture/execute/920721-3.c b/gcc/testsuite/gcc.c-torture/execute/920721-3.c new file mode 100644 index 000000000..61f605d0a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920721-3.c @@ -0,0 +1,26 @@ +static inline fu (unsigned short data) +{ + return data; +} +ru(i) +{ + if(fu(i++)!=5)abort(); + if(fu(++i)!=7)abort(); +} +static inline fs (signed short data) +{ + return data; +} +rs(i) +{ + if(fs(i++)!=5)abort(); + if(fs(++i)!=7)abort(); +} + + +main() +{ + ru(5); + rs(5); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/920721-4.c b/gcc/testsuite/gcc.c-torture/execute/920721-4.c new file mode 100644 index 000000000..3cccc5b30 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920721-4.c @@ -0,0 +1,60 @@ +#ifndef NO_LABEL_VALUES +int try (int num) { + __label__ lab1, lab2, lab3, lab4, lab5, lab6, default_lab; + + void *do_switch (int num) { + switch(num) { + case 1: + return &&lab1; + case 2: + return &&lab2; + case 3: + return &&lab3; + case 4: + return &&lab4; + case 5: + return &&lab5; + case 6: + return &&lab6; + default: + return &&default_lab; + } + } + + goto *do_switch (num); + + lab1: + return 1; + + lab2: + return 2; + + lab3: + return 3; + + lab4: + return 4; + + lab5: + return 5; + + lab6: + return 6; + + default_lab: + return -1; +} + +main() +{ + int i; + for (i = 1; i <= 6; i++) + { + if (try (i) != i) + abort(); + } + exit(0); +} +#else +main(){ exit (0); } +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/920726-1.c b/gcc/testsuite/gcc.c-torture/execute/920726-1.c new file mode 100644 index 000000000..d6042c9f5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920726-1.c @@ -0,0 +1,63 @@ +#include +#include + +struct spurious +{ + int anumber; +}; + +int first(char *buf, char *fmt, ...) +{ + int pos, number; + va_list args; + int dummy; + char *bp = buf; + + va_start(args, fmt); + for (pos = 0; fmt[pos]; pos++) + if (fmt[pos] == 'i') + { + number = va_arg(args, int); + sprintf(bp, "%d", number); + bp += strlen(bp); + } + else + *bp++ = fmt[pos]; + + va_end(args); + *bp = 0; + return dummy; +} + +struct spurious second(char *buf,char *fmt, ...) +{ + int pos, number; + va_list args; + struct spurious dummy; + char *bp = buf; + + va_start(args, fmt); + for (pos = 0; fmt[pos]; pos++) + if (fmt[pos] == 'i') + { + number = va_arg(args, int); + sprintf(bp, "%d", number); + bp += strlen(bp); + } + else + *bp++ = fmt[pos]; + + va_end(args); + *bp = 0; + return dummy; +} + +main() +{ + char buf1[100], buf2[100]; + first(buf1, "i i ", 5, 20); + second(buf2, "i i ", 5, 20); + if (strcmp ("5 20 ", buf1) || strcmp ("5 20 ", buf2)) + abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/920728-1.c b/gcc/testsuite/gcc.c-torture/execute/920728-1.c new file mode 100644 index 000000000..7a2968b71 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920728-1.c @@ -0,0 +1,24 @@ +typedef struct {int dims[0]; } *A; + +f(unsigned long obj) +{ + unsigned char y = obj >> 24; + y &= ~4; + + if ((y==0)||(y!=251 )) + abort(); + + if(((int)obj&7)!=7)return; + + REST_OF_CODE_JUST_HERE_TO_TRIGGER_THE_BUG: + + { + unsigned char t = obj >> 24; + if (!(t==0)&&(t<=0x03)) + return 0; + return ((A)(obj&0x00FFFFFFL))->dims[1]; + } +} + +long g(){return 0xff000000L;} +main (){int x;f(g());exit(0);} diff --git a/gcc/testsuite/gcc.c-torture/execute/920730-1.c b/gcc/testsuite/gcc.c-torture/execute/920730-1.c new file mode 100644 index 000000000..576e7a6e8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920730-1.c @@ -0,0 +1,32 @@ +/* 920730-1.c */ +#include +f1() +{ + int b=INT_MIN; + return b>=INT_MIN; +} + +f2() +{ + int b=INT_MIN+1; + return b>= (unsigned)(INT_MAX+2); +} + +f3() +{ + int b=INT_MAX; + return b>=INT_MAX; +} + +f4() +{ + int b=-1; + return b>=UINT_MAX; +} + +main () +{ + if((f1()&f2()&f3()&f4())!=1) + abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/920731-1.c b/gcc/testsuite/gcc.c-torture/execute/920731-1.c new file mode 100644 index 000000000..de0fb58fc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920731-1.c @@ -0,0 +1,2 @@ +f(x){int i;for(i=0;i<8&&(x&1)==0;x>>=1,i++);return i;} +main(){if(f(4)!=2)abort();exit(0);} diff --git a/gcc/testsuite/gcc.c-torture/execute/920810-1.c b/gcc/testsuite/gcc.c-torture/execute/920810-1.c new file mode 100644 index 000000000..9565bfc1a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920810-1.c @@ -0,0 +1,23 @@ +#include +#include +#include + +typedef struct{void*super;int name;int size;}t; +t*f(t*clas,int size) +{ + t*child=(t*)malloc(size); + memcpy(child,clas,clas->size); + child->super=clas; + child->name=0; + child->size=size; + return child; +} +main() +{ + t foo,*bar; + memset(&foo,37,sizeof(t)); + foo.size=sizeof(t); + bar=f(&foo,sizeof(t)); + if(bar->super!=&foo||bar->name!=0||bar->size!=sizeof(t))abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/920812-1.c b/gcc/testsuite/gcc.c-torture/execute/920812-1.c new file mode 100644 index 000000000..b49ab425b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920812-1.c @@ -0,0 +1,3 @@ +typedef int t; +f(t y){switch(y){case 1:return 1;}return 0;} +main(){if(f((t)1)!=1)abort();exit(0);} diff --git a/gcc/testsuite/gcc.c-torture/execute/920829-1.c b/gcc/testsuite/gcc.c-torture/execute/920829-1.c new file mode 100644 index 000000000..ed2c2271c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920829-1.c @@ -0,0 +1,2 @@ +long long c=2863311530LL,c3=2863311530LL*3; +main(){if(c*3!=c3)abort();exit(0);} diff --git a/gcc/testsuite/gcc.c-torture/execute/920908-1.c b/gcc/testsuite/gcc.c-torture/execute/920908-1.c new file mode 100644 index 000000000..98fbb5eaa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920908-1.c @@ -0,0 +1,28 @@ +/* REPRODUCED:RUN:SIGNAL MACHINE:mips OPTIONS: */ + +#include + +typedef struct{int A;}T; + +T f(int x,...) +{ +va_list ap; +T X; +va_start(ap,x); +X=va_arg(ap,T); +if(X.A!=10)abort(); +X=va_arg(ap,T); +if(X.A!=20)abort(); +va_end(ap); +return X; +} + +main() +{ +T X,Y; +int i; +X.A=10; +Y.A=20; +f(2,X,Y); +exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/920908-2.c b/gcc/testsuite/gcc.c-torture/execute/920908-2.c new file mode 100644 index 000000000..31c1ae076 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920908-2.c @@ -0,0 +1,33 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int +main (void) +{ + exit (0); +} +#else +/* +CONF:m68k-sun-sunos4.1.1 +OPTIONS:-O +*/ +struct T +{ +unsigned i:8; +unsigned c:24; +}; +f(struct T t) +{ +struct T s[1]; +s[0]=t; +return(char)s->c; +} +main() +{ +struct T t; +t.i=0xff; +t.c=0xffff11; +if(f(t)!=0x11)abort(); +exit(0); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/920909-1.c b/gcc/testsuite/gcc.c-torture/execute/920909-1.c new file mode 100644 index 000000000..c8880348c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920909-1.c @@ -0,0 +1,2 @@ +f(a){switch(a){case 0x402:return a+1;case 0x403:return a+2;case 0x404:return a+3;case 0x405:return a+4;case 0x406:return 1;case 0x407:return 4;}return 0;} +main(){if(f(1))abort();exit(0);} diff --git a/gcc/testsuite/gcc.c-torture/execute/920922-1.c b/gcc/testsuite/gcc.c-torture/execute/920922-1.c new file mode 100644 index 000000000..4fae192bb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920922-1.c @@ -0,0 +1,14 @@ +unsigned long* +f(p)unsigned long*p; +{ + unsigned long a = (*p++) >> 24; + return p + a; +} + +main () +{ + unsigned long x = 0x80000000UL; + if (f(&x) != &x + 0x81) + abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/920929-1.c b/gcc/testsuite/gcc.c-torture/execute/920929-1.c new file mode 100644 index 000000000..e43444e31 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/920929-1.c @@ -0,0 +1,13 @@ +/* REPRODUCED:RUN:SIGNAL MACHINE:sparc OPTIONS: */ +f(int n) +{ +int i; +double v[n]; +for(i=0;i=0)abort(); +exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/921013-1.c b/gcc/testsuite/gcc.c-torture/execute/921013-1.c new file mode 100644 index 000000000..d041beb25 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/921013-1.c @@ -0,0 +1,20 @@ +f(d,x,y,n) +int*d; +float*x,*y; +int n; +{ + while(n--){*d++=*x++==*y++;} +} + +main() +{ + int r[4]; + float a[]={5,1,3,5}; + float b[]={2,4,3,0}; + int i; + f(r,a,b,4); + for(i=0;i<4;i++) + if((a[i]==b[i])!=r[i]) + abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/921016-1.c b/gcc/testsuite/gcc.c-torture/execute/921016-1.c new file mode 100644 index 000000000..46f8a8387 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/921016-1.c @@ -0,0 +1,10 @@ +main() +{ +int j=1081; +struct +{ +signed int m:11; +}l; +if((l.m=j)==j)abort(); +exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/921017-1.c b/gcc/testsuite/gcc.c-torture/execute/921017-1.c new file mode 100644 index 000000000..ab68fc084 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/921017-1.c @@ -0,0 +1,17 @@ +f(n) +{ + int a[n]; + int g(i) + { + return a[i]; + } + a[1]=4711; + return g(1); +} +main() +{ +#ifndef NO_TRAMPOLINES + if(f(2)!=4711)abort(); +#endif + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/921019-1.c b/gcc/testsuite/gcc.c-torture/execute/921019-1.c new file mode 100644 index 000000000..f48613a8b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/921019-1.c @@ -0,0 +1,8 @@ +void *foo[]={(void *)&("X"[0])}; + +main () +{ + if (((char*)foo[0])[0] != 'X') + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/921019-2.c b/gcc/testsuite/gcc.c-torture/execute/921019-2.c new file mode 100644 index 000000000..9003e7b64 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/921019-2.c @@ -0,0 +1,8 @@ +main() +{ + double x,y=0.5; + x=y/0.2; + if(x!=x) + abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/921029-1.c b/gcc/testsuite/gcc.c-torture/execute/921029-1.c new file mode 100644 index 000000000..76fc974c2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/921029-1.c @@ -0,0 +1,42 @@ +typedef unsigned long long ULL; +ULL back; +ULL hpart, lpart; +ULL +build(long h, long l) +{ + hpart = h; + hpart <<= 32; + lpart = l; + lpart &= 0xFFFFFFFFLL; + back = hpart | lpart; + return back; +} + +main() +{ + if (build(0, 1) != 0x0000000000000001LL) + abort(); + if (build(0, 0) != 0x0000000000000000LL) + abort(); + if (build(0, 0xFFFFFFFF) != 0x00000000FFFFFFFFLL) + abort(); + if (build(0, 0xFFFFFFFE) != 0x00000000FFFFFFFELL) + abort(); + if (build(1, 1) != 0x0000000100000001LL) + abort(); + if (build(1, 0) != 0x0000000100000000LL) + abort(); + if (build(1, 0xFFFFFFFF) != 0x00000001FFFFFFFFLL) + abort(); + if (build(1, 0xFFFFFFFE) != 0x00000001FFFFFFFELL) + abort(); + if (build(0xFFFFFFFF, 1) != 0xFFFFFFFF00000001LL) + abort(); + if (build(0xFFFFFFFF, 0) != 0xFFFFFFFF00000000LL) + abort(); + if (build(0xFFFFFFFF, 0xFFFFFFFF) != 0xFFFFFFFFFFFFFFFFLL) + abort(); + if (build(0xFFFFFFFF, 0xFFFFFFFE) != 0xFFFFFFFFFFFFFFFELL) + abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/921104-1.c b/gcc/testsuite/gcc.c-torture/execute/921104-1.c new file mode 100644 index 000000000..4b6f4bcfb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/921104-1.c @@ -0,0 +1,8 @@ +main () +{ + unsigned long val = 1; + + if (val > (unsigned long) ~0) + abort(); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/921110-1.c b/gcc/testsuite/gcc.c-torture/execute/921110-1.c new file mode 100644 index 000000000..27ff96f18 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/921110-1.c @@ -0,0 +1,7 @@ +extern int abort(); +typedef int (*frob)(); +frob f[] = {abort}; +main() +{ + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/921112-1.c b/gcc/testsuite/gcc.c-torture/execute/921112-1.c new file mode 100644 index 000000000..5946398e3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/921112-1.c @@ -0,0 +1,21 @@ +union u { + struct { int i1, i2; } t; + double d; +} x[2], v; + +f (x, v) + union u *x, v; +{ + *++x = v; +} + +main() +{ + x[1].t.i1 = x[1].t.i2 = 0; + v.t.i1 = 1; + v.t.i2 = 2; + f (x, v); + if (x[1].t.i1 != 1 || x[1].t.i2 != 2) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/921113-1.c b/gcc/testsuite/gcc.c-torture/execute/921113-1.c new file mode 100644 index 000000000..78972bc97 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/921113-1.c @@ -0,0 +1,63 @@ +#define STACK_REQUIREMENT (128 * 128 * 4 + 1024) +#if defined (STACK_SIZE) && STACK_SIZE < STACK_REQUIREMENT +main () { exit (0); } +#else + +typedef struct { + float wsx; +} struct_list; + +typedef struct_list *list_t; + +typedef struct { + float x, y; +} vector_t; + +w(float x, float y) {} + +f1(float x, float y) +{ + if (x != 0 || y != 0) + abort(); +} +f2(float x, float y) +{ + if (x != 1 || y != 1) + abort(); +} + +gitter(int count, vector_t pos[], list_t list, int *nww, vector_t limit[2], float r) +{ + float d; + int gitt[128][128]; + + f1(limit[0].x, limit[0].y); + f2(limit[1].x, limit[1].y); + + *nww = 0; + + d = pos[0].x; + if (d <= 0.) + { + w(d, r); + if (d <= r * 0.5) + { + w(d, r); + list[0].wsx = 1; + } + } +} + +vector_t pos[1] = {{0., 0.}}; +vector_t limit[2] = {{0.,0.},{1.,1.}}; + +main() +{ + int nww; + struct_list list; + + gitter(1, pos, &list, &nww, limit, 1.); + exit(0); +} + +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/921117-1.c b/gcc/testsuite/gcc.c-torture/execute/921117-1.c new file mode 100644 index 000000000..2ed30fbee --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/921117-1.c @@ -0,0 +1,22 @@ +struct s { + char text[11]; + int flag; +} cell; + +int +check (struct s p) +{ + if (p.flag != 99) + return 1; + return strcmp (p.text, "0123456789"); +} + +main () +{ + cell.flag = 99; + strcpy (cell.text, "0123456789"); + + if (check (cell)) + abort(); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/921123-1.c b/gcc/testsuite/gcc.c-torture/execute/921123-1.c new file mode 100644 index 000000000..d3daf120f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/921123-1.c @@ -0,0 +1,13 @@ +f(short *p) +{ + short x = *p; + return (--x < 0); +} + +main() +{ + short x = -10; + if (!f(&x)) + abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/921123-2.c b/gcc/testsuite/gcc.c-torture/execute/921123-2.c new file mode 100644 index 000000000..3028717cf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/921123-2.c @@ -0,0 +1,24 @@ +typedef struct +{ + unsigned short b0, b1, b2, b3; +} four_quarters; + +four_quarters x; +int a, b; + +void f (four_quarters j) +{ + b = j.b2; + a = j.b3; +} + +main () +{ + four_quarters x; + x.b0 = x.b1 = x.b2 = 0; + x.b3 = 38; + f(x); + if (a != 38) + abort(); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/921124-1.c b/gcc/testsuite/gcc.c-torture/execute/921124-1.c new file mode 100644 index 000000000..51b090b4d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/921124-1.c @@ -0,0 +1,19 @@ +f(x, d1, d2, d3) + double d1, d2, d3; +{ + return x; +} + +g(b,s,x,y,i,j) + char *b,*s; + double x,y; +{ + if (x != 1.0 || y != 2.0 || i != 3 || j != 4) + abort(); +} + +main() +{ + g("","", 1.0, 2.0, f(3, 0.0, 0.0, 0.0), f(4, 0.0, 0.0, 0.0)); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/921202-1.c b/gcc/testsuite/gcc.c-torture/execute/921202-1.c new file mode 100644 index 000000000..f090f8180 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/921202-1.c @@ -0,0 +1,41 @@ +#ifndef STACK_SIZE +#define VLEN 2055 +#else +#define VLEN ((STACK_SIZE/16) - 1) +#endif +main () +{ + long dx[VLEN]; + long dy[VLEN]; + long s1[VLEN]; + int cyx, cyy; + int i; + long size; + + for (;;) + { + size = VLEN; + mpn_random2 (s1, size); + + for (i = 0; i < 1; i++) + ; + + dy[size] = 0x12345678; + + for (i = 0; i < 1; i++) + cyy = mpn_mul_1 (dy, s1, size); + + if (cyx != cyy || mpn_cmp (dx, dy, size + 1) != 0 || dx[size] != 0x12345678) + { + foo ("", 8, cyy); mpn_print (dy, size); + } + exxit(); + } +} + +foo (){} +mpn_mul_1(){} +mpn_print (){} +mpn_random2(){} +mpn_cmp(){} +exxit(){exit(0);} diff --git a/gcc/testsuite/gcc.c-torture/execute/921202-2.c b/gcc/testsuite/gcc.c-torture/execute/921202-2.c new file mode 100644 index 000000000..48d4a412d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/921202-2.c @@ -0,0 +1,13 @@ +int +f(long long x) +{ + x >>= 8; + return x & 0xff; +} + +main() +{ + if (f(0x0123456789ABCDEFLL) != 0xCD) + abort(); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/921204-1.c b/gcc/testsuite/gcc.c-torture/execute/921204-1.c new file mode 100644 index 000000000..a7bba830a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/921204-1.c @@ -0,0 +1,46 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int +main (void) +{ + exit (0); +} +#else +typedef struct { + unsigned b0:1, f1:17, b18:1, b19:1, b20:1, f2:11; +} bf; + +typedef union { + bf b; + unsigned w; +} bu; + +bu +f(bu i) +{ + bu o = i; + + if (o.b.b0) + o.b.b18 = 1, + o.b.b20 = 1; + else + o.b.b18 = 0, + o.b.b20 = 0; + + return o; +} + +main() +{ + bu a; + bu r; + + a.w = 0x4000000; + a.b.b0 = 0; + r = f(a); + if (a.w != r.w) + abort(); + exit(0); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/921207-1.c b/gcc/testsuite/gcc.c-torture/execute/921207-1.c new file mode 100644 index 000000000..5ee9d27cc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/921207-1.c @@ -0,0 +1,15 @@ +f() +{ + unsigned b = 0; + + if (b > ~0U) + b = ~0U; + + return b; +} +main() +{ + if (f()!=0) + abort(); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/921208-1.c b/gcc/testsuite/gcc.c-torture/execute/921208-1.c new file mode 100644 index 000000000..143ef63b0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/921208-1.c @@ -0,0 +1,18 @@ +double +f(double x) +{ + return x*x; +} + +double +Int(double (*f)(double), double a) +{ + return (*f)(a); +} + +main() +{ + if (Int(&f,2.0) != 4.0) + abort(); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/921208-2.c b/gcc/testsuite/gcc.c-torture/execute/921208-2.c new file mode 100644 index 000000000..d5edcf97c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/921208-2.c @@ -0,0 +1,26 @@ +#define STACK_REQUIREMENT (100000 * 4 + 1024) +#if defined (STACK_SIZE) && STACK_SIZE < STACK_REQUIREMENT +main () { exit (0); } +#else + +g(){} + +f() +{ + int i; + float a[100000]; + + for (i = 0; i < 1; i++) + { + g(1.0, 1.0 + i / 2.0 * 3.0); + g(2.0, 1.0 + i / 2.0 * 3.0); + } +} + +main () +{ + f(); + exit(0); +} + +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/921215-1.c b/gcc/testsuite/gcc.c-torture/execute/921215-1.c new file mode 100644 index 000000000..4fa3b7dfc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/921215-1.c @@ -0,0 +1,24 @@ +main() +{ +#ifndef NO_TRAMPOLINES + void p(void ((*f) (void ()))) + { + void r() + { + foo (); + } + + f(r); + } + + void q(void ((*f)())) + { + f(); + } + + p(q); +#endif + exit(0); +} + +foo(){} diff --git a/gcc/testsuite/gcc.c-torture/execute/921218-1.c b/gcc/testsuite/gcc.c-torture/execute/921218-1.c new file mode 100644 index 000000000..ab7bc19cc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/921218-1.c @@ -0,0 +1,11 @@ +f() +{ + return (unsigned char)("\377"[0]); +} + +main() +{ + if (f() != (unsigned char)(0377)) + abort(); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/921218-2.c b/gcc/testsuite/gcc.c-torture/execute/921218-2.c new file mode 100644 index 000000000..b5d57e9c3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/921218-2.c @@ -0,0 +1,17 @@ +f() +{ + long l2; + unsigned short us; + unsigned long ul; + short s2; + + ul = us = l2 = s2 = -1; + return ul; +} + +main() +{ + if (f()!=(unsigned short)-1) + abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930106-1.c b/gcc/testsuite/gcc.c-torture/execute/930106-1.c new file mode 100644 index 000000000..8081f9260 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930106-1.c @@ -0,0 +1,27 @@ +#if defined (STACK_SIZE) +#define DUMMY_SIZE 9 +#else +#define DUMMY_SIZE 399999 +#endif + +double g() +{ + return 1.0; +} + +f() +{ + char dummy[DUMMY_SIZE]; + double f1, f2, f3; + f1 = g(); + f2 = g(); + f3 = g(); + return f1 + f2 + f3; +} + +main() +{ + if (f() != 3.0) + abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930111-1.c b/gcc/testsuite/gcc.c-torture/execute/930111-1.c new file mode 100644 index 000000000..e908f14f6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930111-1.c @@ -0,0 +1,22 @@ +main() +{ + if (wwrite((long long) 0) != 123) + abort(); + exit(0); +} + +int +wwrite(long long i) +{ + switch(i) + { + case 3: + case 10: + case 23: + case 28: + case 47: + return 0; + default: + return 123; + } +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930123-1.c b/gcc/testsuite/gcc.c-torture/execute/930123-1.c new file mode 100644 index 000000000..7365bae52 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930123-1.c @@ -0,0 +1,16 @@ +f(int *x) +{ + *x = 0; +} + +main() +{ + int s, c, x; + char a[] = "c"; + + f(&s); + a[c = 0] = s == 0 ? (x=1, 'a') : (x=2, 'b'); + if (a[c] != 'a') + abort(); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930126-1.c b/gcc/testsuite/gcc.c-torture/execute/930126-1.c new file mode 100644 index 000000000..ff08e7d61 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930126-1.c @@ -0,0 +1,20 @@ +struct s { + unsigned long long a:8, b:32; +}; + +struct s +f(struct s x) +{ + x.b = 0xcdef1234; + return x; +} + +main() +{ + static struct s i; + i.a = 12; + i = f(i); + if (i.a != 12 || i.b != 0xcdef1234) + abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930208-1.c b/gcc/testsuite/gcc.c-torture/execute/930208-1.c new file mode 100644 index 000000000..464b69d43 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930208-1.c @@ -0,0 +1,23 @@ +typedef union { + long l; + struct { char b3, b2, b1, b0; } c; +} T; + +f (T u) +{ + ++u.c.b0; + ++u.c.b3; + return (u.c.b1 != 2 || u.c.b2 != 2); +} + +main () +{ + T u; + u.c.b1 = 2; + u.c.b2 = 2; + u.c.b0 = ~0; + u.c.b3 = ~0; + if (f (u)) + abort(); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930406-1.c b/gcc/testsuite/gcc.c-torture/execute/930406-1.c new file mode 100644 index 000000000..9728eabd7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930406-1.c @@ -0,0 +1,23 @@ +f() +{ + int x = 1; +#if defined(STACK_SIZE) + char big[STACK_SIZE/2]; +#else + char big[0x1000]; +#endif + + ({ + __label__ mylabel; + mylabel: + x++; + if (x != 3) + goto mylabel; + }); + exit(0); +} + +main() +{ + f(); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930408-1.c b/gcc/testsuite/gcc.c-torture/execute/930408-1.c new file mode 100644 index 000000000..42ffc098f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930408-1.c @@ -0,0 +1,27 @@ +typedef enum foo E; +enum foo { e0, e1 }; + +struct { + E eval; +} s; + +p() +{ + abort(); +} + +f() +{ + switch (s.eval) + { + case e0: + p(); + } +} + +main() +{ + s.eval = e1; + f(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930429-1.c b/gcc/testsuite/gcc.c-torture/execute/930429-1.c new file mode 100644 index 000000000..656d928eb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930429-1.c @@ -0,0 +1,14 @@ +char * +f (char *p) +{ + short x = *p++ << 16; + return p; +} + +main () +{ + char *p = ""; + if (f (p) != p + 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930429-2.c b/gcc/testsuite/gcc.c-torture/execute/930429-2.c new file mode 100644 index 000000000..e52c8b4d7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930429-2.c @@ -0,0 +1,14 @@ +int +f (b) +{ + return (b >> 1) > 0; +} + +main () +{ + if (!f (9)) + abort (); + if (f (-9)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930513-1.c b/gcc/testsuite/gcc.c-torture/execute/930513-1.c new file mode 100644 index 000000000..4544471ec --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930513-1.c @@ -0,0 +1,16 @@ +#include +char buf[2]; + +f (fp) + int (*fp)(char *, const char *, ...); +{ + (*fp)(buf, "%.0f", 5.0); +} + +main () +{ + f (&sprintf); + if (buf[0] != '5' || buf[1] != 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930513-1.x b/gcc/testsuite/gcc.c-torture/execute/930513-1.x new file mode 100644 index 000000000..f675fb66d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930513-1.x @@ -0,0 +1,5 @@ +# sprintf() does not support %f on m6811/m6812 target. +if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"]} { + return 1 +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/930513-2.c b/gcc/testsuite/gcc.c-torture/execute/930513-2.c new file mode 100644 index 000000000..3731f6204 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930513-2.c @@ -0,0 +1,27 @@ +sub3 (i) + const int *i; +{ +} + +eq (a, b) +{ + static int i = 0; + if (a != i) + abort (); + i++; +} + +main () +{ + int i; + + for (i = 0; i < 4; i++) + { + const int j = i; + int k; + sub3 (&j); + k = j; + eq (k, k); + } + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930518-1.c b/gcc/testsuite/gcc.c-torture/execute/930518-1.c new file mode 100644 index 000000000..44bdf96af --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930518-1.c @@ -0,0 +1,24 @@ +int bar = 0; + +f (p) + int *p; +{ + int foo = 2; + + while (foo > bar) + { + foo -= bar; + *p++ = foo; + bar = 1; + } +} + +main () +{ + int tab[2]; + tab[0] = tab[1] = 0; + f (tab); + if (tab[0] != 2 || tab[1] != 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930526-1.c b/gcc/testsuite/gcc.c-torture/execute/930526-1.c new file mode 100644 index 000000000..bbf63c600 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930526-1.c @@ -0,0 +1,18 @@ +inline +f (x) +{ + int *(p[25]); + int m[25*7]; + int i; + + for (i = 0; i < 25; i++) + p[i] = m + x*i; + + p[1][0] = 0; +} + +main () +{ + f (7); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930527-1.c b/gcc/testsuite/gcc.c-torture/execute/930527-1.c new file mode 100644 index 000000000..fef34bf6b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930527-1.c @@ -0,0 +1,11 @@ +f (unsigned char x) +{ + return (0x50 | (x >> 4)) ^ 0xff; +} + +main () +{ + if (f (0) != 0xaf) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930529-1.c b/gcc/testsuite/gcc.c-torture/execute/930529-1.c new file mode 100644 index 000000000..906338e6e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930529-1.c @@ -0,0 +1,45 @@ +dd (x,d) { return x / d; } + +main () +{ + int i; + for (i = -3; i <= 3; i++) + { + if (dd (i, 1) != i / 1) + abort (); + if (dd (i, 2) != i / 2) + abort (); + if (dd (i, 3) != i / 3) + abort (); + if (dd (i, 4) != i / 4) + abort (); + if (dd (i, 5) != i / 5) + abort (); + if (dd (i, 6) != i / 6) + abort (); + if (dd (i, 7) != i / 7) + abort (); + if (dd (i, 8) != i / 8) + abort (); + } + for (i = ((unsigned) ~0 >> 1) - 3; i <= ((unsigned) ~0 >> 1) + 3; i++) + { + if (dd (i, 1) != i / 1) + abort (); + if (dd (i, 2) != i / 2) + abort (); + if (dd (i, 3) != i / 3) + abort (); + if (dd (i, 4) != i / 4) + abort (); + if (dd (i, 5) != i / 5) + abort (); + if (dd (i, 6) != i / 6) + abort (); + if (dd (i, 7) != i / 7) + abort (); + if (dd (i, 8) != i / 8) + abort (); + } + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930529-1.x b/gcc/testsuite/gcc.c-torture/execute/930529-1.x new file mode 100644 index 000000000..25225f4f4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930529-1.x @@ -0,0 +1,24 @@ +# The problem on Alpha at -O3 is that when dd is inlined, we have +# division by a constant, which gets converted to multiplication +# by a large constant, which gets turned into an induction variable. +# The problem is that the multiplication was unsigned SImode, and the +# induction variable is DImode, and we lose the truncation that +# should have happened. +# +# On tree-ssa branch, the loop problem is still extant, but the +# gimple-level optimization makes it easy for the tree-rtl expanders +# to see that the comparisons are always true, and so the loop code +# is never exercized. + +# set torture_eval_before_execute { +# +# set compiler_conditional_xfail_data { +# "division by a constant conflicts with strength reduction" \ +# "alpha*-*-*" \ +# { "-O3" } \ +# { "" } +# } +# } + +set additional_flags "-fwrapv" +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/930603-1.c b/gcc/testsuite/gcc.c-torture/execute/930603-1.c new file mode 100644 index 000000000..6a84de035 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930603-1.c @@ -0,0 +1,22 @@ +float fx (x) + float x; +{ + return 1.0 + 3.0 / (2.302585093 * x); +} + +main () +{ + float fx (), inita (), initc (), a, b, c; + a = inita (); + c = initc (); + f (); + b = fx (c) + a; + f (); + if (a != 3.0 || b < 4.3257 || b > 4.3258 || c != 4.0) + abort (); + exit (0); +} + +float inita () { return 3.0; } +float initc () { return 4.0; } +f () {} diff --git a/gcc/testsuite/gcc.c-torture/execute/930603-2.c b/gcc/testsuite/gcc.c-torture/execute/930603-2.c new file mode 100644 index 000000000..8cf06a211 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930603-2.c @@ -0,0 +1,19 @@ +int w[2][2]; + +f () +{ + int i, j; + + for (i = 0; i < 2; i++) + for (j = 0; j < 2; j++) + if (i == j) + w[i][j] = 1; +} + +main () +{ + f (); + if (w[0][0] != 1 || w[1][1] != 1 || w[1][0] != 0 || w[0][1] != 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930603-3.c b/gcc/testsuite/gcc.c-torture/execute/930603-3.c new file mode 100644 index 000000000..22e5aed4a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930603-3.c @@ -0,0 +1,30 @@ +f (b, c) + unsigned char *b; + int c; +{ + unsigned long v = 0; + switch (c) + { + case 'd': + v = ((unsigned long)b[0] << 8) + b[1]; + v >>= 9; + break; + + case 'k': + v = b[3] >> 4; + break; + + default: + abort (); + } + + return v; +} +main () +{ + char buf[4]; + buf[0] = 170; buf[1] = 5; + if (f (buf, 'd') != 85) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930608-1.c b/gcc/testsuite/gcc.c-torture/execute/930608-1.c new file mode 100644 index 000000000..004a44007 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930608-1.c @@ -0,0 +1,11 @@ +double f (double a) {} +double (* const a[]) (double) = {&f}; + +main () +{ + double (*p) (); + p = &f; + if (p != a[0]) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930614-1.c b/gcc/testsuite/gcc.c-torture/execute/930614-1.c new file mode 100644 index 000000000..7b206344b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930614-1.c @@ -0,0 +1,19 @@ +f (double *ty) +{ + *ty = -1.0; +} + +main () +{ + double foo[6]; + double tx = 0.0, ty, d; + + f (&ty); + + if (ty < 0) + ty = -ty; + d = (tx > ty) ? tx : ty; + if (ty != d) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930614-2.c b/gcc/testsuite/gcc.c-torture/execute/930614-2.c new file mode 100644 index 000000000..ab83a7e3b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930614-2.c @@ -0,0 +1,20 @@ +main () +{ + int i, j, k, l; + float x[8][2][8][2]; + + for (i = 0; i < 8; i++) + for (j = i; j < 8; j++) + for (k = 0; k < 2; k++) + for (l = 0; l < 2; l++) + { + if ((i == j) && (k == l)) + x[i][k][j][l] = 0.8; + else + x[i][k][j][l] = 0.8; + if (x[i][k][j][l] < 0.0) + abort (); + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930621-1.c b/gcc/testsuite/gcc.c-torture/execute/930621-1.c new file mode 100644 index 000000000..4bb7cdbe0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930621-1.c @@ -0,0 +1,29 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int +main (void) +{ + exit (0); +} +#else +f () +{ + struct { + int x : 18; + int y : 14; + } foo; + + foo.x = 10; + foo.y = 20; + + return foo.y; +} + +main () +{ + if (f () != 20) + abort (); + exit (0); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/930622-1.c b/gcc/testsuite/gcc.c-torture/execute/930622-1.c new file mode 100644 index 000000000..d733e133d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930622-1.c @@ -0,0 +1,22 @@ +int a = 1, b; + +g () { return 0; } +h (x) {} + +f () +{ + if (g () == -1) + return 0; + a = g (); + if (b >= 1) + h (a); + return 0; +} + +main () +{ + f (); + if (a != 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930622-2.c b/gcc/testsuite/gcc.c-torture/execute/930622-2.c new file mode 100644 index 000000000..d049b002a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930622-2.c @@ -0,0 +1,24 @@ +long double +ll_to_ld (long long n) +{ + return n; +} + +long long +ld_to_ll (long double n) +{ + return n; +} + +main () +{ + long long n; + + if (ll_to_ld (10LL) != 10.0) + abort (); + + if (ld_to_ll (10.0) != 10) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930628-1.c b/gcc/testsuite/gcc.c-torture/execute/930628-1.c new file mode 100644 index 000000000..58c612d1a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930628-1.c @@ -0,0 +1,27 @@ +f (double x[2], double y[2]) +{ + if (x == y) + abort (); +} + +main () +{ + struct { int f[3]; double x[1][2]; } tp[4][2]; + int i, j, ki, kj, mi, mj; + float bdm[4][2][4][2]; + + for (i = 0; i < 4; i++) + for (j = i; j < 4; j++) + for (ki = 0; ki < 2; ki++) + for (kj = 0; kj < 2; kj++) + if ((j == i) && (ki == kj)) + bdm[i][ki][j][kj] = 1000.0; + else + { + for (mi = 0; mi < 1; mi++) + for (mj = 0; mj < 1; mj++) + f (tp[i][ki].x[mi], tp[j][kj].x[mj]); + bdm[i][ki][j][kj] = 1000.0; + } + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930630-1.c b/gcc/testsuite/gcc.c-torture/execute/930630-1.c new file mode 100644 index 000000000..38ad1fdfd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930630-1.c @@ -0,0 +1,29 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int +main (void) +{ + exit (0); +} +#else +main () +{ + struct + { + signed int bf0:17; + signed int bf1:7; + } bf; + + bf.bf1 = 7; + f (bf.bf1); + exit (0); +} + +f (x) + int x; +{ + if (x != 7) + abort (); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/930702-1.c b/gcc/testsuite/gcc.c-torture/execute/930702-1.c new file mode 100644 index 000000000..8828a701c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930702-1.c @@ -0,0 +1,14 @@ +fp (double a, int b) +{ + if (a != 33 || b != 11) + abort (); +} + +main () +{ + int (*f) (double, int) = fp; + + fp (33, 11); + f (33, 11); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930713-1.c b/gcc/testsuite/gcc.c-torture/execute/930713-1.c new file mode 100644 index 000000000..6b4d5ab79 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930713-1.c @@ -0,0 +1,23 @@ +typedef struct +{ + char x; +} T; + +T +f (s1) + T s1; +{ + T s1a; + s1a.x = 17; + return s1a; +} + +main () +{ + T s1a, s1b; + s1a.x = 13; + s1b = f (s1a); + if (s1a.x != 13 || s1b.x != 17) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930718-1.c b/gcc/testsuite/gcc.c-torture/execute/930718-1.c new file mode 100644 index 000000000..a8eacc2d2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930718-1.c @@ -0,0 +1,34 @@ +typedef struct rtx_def +{ + int f1 :1; + int f2 :1; +} *rtx; + +static rtx +f (orig) + register rtx orig; +{ + if (orig->f1 || orig->f2) + return orig; + orig->f2 = 1; + return orig; +} + +void +f2 () +{ + abort (); +} + +main () +{ + struct rtx_def foo; + rtx bar; + + foo.f1 = 1; + foo.f2 = 0; + bar = f (&foo); + if (bar != &foo || bar->f2 != 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930719-1.c b/gcc/testsuite/gcc.c-torture/execute/930719-1.c new file mode 100644 index 000000000..c6557efc7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930719-1.c @@ -0,0 +1,23 @@ +int +f (foo, bar, com) +{ + unsigned align; + if (foo) + return 0; + while (1) + { + switch (bar) + { + case 1: + if (com != 0) + return align; + *(char *) 0 = 0; + } + } +} + +main () +{ + f (0, 1, 1); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930725-1.c b/gcc/testsuite/gcc.c-torture/execute/930725-1.c new file mode 100644 index 000000000..3bd738ca0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930725-1.c @@ -0,0 +1,21 @@ +int v; + +char * +g () +{ + return ""; +} + +char * +f () +{ + return (v == 0 ? g () : "abc"); +} + +main () +{ + v = 1; + if (!strcmp (f (), "abc")) + exit (0); + abort(); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930818-1.c b/gcc/testsuite/gcc.c-torture/execute/930818-1.c new file mode 100644 index 000000000..710e3ce2f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930818-1.c @@ -0,0 +1,15 @@ +static double one = 1.0; + +f() +{ + int colinear; + colinear = (one == 0.0); + if (colinear) + abort (); + return colinear; +} +main() +{ + if (f()) abort(); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930916-1.c b/gcc/testsuite/gcc.c-torture/execute/930916-1.c new file mode 100644 index 000000000..6302614a8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930916-1.c @@ -0,0 +1,13 @@ +f (n) + unsigned n; +{ + if ((int) n >= 0) + abort (); +} + +main () +{ + unsigned x = ~0; + f (x); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930921-1.c b/gcc/testsuite/gcc.c-torture/execute/930921-1.c new file mode 100644 index 000000000..12e04e309 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930921-1.c @@ -0,0 +1,15 @@ +f (x) + unsigned x; +{ + return (unsigned) (((unsigned long long) x * 0xAAAAAAAB) >> 32) >> 1; +} + +main () +{ + unsigned i; + + for (i = 0; i < 10000; i++) + if (f (i) != i / 3) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930929-1.c b/gcc/testsuite/gcc.c-torture/execute/930929-1.c new file mode 100644 index 000000000..31f695442 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930929-1.c @@ -0,0 +1,36 @@ +sub1 (i) + int i; +{ + return i - (5 - i); +} + +sub2 (i) + int i; +{ + return i + (5 + i); +} + +sub3 (i) + int i; +{ + return i - (5 + i); +} + +sub4 (i) + int i; +{ + return i + (5 - i); +} + +main() +{ + if (sub1 (20) != 35) + abort (); + if (sub2 (20) != 45) + abort (); + if (sub3 (20) != -5) + abort (); + if (sub4 (20) != 5) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930930-1.c b/gcc/testsuite/gcc.c-torture/execute/930930-1.c new file mode 100644 index 000000000..68fdbbfe8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930930-1.c @@ -0,0 +1,35 @@ +long *wm_TR; +long *wm_HB; +long *wm_SPB; + +long mem[100]; + +f (mr_TR, mr_SPB, mr_HB, reg1, reg2) + long *mr_TR; + long *mr_SPB; + long *mr_HB; + long *reg1; + long *reg2; +{ + long *x = mr_TR; + + for (;;) + { + if (reg1 < reg2) + goto out; + if ((long *) *reg1 < mr_HB && (long *) *reg1 >= mr_SPB) + *--mr_TR = *reg1; + reg1--; + } + out: + + if (x != mr_TR) + abort (); +} + +main () +{ + mem[99] = (long) mem; + f (mem + 100, mem + 6, mem + 8, mem + 99, mem + 99); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/930930-2.c b/gcc/testsuite/gcc.c-torture/execute/930930-2.c new file mode 100644 index 000000000..eb34d11fe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/930930-2.c @@ -0,0 +1,30 @@ +int +test_endianness() +{ + union doubleword + { + double d; + unsigned long u[2]; + } dw; + dw.d = 10; + return dw.u[0] != 0 ? 1 : 0; +} + +int +test_endianness_vol() +{ + union doubleword + { + volatile double d; + volatile long u[2]; + } dw; + dw.d = 10; + return dw.u[0] != 0 ? 1 : 0; +} + +main () +{ + if (test_endianness () != test_endianness_vol ()) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/931002-1.c b/gcc/testsuite/gcc.c-torture/execute/931002-1.c new file mode 100644 index 000000000..6a02b2343 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931002-1.c @@ -0,0 +1,28 @@ +f (void (*func) ()) +{ + func (); +} + +main () +{ +#ifndef NO_TRAMPOLINES + void t0 () + { + } + + void t1 () + { + f (t0); + } + + void t2 () + { + t1 (); + } + + t1 (); + t1 (); + t2 (); +#endif + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/931004-1.c b/gcc/testsuite/gcc.c-torture/execute/931004-1.c new file mode 100644 index 000000000..9c89afdae --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931004-1.c @@ -0,0 +1,30 @@ +struct tiny +{ + int c; +}; + +f (int n, struct tiny x, struct tiny y, struct tiny z, long l) +{ + if (x.c != 10) + abort(); + + if (y.c != 11) + abort(); + + if (z.c != 12) + abort(); + + if (l != 123) + abort (); +} + +main () +{ + struct tiny x[3]; + x[0].c = 10; + x[1].c = 11; + x[2].c = 12; + f (3, x[0], x[1], x[2], (long) 123); + exit(0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/931004-10.c b/gcc/testsuite/gcc.c-torture/execute/931004-10.c new file mode 100644 index 000000000..cf0125dba --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931004-10.c @@ -0,0 +1,44 @@ +#include + +struct tiny +{ + char c; + char d; +}; + +f (int n, ...) +{ + struct tiny x; + int i; + + va_list ap; + va_start (ap,n); + for (i = 0; i < n; i++) + { + x = va_arg (ap,struct tiny); + if (x.c != i + 10) + abort(); + if (x.d != i + 20) + abort(); + } + { + long x = va_arg (ap, long); + if (x != 123) + abort(); + } + va_end (ap); +} + +main () +{ + struct tiny x[3]; + x[0].c = 10; + x[1].c = 11; + x[2].c = 12; + x[0].d = 20; + x[1].d = 21; + x[2].d = 22; + f (3, x[0], x[1], x[2], (long) 123); + exit(0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/931004-11.c b/gcc/testsuite/gcc.c-torture/execute/931004-11.c new file mode 100644 index 000000000..b6047025c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931004-11.c @@ -0,0 +1,50 @@ +struct tiny +{ + char c; + char d; + char e; +}; + +f (int n, struct tiny x, struct tiny y, struct tiny z, long l) +{ + if (x.c != 10) + abort(); + if (x.d != 20) + abort(); + if (x.e != 30) + abort(); + + if (y.c != 11) + abort(); + if (y.d != 21) + abort(); + if (y.e != 31) + abort(); + + if (z.c != 12) + abort(); + if (z.d != 22) + abort(); + if (z.e != 32) + abort(); + + if (l != 123) + abort (); +} + +main () +{ + struct tiny x[3]; + x[0].c = 10; + x[1].c = 11; + x[2].c = 12; + x[0].d = 20; + x[1].d = 21; + x[2].d = 22; + x[0].e = 30; + x[1].e = 31; + x[2].e = 32; + f (3, x[0], x[1], x[2], (long) 123); + exit(0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/931004-12.c b/gcc/testsuite/gcc.c-torture/execute/931004-12.c new file mode 100644 index 000000000..d3fc71e0c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931004-12.c @@ -0,0 +1,50 @@ +#include + +struct tiny +{ + char c; + char d; + char e; +}; + +f (int n, ...) +{ + struct tiny x; + int i; + + va_list ap; + va_start (ap,n); + for (i = 0; i < n; i++) + { + x = va_arg (ap,struct tiny); + if (x.c != i + 10) + abort(); + if (x.d != i + 20) + abort(); + if (x.e != i + 30) + abort(); + } + { + long x = va_arg (ap, long); + if (x != 123) + abort(); + } + va_end (ap); +} + +main () +{ + struct tiny x[3]; + x[0].c = 10; + x[1].c = 11; + x[2].c = 12; + x[0].d = 20; + x[1].d = 21; + x[2].d = 22; + x[0].e = 30; + x[1].e = 31; + x[2].e = 32; + f (3, x[0], x[1], x[2], (long) 123); + exit(0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/931004-12.x b/gcc/testsuite/gcc.c-torture/execute/931004-12.x new file mode 100644 index 000000000..591dc7ff2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931004-12.x @@ -0,0 +1,6 @@ +if { [istarget "powerpc-*-darwin*] } { + # xfail this on powerpc-*-darwin, see PR 15923 + set torture_execute_xfail [istarget] +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/931004-13.c b/gcc/testsuite/gcc.c-torture/execute/931004-13.c new file mode 100644 index 000000000..60422af8e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931004-13.c @@ -0,0 +1,60 @@ +struct tiny +{ + char c; + char d; + char e; + char f; +}; + +f (int n, struct tiny x, struct tiny y, struct tiny z, long l) +{ + if (x.c != 10) + abort(); + if (x.d != 20) + abort(); + if (x.e != 30) + abort(); + if (x.f != 40) + abort(); + + if (y.c != 11) + abort(); + if (y.d != 21) + abort(); + if (y.e != 31) + abort(); + if (y.f != 41) + abort(); + + if (z.c != 12) + abort(); + if (z.d != 22) + abort(); + if (z.e != 32) + abort(); + if (z.f != 42) + abort(); + + if (l != 123) + abort (); +} + +main () +{ + struct tiny x[3]; + x[0].c = 10; + x[1].c = 11; + x[2].c = 12; + x[0].d = 20; + x[1].d = 21; + x[2].d = 22; + x[0].e = 30; + x[1].e = 31; + x[2].e = 32; + x[0].f = 40; + x[1].f = 41; + x[2].f = 42; + f (3, x[0], x[1], x[2], (long) 123); + exit(0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/931004-14.c b/gcc/testsuite/gcc.c-torture/execute/931004-14.c new file mode 100644 index 000000000..55c71bbc4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931004-14.c @@ -0,0 +1,56 @@ +#include + +struct tiny +{ + char c; + char d; + char e; + char f; +}; + +f (int n, ...) +{ + struct tiny x; + int i; + + va_list ap; + va_start (ap,n); + for (i = 0; i < n; i++) + { + x = va_arg (ap,struct tiny); + if (x.c != i + 10) + abort(); + if (x.d != i + 20) + abort(); + if (x.e != i + 30) + abort(); + if (x.f != i + 40) + abort(); + } + { + long x = va_arg (ap, long); + if (x != 123) + abort(); + } + va_end (ap); +} + +main () +{ + struct tiny x[3]; + x[0].c = 10; + x[1].c = 11; + x[2].c = 12; + x[0].d = 20; + x[1].d = 21; + x[2].d = 22; + x[0].e = 30; + x[1].e = 31; + x[2].e = 32; + x[0].f = 40; + x[1].f = 41; + x[2].f = 42; + f (3, x[0], x[1], x[2], (long) 123); + exit(0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/931004-2.c b/gcc/testsuite/gcc.c-torture/execute/931004-2.c new file mode 100644 index 000000000..83bdea67b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931004-2.c @@ -0,0 +1,38 @@ +#include + +struct tiny +{ + int c; +}; + +f (int n, ...) +{ + struct tiny x; + int i; + + va_list ap; + va_start (ap,n); + for (i = 0; i < n; i++) + { + x = va_arg (ap,struct tiny); + if (x.c != i + 10) + abort(); + } + { + long x = va_arg (ap, long); + if (x != 123) + abort(); + } + va_end (ap); +} + +main () +{ + struct tiny x[3]; + x[0].c = 10; + x[1].c = 11; + x[2].c = 12; + f (3, x[0], x[1], x[2], (long) 123); + exit(0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/931004-3.c b/gcc/testsuite/gcc.c-torture/execute/931004-3.c new file mode 100644 index 000000000..1e7a0fdcd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931004-3.c @@ -0,0 +1,30 @@ +struct tiny +{ + short c; +}; + +f (int n, struct tiny x, struct tiny y, struct tiny z, long l) +{ + if (x.c != 10) + abort(); + + if (y.c != 11) + abort(); + + if (z.c != 12) + abort(); + + if (l != 123) + abort (); +} + +main () +{ + struct tiny x[3]; + x[0].c = 10; + x[1].c = 11; + x[2].c = 12; + f (3, x[0], x[1], x[2], (long) 123); + exit(0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/931004-4.c b/gcc/testsuite/gcc.c-torture/execute/931004-4.c new file mode 100644 index 000000000..f0d2331e5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931004-4.c @@ -0,0 +1,38 @@ +#include + +struct tiny +{ + short c; +}; + +f (int n, ...) +{ + struct tiny x; + int i; + + va_list ap; + va_start (ap,n); + for (i = 0; i < n; i++) + { + x = va_arg (ap,struct tiny); + if (x.c != i + 10) + abort(); + } + { + long x = va_arg (ap, long); + if (x != 123) + abort(); + } + va_end (ap); +} + +main () +{ + struct tiny x[3]; + x[0].c = 10; + x[1].c = 11; + x[2].c = 12; + f (3, x[0], x[1], x[2], (long) 123); + exit(0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/931004-5.c b/gcc/testsuite/gcc.c-torture/execute/931004-5.c new file mode 100644 index 000000000..9bef779e6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931004-5.c @@ -0,0 +1,40 @@ +struct tiny +{ + short c; + short d; +}; + +f (int n, struct tiny x, struct tiny y, struct tiny z, long l) +{ + if (x.c != 10) + abort(); + if (x.d != 20) + abort(); + + if (y.c != 11) + abort(); + if (y.d != 21) + abort(); + + if (z.c != 12) + abort(); + if (z.d != 22) + abort(); + + if (l != 123) + abort (); +} + +main () +{ + struct tiny x[3]; + x[0].c = 10; + x[1].c = 11; + x[2].c = 12; + x[0].d = 20; + x[1].d = 21; + x[2].d = 22; + f (3, x[0], x[1], x[2], (long) 123); + exit(0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/931004-6.c b/gcc/testsuite/gcc.c-torture/execute/931004-6.c new file mode 100644 index 000000000..6dca48f38 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931004-6.c @@ -0,0 +1,44 @@ +#include + +struct tiny +{ + short c; + short d; +}; + +f (int n, ...) +{ + struct tiny x; + int i; + + va_list ap; + va_start (ap,n); + for (i = 0; i < n; i++) + { + x = va_arg (ap,struct tiny); + if (x.c != i + 10) + abort(); + if (x.d != i + 20) + abort(); + } + { + long x = va_arg (ap, long); + if (x != 123) + abort(); + } + va_end (ap); +} + +main () +{ + struct tiny x[3]; + x[0].c = 10; + x[1].c = 11; + x[2].c = 12; + x[0].d = 20; + x[1].d = 21; + x[2].d = 22; + f (3, x[0], x[1], x[2], (long) 123); + exit(0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/931004-7.c b/gcc/testsuite/gcc.c-torture/execute/931004-7.c new file mode 100644 index 000000000..8ab2fcb2a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931004-7.c @@ -0,0 +1,30 @@ +struct tiny +{ + char c; +}; + +f (int n, struct tiny x, struct tiny y, struct tiny z, long l) +{ + if (x.c != 10) + abort(); + + if (y.c != 11) + abort(); + + if (z.c != 12) + abort(); + + if (l != 123) + abort (); +} + +main () +{ + struct tiny x[3]; + x[0].c = 10; + x[1].c = 11; + x[2].c = 12; + f (3, x[0], x[1], x[2], (long) 123); + exit(0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/931004-8.c b/gcc/testsuite/gcc.c-torture/execute/931004-8.c new file mode 100644 index 000000000..5fb97f64a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931004-8.c @@ -0,0 +1,38 @@ +#include + +struct tiny +{ + char c; +}; + +f (int n, ...) +{ + struct tiny x; + int i; + + va_list ap; + va_start (ap,n); + for (i = 0; i < n; i++) + { + x = va_arg (ap,struct tiny); + if (x.c != i + 10) + abort(); + } + { + long x = va_arg (ap, long); + if (x != 123) + abort(); + } + va_end (ap); +} + +main () +{ + struct tiny x[3]; + x[0].c = 10; + x[1].c = 11; + x[2].c = 12; + f (3, x[0], x[1], x[2], (long) 123); + exit(0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/931004-9.c b/gcc/testsuite/gcc.c-torture/execute/931004-9.c new file mode 100644 index 000000000..07247f7ad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931004-9.c @@ -0,0 +1,40 @@ +struct tiny +{ + char c; + char d; +}; + +f (int n, struct tiny x, struct tiny y, struct tiny z, long l) +{ + if (x.c != 10) + abort(); + if (x.d != 20) + abort(); + + if (y.c != 11) + abort(); + if (y.d != 21) + abort(); + + if (z.c != 12) + abort(); + if (z.d != 22) + abort(); + + if (l != 123) + abort (); +} + +main () +{ + struct tiny x[3]; + x[0].c = 10; + x[1].c = 11; + x[2].c = 12; + x[0].d = 20; + x[1].d = 21; + x[2].d = 22; + f (3, x[0], x[1], x[2], (long) 123); + exit(0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/931005-1.c b/gcc/testsuite/gcc.c-torture/execute/931005-1.c new file mode 100644 index 000000000..5a7e031cb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931005-1.c @@ -0,0 +1,23 @@ +typedef struct +{ + char x; +} T; + +T +f (s1) + T s1; +{ + T s1a; + s1a.x = s1.x; + return s1a; +} + +main () +{ + T s1a, s1b; + s1a.x = 100; + s1b = f (s1a); + if (s1b.x != 100) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/931009-1.c b/gcc/testsuite/gcc.c-torture/execute/931009-1.c new file mode 100644 index 000000000..292228014 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931009-1.c @@ -0,0 +1,26 @@ +main () +{ + f (); + exit (0); +} + +static +g (out, size, lo, hi) + int *out, size, lo, hi; +{ + int j; + + for (j = 0; j < size; j++) + out[j] = j * (hi - lo); +} + + +f () +{ + int a[2]; + + g (a, 2, 0, 1); + + if (a[0] != 0 || a[1] != 1) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/931012-1.c b/gcc/testsuite/gcc.c-torture/execute/931012-1.c new file mode 100644 index 000000000..d9c958ddb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931012-1.c @@ -0,0 +1,13 @@ +f (int b, int c) +{ + if (b != 0 && b != 1 && c != 0) + b = 0; + return b; +} + +main () +{ + if (!f (1, 2)) + abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/931017-1.c b/gcc/testsuite/gcc.c-torture/execute/931017-1.c new file mode 100644 index 000000000..5917bd95b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931017-1.c @@ -0,0 +1,54 @@ +int v; + +main () +{ + f (); + exit (0); +} + +h1 () +{ + return 0; +} + +h2 (e) + int *e; +{ + if (e != &v) + abort (); + return 0; +} + +g (c) + char *c; +{ + int i; + int b; + + do + { + i = h1 (); + if (i == -1) + return 0; + else if (i == 1) + h1 (); + } + while (i == 1); + + do + b = h2 (&v); + while (i == 5); + + if (i != 2) + return b; + *c = 'a'; + + return 0; +} + + +f () +{ + char c; + g (&c); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/931018-1.c b/gcc/testsuite/gcc.c-torture/execute/931018-1.c new file mode 100644 index 000000000..01b6050bf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931018-1.c @@ -0,0 +1,18 @@ +unsigned int a[0x1000]; +extern const unsigned long v; + +main () +{ + f (v); + f (v); + exit (0); +} + +f (a) + unsigned long a; +{ + if (a != 0xdeadbeefL) + abort(); +} + +const unsigned long v = 0xdeadbeefL; diff --git a/gcc/testsuite/gcc.c-torture/execute/931031-1.c b/gcc/testsuite/gcc.c-torture/execute/931031-1.c new file mode 100644 index 000000000..e9ce33795 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931031-1.c @@ -0,0 +1,34 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int +main (void) +{ + exit (0); +} +#else +struct foo +{ + unsigned y:1; + unsigned x:32; +}; + +int +f (x) + struct foo x; +{ + int t = x.x; + if (t < 0) + return 1; + return t+1; +} + +main () +{ + struct foo x; + x.x = -1; + if (f (x) == 0) + abort (); + exit (0); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/931102-1.c b/gcc/testsuite/gcc.c-torture/execute/931102-1.c new file mode 100644 index 000000000..489e7ebda --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931102-1.c @@ -0,0 +1,30 @@ +typedef union +{ + struct + { + char h, l; + } b; +} T; + +f (x) + int x; +{ + int num = 0; + T reg; + + reg.b.l = x; + while ((reg.b.l & 1) == 0) + { + num++; + reg.b.l >>= 1; + } + return num; +} + +main () +{ + if (f (2) != 1) + abort (); + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/931102-2.c b/gcc/testsuite/gcc.c-torture/execute/931102-2.c new file mode 100644 index 000000000..6fc735c8b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931102-2.c @@ -0,0 +1,31 @@ +typedef union +{ + long align; + struct + { + short h, l; + } b; +} T; + +f (x) + int x; +{ + int num = 0; + T reg; + + reg.b.l = x; + while ((reg.b.l & 1) == 0) + { + num++; + reg.b.l >>= 1; + } + return num; +} + +main () +{ + if (f (2) != 1) + abort (); + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/931110-1.c b/gcc/testsuite/gcc.c-torture/execute/931110-1.c new file mode 100644 index 000000000..5b33b269a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931110-1.c @@ -0,0 +1,18 @@ +typedef struct +{ + short f:3, g:3, h:10; +} small; + +struct +{ + int i; + small s[10]; +} x; + +main () +{ + int i; + for (i = 0; i < 10; i++) + x.s[i].f = 0; + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/931110-2.c b/gcc/testsuite/gcc.c-torture/execute/931110-2.c new file mode 100644 index 000000000..586615b18 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931110-2.c @@ -0,0 +1,12 @@ +main () +{ + static int a[] = {3, 4}; + register int *b; + int c; + + b = a; + c = *b++ % 8; + if (c != 3) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/931208-1.c b/gcc/testsuite/gcc.c-torture/execute/931208-1.c new file mode 100644 index 000000000..ee2bc9f1e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931208-1.c @@ -0,0 +1,14 @@ +f () +{ + unsigned long x, y = 1; + + x = ((y * 8192) - 216) / 16; + return x; +} + +main () +{ + if (f () != 498) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/931228-1.c b/gcc/testsuite/gcc.c-torture/execute/931228-1.c new file mode 100644 index 000000000..dcd3b65ff --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/931228-1.c @@ -0,0 +1,15 @@ +f (x) +{ + x &= 010000; + x &= 007777; + x ^= 017777; + x &= 017770; + return x; +} + +main () +{ + if (f (-1) != 017770) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/940115-1.c b/gcc/testsuite/gcc.c-torture/execute/940115-1.c new file mode 100644 index 000000000..d0fac9077 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/940115-1.c @@ -0,0 +1,13 @@ +f (cp, end) + char *cp; + char *end; +{ + return (cp < end); +} + +main () +{ + if (! f ((char *) 0, (char *) 1)) + abort(); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/940122-1.c b/gcc/testsuite/gcc.c-torture/execute/940122-1.c new file mode 100644 index 000000000..9dbf6ae18 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/940122-1.c @@ -0,0 +1,21 @@ +char *a = 0; +char *b = 0; + +g (x) + int x; +{ + if ((!!a) != (!!b)) + abort (); +} + +f (x) + int x; +{ + g (x * x); +} + +main () +{ + f (100); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/941014-1.c b/gcc/testsuite/gcc.c-torture/execute/941014-1.c new file mode 100644 index 000000000..98db91742 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/941014-1.c @@ -0,0 +1,15 @@ +int f (int a, int b) { } + +main () +{ + unsigned long addr1; + unsigned long addr2; + + addr1 = (unsigned long) &f; + addr1 += 5; + addr2 = 5 + (unsigned long) &f; + + if (addr1 != addr2) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/941014-1.x b/gcc/testsuite/gcc.c-torture/execute/941014-1.x new file mode 100644 index 000000000..bbe060ef8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/941014-1.x @@ -0,0 +1,15 @@ +# This doesn't always work for Thumb. + +if { [istarget arm*-*-*] } { + set torture_eval_before_execute { + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data { + "Thumb sets the last bit of function relocations" \ + { "arm*-*-*" } \ + { { "-mthumb" "-O0" } } \ + { "" } + } + } +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/941014-2.c b/gcc/testsuite/gcc.c-torture/execute/941014-2.c new file mode 100644 index 000000000..3932a34ce --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/941014-2.c @@ -0,0 +1,33 @@ +#include +#include + +typedef struct { + unsigned short a; + unsigned short b; +} foo_t; + +void a1 (unsigned long offset) {} + +volatile foo_t * +f () +{ + volatile foo_t *foo_p = (volatile foo_t *)malloc (sizeof (foo_t)); + + a1((unsigned long)foo_p-30); + if (foo_p->a & 0xf000) + printf("%d\n", foo_p->a); + foo_p->b = 0x0100; + a1 ((unsigned long)foo_p + 2); + a1 ((unsigned long)foo_p - 30); + return foo_p; +} + +main () +{ + volatile foo_t *foo_p; + + foo_p = f (); + if (foo_p->b != 0x0100) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/941015-1.c b/gcc/testsuite/gcc.c-torture/execute/941015-1.c new file mode 100644 index 000000000..38d479664 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/941015-1.c @@ -0,0 +1,35 @@ +int +foo1 (value) + long long value; +{ + register const long long constant = 0xc000000080000000LL; + + if (value < constant) + return 1; + else + return 2; +} + +int +foo2 (value) + unsigned long long value; +{ + register const unsigned long long constant = 0xc000000080000000LL; + + if (value < constant) + return 1; + else + return 2; +} + +main () +{ + unsigned long long value = 0xc000000000000001LL; + int x, y; + + x = foo1 (value); + y = foo2 (value); + if (x != y || x != 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/941021-1.c b/gcc/testsuite/gcc.c-torture/execute/941021-1.c new file mode 100644 index 000000000..9fc1cfadf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/941021-1.c @@ -0,0 +1,20 @@ +double glob_dbl; + +f (pdbl, value) + double *pdbl; + double value; +{ + if (pdbl == 0) + pdbl = &glob_dbl; + + *pdbl = value; +} + +main () +{ + f ((void *) 0, 55.1); + + if (glob_dbl != 55.1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/941025-1.c b/gcc/testsuite/gcc.c-torture/execute/941025-1.c new file mode 100644 index 000000000..2daf0ad25 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/941025-1.c @@ -0,0 +1,12 @@ +long f (x, y) + long x,y; +{ + return (x > 1) ? y : (y & 1); +} + +main () +{ + if (f (2L, 0xdecadeL) != 0xdecadeL) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/941031-1.c b/gcc/testsuite/gcc.c-torture/execute/941031-1.c new file mode 100644 index 000000000..134f966c6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/941031-1.c @@ -0,0 +1,27 @@ +typedef long mpt; + +int +f (mpt us, mpt vs) +{ + long aus; + long avs; + + aus = us >= 0 ? us : -us; + avs = vs >= 0 ? vs : -vs; + + if (aus < avs) + { + long t = aus; + aus = avs; + avs = aus; + } + + return avs; +} + +main () +{ + if (f ((mpt) 3, (mpt) 17) != 17) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/941101-1.c b/gcc/testsuite/gcc.c-torture/execute/941101-1.c new file mode 100644 index 000000000..66b5f384a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/941101-1.c @@ -0,0 +1,15 @@ +f () +{ + int var = 7; + + if ((var/7) == 1) + return var/7; + return 0; +} + +main () +{ + if (f () != 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/941110-1.c b/gcc/testsuite/gcc.c-torture/execute/941110-1.c new file mode 100644 index 000000000..b78256d3c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/941110-1.c @@ -0,0 +1,16 @@ +f (const int x) +{ + int y = 0; + y = x ? y : -y; + { + const int *p = &x; + } + return y; +} + +main () +{ + if (f (0)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/941202-1.c b/gcc/testsuite/gcc.c-torture/execute/941202-1.c new file mode 100644 index 000000000..72d0b33e9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/941202-1.c @@ -0,0 +1,21 @@ +g (x, y) +{ + if (x != 3) + abort (); +} + +static inline +f (int i) +{ + int *tmp; + + tmp = (int *) alloca (sizeof (i)); + *tmp = i; + g (*tmp, 0); +} + +main () +{ + f (3); + exit (0); +}; diff --git a/gcc/testsuite/gcc.c-torture/execute/950221-1.c b/gcc/testsuite/gcc.c-torture/execute/950221-1.c new file mode 100644 index 000000000..d67da5b0c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/950221-1.c @@ -0,0 +1,55 @@ +struct parsefile +{ + long fd; + char *buf; +}; +struct parsefile basepf; +struct parsefile *parsefile = &basepf; +#ifdef STACK_SIZE +int filler[STACK_SIZE / (2*sizeof(int))]; +#else +int filler[0x3000]; +#endif +int el; + +char * +g1 (a, b) + int a; + int *b; +{ +} + +g2 (a) + long a; +{ + if (a != 0xdeadbeefL) + abort (); + exit (0); +} + +f () +{ + register char *p, *q; + register int i; + register int something; + + if (parsefile->fd == 0L && el) + { + const char *rl_cp; + int len; + rl_cp = g1 (el, &len); + strcpy (p, rl_cp); + } + else + { + alabel: + i = g2 (parsefile->fd); + } +} + +main () +{ + el = 0; + parsefile->fd = 0xdeadbeefL; + f (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/950322-1.c b/gcc/testsuite/gcc.c-torture/execute/950322-1.c new file mode 100644 index 000000000..28a1469fe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/950322-1.c @@ -0,0 +1,30 @@ +f (unsigned char *a) +{ + int i, j; + int x, y; + + j = a[1]; + i = a[0] - j; + if (i < 0) + { + x = 1; + y = -i; + } + else + { + x = 0; + y = i; + } + return x + y; +} + + +main () +{ + unsigned char a[2]; + a[0] = 8; + a[1] = 9; + if (f (a) != 2) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/950426-1.c b/gcc/testsuite/gcc.c-torture/execute/950426-1.c new file mode 100644 index 000000000..076032c72 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/950426-1.c @@ -0,0 +1,32 @@ + +struct tag { + int m1; + char *m2[5]; +} s1, *p1; + +int i; + +main() +{ + s1.m1 = -1; + p1 = &s1; + + if ( func1( &p1->m1 ) == -1 ) + foo ("ok"); + else + abort (); + + i = 3; + s1.m2[3]= "123"; + + if ( strlen( (p1->m2[i])++ ) == 3 ) + foo ("ok"); + else + abort (); + + exit (0); +} + +func1(int *p) { return(*p); } + +foo (char *s) {} diff --git a/gcc/testsuite/gcc.c-torture/execute/950426-2.c b/gcc/testsuite/gcc.c-torture/execute/950426-2.c new file mode 100644 index 000000000..a1a690469 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/950426-2.c @@ -0,0 +1,13 @@ +main() +{ + long int i = -2147483647L - 1L; /* 0x80000000 */ + char ca = 1; + + if (i >> ca != -1073741824L) + abort (); + + if (i >> i / -2000000000L != -1073741824L) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/950503-1.c b/gcc/testsuite/gcc.c-torture/execute/950503-1.c new file mode 100644 index 000000000..1c95b369c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/950503-1.c @@ -0,0 +1,15 @@ +main () +{ + int tmp; + unsigned long long utmp1, utmp2; + + tmp = 16; + + utmp1 = (~((unsigned long long) 0)) >> tmp; + utmp2 = (~((unsigned long long) 0)) >> 16; + + if (utmp1 != utmp2) + abort (); + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/950511-1.c b/gcc/testsuite/gcc.c-torture/execute/950511-1.c new file mode 100644 index 000000000..6584b0c86 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/950511-1.c @@ -0,0 +1,11 @@ +main () +{ + unsigned long long xx; + unsigned long long *x = (unsigned long long *) &xx; + + *x = -3; + *x = *x * *x; + if (*x != 9) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/950512-1.c b/gcc/testsuite/gcc.c-torture/execute/950512-1.c new file mode 100644 index 000000000..8aa116d27 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/950512-1.c @@ -0,0 +1,24 @@ +unsigned +f1 (x) +{ + return ((unsigned) (x != 0) - 3) / 2; +} + +unsigned long long +f2 (x) +{ + return ((unsigned long long) (x != 0) - 3) / 2; +} + +main () +{ + if (f1 (1) != (~(unsigned) 0) >> 1) + abort (); + if (f1 (0) != ((~(unsigned) 0) >> 1) - 1) + abort (); + if (f2 (1) != (~(unsigned long long) 0) >> 1) + abort (); + if (f2 (0) != ((~(unsigned long long) 0) >> 1) - 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/950605-1.c b/gcc/testsuite/gcc.c-torture/execute/950605-1.c new file mode 100644 index 000000000..d89a42e49 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/950605-1.c @@ -0,0 +1,12 @@ +f (c) + unsigned char c; +{ + if (c != 0xFF) + abort (); +} + +main () +{ + f (-1); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/950607-1.c b/gcc/testsuite/gcc.c-torture/execute/950607-1.c new file mode 100644 index 000000000..7b1503ad1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/950607-1.c @@ -0,0 +1,9 @@ +main () +{ + struct { long status; } h; + + h.status = 0; + if (((h.status & 128) == 1) && ((h.status & 32) == 0)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/950607-2.c b/gcc/testsuite/gcc.c-torture/execute/950607-2.c new file mode 100644 index 000000000..da18f7373 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/950607-2.c @@ -0,0 +1,41 @@ +typedef struct { + long int p_x, p_y; +} Point; + +int +f (Point basePt, Point pt1, Point pt2) +{ + long long vector; + + vector = + (long long) (pt1.p_x - basePt.p_x) * (long long) (pt2.p_y - basePt.p_y) - + (long long) (pt1.p_y - basePt.p_y) * (long long) (pt2.p_x - basePt.p_x); + + if (vector > (long long) 0) + return 0; + else if (vector < (long long) 0) + return 1; + else + return 2; +} + +main () +{ + Point b, p1, p2; + int answer; + + b.p_x = -23250; + b.p_y = 23250; + + p1.p_x = 23250; + p1.p_y = -23250; + + p2.p_x = -23250; + p2.p_y = -23250; + + answer = f (b, p1, p2); + + if (answer != 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/950612-1.c b/gcc/testsuite/gcc.c-torture/execute/950612-1.c new file mode 100644 index 000000000..f9885279c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/950612-1.c @@ -0,0 +1,48 @@ +unsigned int +f1 (int diff) +{ + return ((unsigned int) (diff < 0 ? -diff : diff)); +} + +unsigned int +f2 (unsigned int diff) +{ + return ((unsigned int) ((signed int) diff < 0 ? -diff : diff)); +} + +unsigned long long +f3 (long long diff) +{ + return ((unsigned long long) (diff < 0 ? -diff : diff)); +} + +unsigned long long +f4 (unsigned long long diff) +{ + return ((unsigned long long) ((signed long long) diff < 0 ? -diff : diff)); +} + +main () +{ + int i; + for (i = 0; i <= 10; i++) + { + if (f1 (i) != i) + abort (); + if (f1 (-i) != i) + abort (); + if (f2 (i) != i) + abort (); + if (f2 (-i) != i) + abort (); + if (f3 ((long long) i) != i) + abort (); + if (f3 ((long long) -i) != i) + abort (); + if (f4 ((long long) i) != i) + abort (); + if (f4 ((long long) -i) != i) + abort (); + } + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/950621-1.c b/gcc/testsuite/gcc.c-torture/execute/950621-1.c new file mode 100644 index 000000000..5fc5a9028 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/950621-1.c @@ -0,0 +1,20 @@ +struct s +{ + int a; + int b; + struct s *dummy; +}; + +f (struct s *sp) +{ + return sp && sp->a == -1 && sp->b == -1; +} + +main () +{ + struct s x; + x.a = x.b = -1; + if (f (&x) == 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/950628-1.c b/gcc/testsuite/gcc.c-torture/execute/950628-1.c new file mode 100644 index 000000000..e330ff569 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/950628-1.c @@ -0,0 +1,31 @@ +typedef struct +{ + char hours, day, month; + short year; +} T; + +T g (void) +{ + T now; + + now.hours = 1; + now.day = 2; + now.month = 3; + now.year = 4; + return now; +} + +T f (void) +{ + T virk; + + virk = g (); + return virk; +} + +main () +{ + if (f ().hours != 1 || f ().day != 2 || f ().month != 3 || f ().year != 4) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/950704-1.c b/gcc/testsuite/gcc.c-torture/execute/950704-1.c new file mode 100644 index 000000000..f11aff8ca --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/950704-1.c @@ -0,0 +1,59 @@ +int errflag; + +long long +f (long long x, long long y) +{ + long long r; + + errflag = 0; + r = x + y; + if (x >= 0) + { + if ((y < 0) || (r >= 0)) + return r; + } + else + { + if ((y > 0) || (r < 0)) + return r; + } + errflag = 1; + return 0; +} + +main () +{ + f (0, 0); + if (errflag) + abort (); + + f (1, -1); + if (errflag) + abort (); + + f (-1, 1); + if (errflag) + abort (); + + f (0x8000000000000000LL, 0x8000000000000000LL); + if (!errflag) + abort (); + + f (0x8000000000000000LL, -1LL); + if (!errflag) + abort (); + + f (0x7fffffffffffffffLL, 0x7fffffffffffffffLL); + if (!errflag) + abort (); + + f (0x7fffffffffffffffLL, 1LL); + if (!errflag) + abort (); + + f (0x7fffffffffffffffLL, 0x8000000000000000LL); + if (errflag) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/950706-1.c b/gcc/testsuite/gcc.c-torture/execute/950706-1.c new file mode 100644 index 000000000..2db191541 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/950706-1.c @@ -0,0 +1,16 @@ +int +f (int n) +{ + return (n > 0) - (n < 0); +} + +main () +{ + if (f (-1) != -1) + abort (); + if (f (1) != 1) + abort (); + if (f (0) != 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/950710-1.c b/gcc/testsuite/gcc.c-torture/execute/950710-1.c new file mode 100644 index 000000000..26ff9b2a8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/950710-1.c @@ -0,0 +1,54 @@ +struct twelve +{ + int a; + int b; + int c; +}; + +struct pair +{ + int first; + int second; +}; + +struct pair +g () +{ + struct pair p; + return p; +} + +static void +f () +{ + int i; + for (i = 0; i < 1; i++) + { + int j; + for (j = 0; j < 1; j++) + { + if (0) + { + int k; + for (k = 0; k < 1; k++) + { + struct pair e = g (); + } + } + else + { + struct twelve a, b; + if ((((char *) &b - (char *) &a) < 0 + ? (-((char *) &b - (char *) &a)) + : ((char *) &b - (char *) &a)) < sizeof (a)) + abort (); + } + } + } +} + +main () +{ + f (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/950714-1.c b/gcc/testsuite/gcc.c-torture/execute/950714-1.c new file mode 100644 index 000000000..5dc44a906 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/950714-1.c @@ -0,0 +1,17 @@ +int array[10] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; + +main () +{ + int i, j; + int *p; + + for (i = 0; i < 10; i++) + for (p = &array[0]; p != &array[9]; p++) + if (*p == i) + goto label; + + label: + if (i != 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/950809-1.c b/gcc/testsuite/gcc.c-torture/execute/950809-1.c new file mode 100644 index 000000000..a33d42bd7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/950809-1.c @@ -0,0 +1,33 @@ +struct S +{ + int *sp, fc, *sc, a[2]; +}; + +f (struct S *x) +{ + int *t = x->sc; + int t1 = t[0]; + int t2 = t[1]; + int t3 = t[2]; + int a0 = x->a[0]; + int a1 = x->a[1]; + t[2] = t1; + t[0] = a1; + x->a[1] = a0; + x->a[0] = t3; + x->fc = t2; + x->sp = t; +} + +main () +{ + struct S s; + static int sc[3] = {2, 3, 4}; + s.sc = sc; + s.a[0] = 10; + s.a[1] = 11; + f (&s); + if (s.sp[2] != 2) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/950906-1.c b/gcc/testsuite/gcc.c-torture/execute/950906-1.c new file mode 100644 index 000000000..31997d5c2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/950906-1.c @@ -0,0 +1,16 @@ +g (int i) +{ +} + +f (int i) +{ + g (0); + while ( ({ i--; }) ) + g (0); +} + +main () +{ + f (10); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/950915-1.c b/gcc/testsuite/gcc.c-torture/execute/950915-1.c new file mode 100644 index 000000000..cfa044757 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/950915-1.c @@ -0,0 +1,15 @@ +long int a = 100000; +long int b = 21475; + +long +f () +{ + return ((long long) a * (long long) b) >> 16; +} + +main () +{ + if (f () < 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/950929-1.c b/gcc/testsuite/gcc.c-torture/execute/950929-1.c new file mode 100644 index 000000000..a35cd6a15 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/950929-1.c @@ -0,0 +1,21 @@ +int f (char *p) { } + +main () +{ + char c; + char c2; + int i = 0; + char *pc = &c; + char *pc2 = &c2; + int *pi = &i; + + *pc2 = 1; + *pi = 1; + *pc2 &= *pi; + f (pc2); + *pc2 = 1; + *pc2 &= *pi; + if (*pc2 != 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/951003-1.c b/gcc/testsuite/gcc.c-torture/execute/951003-1.c new file mode 100644 index 000000000..269bf1353 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/951003-1.c @@ -0,0 +1,21 @@ +int f (i) { return 12; } +int g () { return 0; } + +main () +{ + int i, s; + + for (i = 0; i < 32; i++) + { + s = f (i); + + if (i == g ()) + s = 42; + if (i == 0 || s == 12) + ; + else + abort (); + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/951115-1.c b/gcc/testsuite/gcc.c-torture/execute/951115-1.c new file mode 100644 index 000000000..03520c99c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/951115-1.c @@ -0,0 +1,24 @@ +int var = 0; + +g () +{ + var = 1; +} + +f () +{ + int f2 = 0; + + if (f2 == 0) + ; + + g (); +} + +main () +{ + f (); + if (var != 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/951204-1.c b/gcc/testsuite/gcc.c-torture/execute/951204-1.c new file mode 100644 index 000000000..c4d585b6b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/951204-1.c @@ -0,0 +1,18 @@ +f (char *x) +{ + *x = 'x'; +} + +main () +{ + int i; + char x = '\0'; + + for (i = 0; i < 100; ++i) + { + f (&x); + if (*(const char *) &x != 'x') + abort (); + } + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960116-1.c b/gcc/testsuite/gcc.c-torture/execute/960116-1.c new file mode 100644 index 000000000..6d7624ca1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960116-1.c @@ -0,0 +1,20 @@ +static inline +p (int *p) +{ + return !((long) p & 1); +} + +int +f (int *q) +{ + if (p (q) && *q) + return 1; + return 0; +} + +main () +{ + if (f ((int*) 0xffffffff) != 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960117-1.c b/gcc/testsuite/gcc.c-torture/execute/960117-1.c new file mode 100644 index 000000000..741455b08 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960117-1.c @@ -0,0 +1,46 @@ +static char id_space[2] [32 +1]; +typedef short COUNT; + +typedef char TEXT; + +union T_VALS +{ + TEXT *id __attribute__ ((aligned (2), packed)) ; +}; +typedef union T_VALS VALS; + +struct T_VAL +{ + COUNT pos __attribute__ ((aligned (2), packed)) ; + VALS vals __attribute__ ((aligned (2), packed)) ; +}; +typedef struct T_VAL VAL; + +VAL curval = {0}; + +static short idc = 0; +static int cur_line; +static int char_pos; + +typedef unsigned short WORD; + +WORD +get_id (char c) +{ + curval.vals.id[0] = c; +} + +WORD +get_tok () +{ + char c = 'c'; + curval.vals.id = id_space[idc]; + curval.pos = (cur_line << 10) | char_pos; + return get_id (c); +} + +main () +{ + get_tok (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960209-1.c b/gcc/testsuite/gcc.c-torture/execute/960209-1.c new file mode 100644 index 000000000..decd2af2a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960209-1.c @@ -0,0 +1,43 @@ +struct a_struct +{ + unsigned char a_character; +}; + +struct a_struct an_array[5]; +struct a_struct *a_ptr; +int yabba = 1; + +int +f (a, b) + unsigned char a; + unsigned long b; +{ + long i, j, p, q, r, s; + + if (b != (unsigned long) 0) + { + if (yabba) + return -1; + s = 4000000 / b; + for (i = 0; i < 11; i++) + { + for (j = 0; j < 256; j++) + { + if (((p - s < 0) ? -s : 0) < (( q - s < 0) ? -s : q)) + r = i; + } + } + } + + if (yabba) + return 0; + a_ptr = &an_array[a]; + a_ptr->a_character = (unsigned char) r; +} + +main () +{ + if (f (1, 0UL) != 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960215-1.c b/gcc/testsuite/gcc.c-torture/execute/960215-1.c new file mode 100644 index 000000000..9502b4b2d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960215-1.c @@ -0,0 +1,25 @@ +long double C = 2; +long double U = 1; +long double Y2 = 3; +long double Y1 = 1; +long double X, Y, Z, T, R, S; +main () +{ + X = (C + U) * Y2; + Y = C - U - U; + Z = C + U + U; + T = (C - U) * Y1; + X = X - (Z + U); + R = Y * Y1; + S = Z * Y2; + T = T - Y; + Y = (U - Y) + R; + Z = S - (Z + U + U); + R = (Y2 + U) * Y1; + Y1 = Y2 * Y1; + R = R - Y2; + Y1 = Y1 - 0.5L; + if (Z != 6) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960218-1.c b/gcc/testsuite/gcc.c-torture/execute/960218-1.c new file mode 100644 index 000000000..7301a17b0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960218-1.c @@ -0,0 +1,22 @@ +int glob; + +g (x) +{ + glob = x; + return 0; +} + +f (x) +{ + int a = ~x; + while (a) + a = g (a); +} + +main () +{ + f (3); + if (glob != -4) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960219-1.c b/gcc/testsuite/gcc.c-torture/execute/960219-1.c new file mode 100644 index 000000000..d21bcfcad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960219-1.c @@ -0,0 +1,11 @@ +f (int i) +{ + if (((1 << i) & 1) == 0) + abort (); +} + +main () +{ + f (0); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960301-1.c b/gcc/testsuite/gcc.c-torture/execute/960301-1.c new file mode 100644 index 000000000..d75efea98 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960301-1.c @@ -0,0 +1,22 @@ +struct foo { + unsigned : 12; + unsigned field : 4; +} foo; +unsigned oldfoo; + +int +bar (unsigned k) +{ + oldfoo = foo.field; + foo.field = k; + if (k) + return 1; + return 2; +} + +main () +{ + if (bar (1U) != 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960302-1.c b/gcc/testsuite/gcc.c-torture/execute/960302-1.c new file mode 100644 index 000000000..7a9426a46 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960302-1.c @@ -0,0 +1,21 @@ +long a = 1; + +foo () +{ + switch (a % 2 % 2 % 2 % 2 % 2 % 2 % 2 % 2) + { + case 0: + return 0; + case 1: + return 1; + default: + return -1; + } +} + +main () +{ + if (foo () != 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960311-1.c b/gcc/testsuite/gcc.c-torture/execute/960311-1.c new file mode 100644 index 000000000..16579d0bb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960311-1.c @@ -0,0 +1,69 @@ +#include + +#ifdef DEBUG +#define abort() printf ("error, line %d\n", __LINE__) +#endif + +int count; + +void a1() { ++count; } + +void +b (unsigned char data) +{ + if (data & 0x80) a1(); + data <<= 1; + + if (data & 0x80) a1(); + data <<= 1; + + if (data & 0x80) a1(); +} + +main () +{ + count = 0; + b (0); + if (count != 0) + abort (); + + count = 0; + b (0x80); + if (count != 1) + abort (); + + count = 0; + b (0x40); + if (count != 1) + abort (); + + count = 0; + b (0x20); + if (count != 1) + abort (); + + count = 0; + b (0xc0); + if (count != 2) + abort (); + + count = 0; + b (0xa0); + if (count != 2) + abort (); + + count = 0; + b (0x60); + if (count != 2) + abort (); + + count = 0; + b (0xe0); + if (count != 3) + abort (); + +#ifdef DEBUG + printf ("Done.\n"); +#endif + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960311-2.c b/gcc/testsuite/gcc.c-torture/execute/960311-2.c new file mode 100644 index 000000000..d5c2d07a3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960311-2.c @@ -0,0 +1,69 @@ +#include + +#ifdef DEBUG +#define abort() printf ("error, line %d\n", __LINE__) +#endif + +int count; + +void a1() { ++count; } + +void +b (unsigned short data) +{ + if (data & 0x8000) a1(); + data <<= 1; + + if (data & 0x8000) a1(); + data <<= 1; + + if (data & 0x8000) a1(); +} + +main () +{ + count = 0; + b (0); + if (count != 0) + abort (); + + count = 0; + b (0x8000); + if (count != 1) + abort (); + + count = 0; + b (0x4000); + if (count != 1) + abort (); + + count = 0; + b (0x2000); + if (count != 1) + abort (); + + count = 0; + b (0xc000); + if (count != 2) + abort (); + + count = 0; + b (0xa000); + if (count != 2) + abort (); + + count = 0; + b (0x6000); + if (count != 2) + abort (); + + count = 0; + b (0xe000); + if (count != 3) + abort (); + +#ifdef DEBUG + printf ("Done.\n"); +#endif + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960311-3.c b/gcc/testsuite/gcc.c-torture/execute/960311-3.c new file mode 100644 index 000000000..755fc723f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960311-3.c @@ -0,0 +1,69 @@ +#include + +#ifdef DEBUG +#define abort() printf ("error, line %d\n", __LINE__) +#endif + +int count; + +void a1() { ++count; } + +void +b (unsigned long data) +{ + if (data & 0x80000000) a1(); + data <<= 1; + + if (data & 0x80000000) a1(); + data <<= 1; + + if (data & 0x80000000) a1(); +} + +main () +{ + count = 0; + b (0); + if (count != 0) + abort (); + + count = 0; + b (0x80000000); + if (count != 1) + abort (); + + count = 0; + b (0x40000000); + if (count != 1) + abort (); + + count = 0; + b (0x20000000); + if (count != 1) + abort (); + + count = 0; + b (0xc0000000); + if (count != 2) + abort (); + + count = 0; + b (0xa0000000); + if (count != 2) + abort (); + + count = 0; + b (0x60000000); + if (count != 2) + abort (); + + count = 0; + b (0xe0000000); + if (count != 3) + abort (); + +#ifdef DEBUG + printf ("Done.\n"); +#endif + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960312-1.c b/gcc/testsuite/gcc.c-torture/execute/960312-1.c new file mode 100644 index 000000000..94e67df23 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960312-1.c @@ -0,0 +1,34 @@ +struct S +{ + int *sp, fc, *sc, a[2]; +}; + +f (struct S *x) +{ + int *t = x->sc; + int t1 = t[0]; + int t2 = t[1]; + int t3 = t[2]; + int a0 = x->a[0]; + int a1 = x->a[1]; + asm("": :"r" (t2), "r" (t3)); + t[2] = t1; + t[0] = a1; + x->a[1] = a0; + x->a[0] = t3; + x->fc = t2; + x->sp = t; +} + +main () +{ + struct S s; + static int sc[3] = {2, 3, 4}; + s.sc = sc; + s.a[0] = 10; + s.a[1] = 11; + f (&s); + if (s.sp[2] != 2) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960312-1.x b/gcc/testsuite/gcc.c-torture/execute/960312-1.x new file mode 100644 index 000000000..ed4bac410 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960312-1.x @@ -0,0 +1,7 @@ +# This test fails on HC11/HC12 when it is compiled without -mshort because +# is uses an asm that requires two 32-bit registers (int). It passes +# when using -mshort because there are enough registers; force -mshort. +if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } { + set options "-mshort" +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/960317-1.c b/gcc/testsuite/gcc.c-torture/execute/960317-1.c new file mode 100644 index 000000000..8d7907d75 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960317-1.c @@ -0,0 +1,22 @@ +int +f (unsigned bitcount, int mant) +{ + int mask = -1 << bitcount; + { + if (! (mant & -mask)) + goto ab; + if (mant & ~mask) + goto auf; + } +ab: + return 0; +auf: + return 1; +} + +main () +{ + if (f (0, -1)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960321-1.c b/gcc/testsuite/gcc.c-torture/execute/960321-1.c new file mode 100644 index 000000000..eafe48ff7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960321-1.c @@ -0,0 +1,14 @@ +char a[10] = "deadbeef"; + +char +acc_a (long i) +{ + return a[i-2000000000L]; +} + +main () +{ + if (acc_a (2000000000L) != 'd') + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960326-1.c b/gcc/testsuite/gcc.c-torture/execute/960326-1.c new file mode 100644 index 000000000..f20137370 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960326-1.c @@ -0,0 +1,16 @@ +struct s +{ + int a; + int b; + short c; + int d[3]; +}; + +struct s s = { .b = 3, .d = {2,0,0} }; + +main () +{ + if (s.b != 3) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960327-1.c b/gcc/testsuite/gcc.c-torture/execute/960327-1.c new file mode 100644 index 000000000..bc82cb5da --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960327-1.c @@ -0,0 +1,30 @@ +#include +g () +{ + return '\n'; +} + +f () +{ + char s[] = "abcedfg012345"; + char *sp = s + 12; + + switch (g ()) + { + case '\n': + break; + } + + while (*--sp == '0') + ; + sprintf (sp + 1, "X"); + + if (s[12] != 'X') + abort (); +} + +main () +{ + f (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960402-1.c b/gcc/testsuite/gcc.c-torture/execute/960402-1.c new file mode 100644 index 000000000..601a9a3b0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960402-1.c @@ -0,0 +1,11 @@ +f (signed long long int x) +{ + return x > 0xFFFFFFFFLL || x < -0x80000000LL; +} + +main () +{ + if (f (0) != 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960405-1.c b/gcc/testsuite/gcc.c-torture/execute/960405-1.c new file mode 100644 index 000000000..d8480cc2c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960405-1.c @@ -0,0 +1,13 @@ +#define X 5.9486574767861588254287966331400356538172e4931L + +long double x = X + X; +long double y = 2.0L * X; + +main () +{ +#if ! defined (__vax__) && ! defined (_CRAY) + if (x != y) + abort (); +#endif + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960416-1.c b/gcc/testsuite/gcc.c-torture/execute/960416-1.c new file mode 100644 index 000000000..f7cb05680 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960416-1.c @@ -0,0 +1,63 @@ +typedef unsigned long int st; +typedef unsigned long long dt; +typedef union +{ + dt d; + struct + { + st h, l; + } + s; +} t_be; + +typedef union +{ + dt d; + struct + { + st l, h; + } + s; +} t_le; + +#define df(f, t) \ +int \ +f (t afh, t bfh) \ +{ \ + t hh; \ + t hp, lp, dp, m; \ + st ad, bd; \ + int s; \ + s = 0; \ + ad = afh.s.h - afh.s.l; \ + bd = bfh.s.l - bfh.s.h; \ + if (bd > bfh.s.l) \ + { \ + bd = -bd; \ + s = ~s; \ + } \ + lp.d = (dt) afh.s.l * bfh.s.l; \ + hp.d = (dt) afh.s.h * bfh.s.h; \ + dp.d = (dt) ad *bd; \ + dp.d ^= s; \ + hh.d = hp.d + hp.s.h + lp.s.h + dp.s.h; \ + m.d = (dt) lp.s.h + hp.s.l + lp.s.l + dp.s.l; \ + return hh.s.l + m.s.l; \ +} + +df(f_le, t_le) +df(f_be, t_be) + +main () +{ + t_be x; + x.s.h = 0x10000000U; + x.s.l = 0xe0000000U; + if (x.d == 0x10000000e0000000ULL + && f_be ((t_be) 0x100000000ULL, (t_be) 0x100000000ULL) != -1) + abort (); + if (x.d == 0xe000000010000000ULL + && f_le ((t_le) 0x100000000ULL, (t_le) 0x100000000ULL) != -1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960419-1.c b/gcc/testsuite/gcc.c-torture/execute/960419-1.c new file mode 100644 index 000000000..68bd2b97d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960419-1.c @@ -0,0 +1,17 @@ +static int i; + +void +check(x) + int x; +{ + if (!x) + abort(); +} + +main() +{ + int *p = &i; + + check(p != (void *)0); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960419-2.c b/gcc/testsuite/gcc.c-torture/execute/960419-2.c new file mode 100644 index 000000000..c9526dcd7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960419-2.c @@ -0,0 +1,13 @@ +#define SIZE 8 + +main() +{ + int a[SIZE] = {1}; + int i; + + for (i = 1; i < SIZE; i++) + if (a[i] != 0) + abort(); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960512-1.c b/gcc/testsuite/gcc.c-torture/execute/960512-1.c new file mode 100644 index 000000000..a7c1d5fb4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960512-1.c @@ -0,0 +1,19 @@ +__complex__ +double f () +{ + int a[40]; + __complex__ double c; + + a[9] = 0; + c = a[9]; + return c; +} + +main () +{ + __complex__ double c; + + if (c = f ()) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960513-1.c b/gcc/testsuite/gcc.c-torture/execute/960513-1.c new file mode 100644 index 000000000..acc263ca6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960513-1.c @@ -0,0 +1,25 @@ +long double +f (d, i) + long double d; + int i; +{ + long double e; + + d = -d; + e = d; + if (i == 1) + d *= 2; + d -= e * d; + d -= e * d; + d -= e * d; + d -= e * d; + d -= e * d; + return d; +} + +main () +{ + if (! (int) (f (2.0L, 1))) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960521-1.c b/gcc/testsuite/gcc.c-torture/execute/960521-1.c new file mode 100644 index 000000000..9fc582149 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960521-1.c @@ -0,0 +1,30 @@ +#include + +int *a, *b; +int n; + +#ifdef STACK_SIZE +#define BLOCK_SIZE (STACK_SIZE / (sizeof (*a) + sizeof (*b))) +#else +#define BLOCK_SIZE 32768 +#endif +foo () +{ + int i; + for (i = 0; i < n; i++) + a[i] = -1; + for (i = 0; i < BLOCK_SIZE - 1; i++) + b[i] = -1; +} + +main () +{ + n = BLOCK_SIZE; + a = malloc (n * sizeof(*a)); + b = malloc (n * sizeof(*b)); + *b++ = 0; + foo (); + if (b[-1]) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960608-1.c b/gcc/testsuite/gcc.c-torture/execute/960608-1.c new file mode 100644 index 000000000..1f47d02d9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960608-1.c @@ -0,0 +1,34 @@ +typedef struct +{ + unsigned char a : 2; + unsigned char b : 3; + unsigned char c : 1; + unsigned char d : 1; + unsigned char e : 1; +} a_struct; + +foo (flags) + a_struct *flags; +{ + return (flags->c != 0 + || flags->d != 1 + || flags->e != 1 + || flags->a != 2 + || flags->b != 3); +} + +main () +{ + a_struct flags; + + flags.c = 0; + flags.d = 1; + flags.e = 1; + flags.a = 2; + flags.b = 3; + + if (foo (&flags) != 0) + abort (); + else + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960801-1.c b/gcc/testsuite/gcc.c-torture/execute/960801-1.c new file mode 100644 index 000000000..170726918 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960801-1.c @@ -0,0 +1,32 @@ +unsigned +f () +{ + long long l2; + unsigned short us; + unsigned long long ul; + short s2; + + ul = us = l2 = s2 = -1; + return ul; +} + +unsigned long long +g () +{ + long long l2; + unsigned short us; + unsigned long long ul; + short s2; + + ul = us = l2 = s2 = -1; + return ul; +} + +main () +{ + if (f () != (unsigned short) -1) + abort (); + if (g () != (unsigned short) -1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960802-1.c b/gcc/testsuite/gcc.c-torture/execute/960802-1.c new file mode 100644 index 000000000..f9ee75260 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960802-1.c @@ -0,0 +1,36 @@ +long val = 0x5e000000; + +long +f1 (void) +{ + return 0x132; +} + +long +f2 (void) +{ + return 0x5e000000; +} + +void +f3 (long b) +{ + val = b; +} + +void +f4 () +{ + long v = f1 (); + long o = f2 (); + v = (v & 0x00ffffff) | (o & 0xff000000); + f3 (v); +} + +main () +{ + f4 (); + if (val != 0x5e000132) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960830-1.c b/gcc/testsuite/gcc.c-torture/execute/960830-1.c new file mode 100644 index 000000000..d87b39e2d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960830-1.c @@ -0,0 +1,22 @@ +#ifdef __i386__ +f (rp) + unsigned int *rp; +{ + __asm__ ("mull %3" : "=a" (rp[0]), "=d" (rp[1]) : "%0" (7), "rm" (7)); +} + +main () +{ + unsigned int s[2]; + + f (s); + if (s[1] != 0 || s[0] != 49) + abort (); + exit (0); +} +#else +main () +{ + exit (0); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/960909-1.c b/gcc/testsuite/gcc.c-torture/execute/960909-1.c new file mode 100644 index 000000000..de1ed9339 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960909-1.c @@ -0,0 +1,29 @@ +int +ffs (x) + int x; +{ + int bit, mask; + + if (x == 0) + return 0; + + for (bit = 1, mask = 1; !(x & mask); bit++, mask <<= 1) + ; + + return bit; +} + +f (x) + int x; +{ + int y; + y = ffs (x) - 1; + if (y < 0) + abort (); +} + +main () +{ + f (1); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/961004-1.c b/gcc/testsuite/gcc.c-torture/execute/961004-1.c new file mode 100644 index 000000000..7ebba2d7b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/961004-1.c @@ -0,0 +1,22 @@ +int k = 0; + +main() +{ + int i; + int j; + + for (i = 0; i < 2; i++) + { + if (k) + { + if (j != 2) + abort (); + } + else + { + j = 2; + k++; + } + } + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/961017-1.c b/gcc/testsuite/gcc.c-torture/execute/961017-1.c new file mode 100644 index 000000000..88c9d9505 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/961017-1.c @@ -0,0 +1,8 @@ +main () +{ + unsigned char z = 0; + + do ; + while (--z > 0); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/961017-2.c b/gcc/testsuite/gcc.c-torture/execute/961017-2.c new file mode 100644 index 000000000..768ddbc6e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/961017-2.c @@ -0,0 +1,32 @@ +main () +{ + int i = 0; + + + if (sizeof (unsigned long int) == 4) + { + unsigned long int z = 0; + + do { + z -= 0x00004000; + i++; + if (i > 0x00040000) + abort (); + } while (z > 0); + exit (0); + } + else if (sizeof (unsigned int) == 4) + { + unsigned int z = 0; + + do { + z -= 0x00004000; + i++; + if (i > 0x00040000) + abort (); + } while (z > 0); + exit (0); + } + else + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/961026-1.c b/gcc/testsuite/gcc.c-torture/execute/961026-1.c new file mode 100644 index 000000000..942a6eb13 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/961026-1.c @@ -0,0 +1,17 @@ +int +test (arg) + int arg; +{ + if (arg > 0 || arg == 0) + return 0; + return -1; +} + +main () +{ + if (test (0) != 0) + abort (); + if (test (-1) != -1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/961112-1.c b/gcc/testsuite/gcc.c-torture/execute/961112-1.c new file mode 100644 index 000000000..4b1c31222 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/961112-1.c @@ -0,0 +1,13 @@ +f (x) +{ + if (x != 0 || x == 0) + return 0; + return 1; +} + +main () +{ + if (f (3)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/961122-1.c b/gcc/testsuite/gcc.c-torture/execute/961122-1.c new file mode 100644 index 000000000..1f0a63463 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/961122-1.c @@ -0,0 +1,23 @@ +long long acc; + +addhi (short a) +{ + acc += (long long) a << 32; +} + +subhi (short a) +{ + acc -= (long long) a << 32; +} + +main () +{ + acc = 0xffff00000000ll; + addhi (1); + if (acc != 0x1000000000000ll) + abort (); + subhi (1); + if (acc != 0xffff00000000ll) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/961122-2.c b/gcc/testsuite/gcc.c-torture/execute/961122-2.c new file mode 100644 index 000000000..81e404ec4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/961122-2.c @@ -0,0 +1,12 @@ +int +f (int a) +{ + return ((a >= 0 && a <= 10) && ! (a >= 0)); +} + +main () +{ + if (f (0)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/961125-1.c b/gcc/testsuite/gcc.c-torture/execute/961125-1.c new file mode 100644 index 000000000..7fe3dd454 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/961125-1.c @@ -0,0 +1,33 @@ +static char * +begfield (int tab, char *ptr, char *lim, int sword, int schar) +{ + if (tab) + { + while (ptr < lim && sword--) + { + while (ptr < lim && *ptr != tab) + ++ptr; + if (ptr < lim) + ++ptr; + } + } + else + { + while (1) + ; + } + + if (ptr + schar <= lim) + ptr += schar; + + return ptr; +} + +main () +{ + char *s = ":ab"; + char *lim = s + 3; + if (begfield (':', s, lim, 1, 1) != s + 2) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/961206-1.c b/gcc/testsuite/gcc.c-torture/execute/961206-1.c new file mode 100644 index 000000000..943ac6680 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/961206-1.c @@ -0,0 +1,52 @@ +int +sub1 (unsigned long long i) +{ + if (i < 0x80000000) + return 1; + else + return 0; +} + +int +sub2 (unsigned long long i) +{ + if (i <= 0x7FFFFFFF) + return 1; + else + return 0; +} + +int +sub3 (unsigned long long i) +{ + if (i >= 0x80000000) + return 0; + else + return 1; +} + +int +sub4 (unsigned long long i) +{ + if (i > 0x7FFFFFFF) + return 0; + else + return 1; +} + +main() +{ + if (sub1 (0x80000000ULL)) + abort (); + + if (sub2 (0x80000000ULL)) + abort (); + + if (sub3 (0x80000000ULL)) + abort (); + + if (sub4 (0x80000000ULL)) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/961213-1.c b/gcc/testsuite/gcc.c-torture/execute/961213-1.c new file mode 100644 index 000000000..12bb27f31 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/961213-1.c @@ -0,0 +1,22 @@ +int +g (unsigned long long int *v, int n, unsigned int a[], int b) +{ + int cnt; + *v = 0; + for (cnt = 0; cnt < n; ++cnt) + *v = *v * b + a[cnt]; + return n; +} + +main () +{ + int res; + unsigned int ar[] = { 10, 11, 12, 13, 14 }; + unsigned long long int v; + + res = g (&v, sizeof(ar)/sizeof(ar[0]), ar, 16); + if (v != 0xabcdeUL) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/961223-1.c b/gcc/testsuite/gcc.c-torture/execute/961223-1.c new file mode 100644 index 000000000..9bc6cfa35 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/961223-1.c @@ -0,0 +1,19 @@ +struct s { + double d; +}; + +inline struct s +sub (struct s s) +{ + s.d += 1.0; + return s; +} + +main () +{ + struct s t = { 2.0 }; + t = sub (t); + if (t.d != 3.0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/970214-1.c b/gcc/testsuite/gcc.c-torture/execute/970214-1.c new file mode 100644 index 000000000..4a06dfebc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/970214-1.c @@ -0,0 +1,5 @@ +#define L 1 +main () +{ + exit (L'1' != L'1'); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/970214-2.c b/gcc/testsuite/gcc.c-torture/execute/970214-2.c new file mode 100644 index 000000000..cb9007625 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/970214-2.c @@ -0,0 +1,5 @@ +#define m(L) (L'1' + (L)) +main () +{ + exit (m (0) != L'1'); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/970217-1.c b/gcc/testsuite/gcc.c-torture/execute/970217-1.c new file mode 100644 index 000000000..09e716a33 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/970217-1.c @@ -0,0 +1,10 @@ +sub (int i, int array[i++]) +{ + return i; +} + +main() +{ + int array[10]; + exit (sub (10, array) != 11); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/970923-1.c b/gcc/testsuite/gcc.c-torture/execute/970923-1.c new file mode 100644 index 000000000..1d78b47c7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/970923-1.c @@ -0,0 +1,27 @@ +int +ts(a) + int a; +{ + if (a < 1000 && a > 2000) + return 1; + else + return 0; +} + +int +tu(a) + unsigned int a; +{ + if (a < 1000 && a > 2000) + return 1; + else + return 0; +} + + +main() +{ + if (ts (0) || tu (0)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/980205.c b/gcc/testsuite/gcc.c-torture/execute/980205.c new file mode 100644 index 000000000..da15d3c4d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980205.c @@ -0,0 +1,20 @@ +#include + +void fdouble (double one, ...) +{ + double value; + va_list ap; + + va_start (ap, one); + value = va_arg (ap, double); + va_end (ap); + + if (one != 1.0 || value != 2.0) + abort (); +} + +int main () +{ + fdouble (1.0, 2.0); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/980223.c b/gcc/testsuite/gcc.c-torture/execute/980223.c new file mode 100644 index 000000000..490873441 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980223.c @@ -0,0 +1,31 @@ +typedef struct { char *addr; long type; } object; + +object bar (object blah) +{ + abort(); +} + +object foo (object x, object y) +{ + object z = *(object*)(x.addr); + if (z.type & 64) + { + y = *(object*)(z.addr+sizeof(object)); + z = *(object*)(z.addr); + if (z.type & 64) + y = bar(y); + } + return y; +} + +int nil; +object cons1[2] = { {(char *) &nil, 0}, {(char *) &nil, 0} }; +object cons2[2] = { {(char *) &cons1, 64}, {(char *) &nil, 0} }; + +main() +{ + object x = {(char *) &cons2, 64}; + object y = {(char *) &nil, 0}; + object three = foo(x,y); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/980424-1.c b/gcc/testsuite/gcc.c-torture/execute/980424-1.c new file mode 100644 index 000000000..514e91773 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980424-1.c @@ -0,0 +1,22 @@ +int i, a[99]; + +void f (int one) +{ + if (one != 1) + abort (); +} + +void +g () +{ + f (a[i & 0x3f]); +} + +int +main () +{ + a[0] = 1; + i = 0x40; + g (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/980505-1.c b/gcc/testsuite/gcc.c-torture/execute/980505-1.c new file mode 100644 index 000000000..905241164 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980505-1.c @@ -0,0 +1,11 @@ +static int f(int) __attribute__((const)); +int main() +{ + int f1, f2, x; + x = 1; f1 = f(x); + x = 2; f2 = f(x); + if (f1 != 1 || f2 != 2) + abort (); + exit (0); +} +static int f(int x) { return x; } diff --git a/gcc/testsuite/gcc.c-torture/execute/980505-2.c b/gcc/testsuite/gcc.c-torture/execute/980505-2.c new file mode 100644 index 000000000..d0d8aa8c6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980505-2.c @@ -0,0 +1,22 @@ +typedef unsigned short Uint16; +typedef unsigned int Uint; + +Uint f () +{ + Uint16 token; + Uint count; + static Uint16 values[1] = {0x9300}; + + token = values[0]; + count = token >> 8; + + return count; +} + +int +main () +{ + if (f () != 0x93) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/980506-1.c b/gcc/testsuite/gcc.c-torture/execute/980506-1.c new file mode 100644 index 000000000..a48b3ad4c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980506-1.c @@ -0,0 +1,26 @@ +struct decision +{ + char enforce_mode; + struct decision *next; +}; + + +static void +clear_modes (p) + register struct decision *p; +{ + goto blah; + +foo: + p->enforce_mode = 0; +blah: + if (p) + goto foo; +} + +main() +{ + struct decision *p = 0; + clear_modes (p); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/980506-2.c b/gcc/testsuite/gcc.c-torture/execute/980506-2.c new file mode 100644 index 000000000..4dd9a2c48 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980506-2.c @@ -0,0 +1,22 @@ +static void *self(void *p){ return p; } + +int +f() +{ + struct { int i; } s, *sp; + int *ip = &s.i; + + s.i = 1; + sp = self(&s); + + *ip = 0; + return sp->i+1; +} + +main() +{ + if (f () != 1) + abort (); + else + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/980506-3.c b/gcc/testsuite/gcc.c-torture/execute/980506-3.c new file mode 100644 index 000000000..a943e9ad6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980506-3.c @@ -0,0 +1,24 @@ +unsigned char lookup_table [257]; + +static int +build_lookup (pattern) + unsigned char *pattern; +{ + int m; + + m = strlen (pattern) - 1; + + memset (lookup_table, ++m, 257); + return m; +} + +int main(argc, argv) + int argc; + char **argv; +{ + if (build_lookup ("bind") != 4) + abort (); + else + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/980526-1.c b/gcc/testsuite/gcc.c-torture/execute/980526-1.c new file mode 100644 index 000000000..57a910e43 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980526-1.c @@ -0,0 +1,37 @@ +int expect_do1 = 1, expect_do2 = 2; + +static int doit(int x){ + __label__ lbl1; + __label__ lbl2; + static int jtab_init = 0; + static void *jtab[2]; + + if(!jtab_init) { + jtab[0] = &&lbl1; + jtab[1] = &&lbl2; + jtab_init = 1; + } + goto *jtab[x]; +lbl1: + return 1; +lbl2: + return 2; +} + +static void do1(void) { + if (doit(0) != expect_do1) + abort (); +} + +static void do2(void){ + if (doit(1) != expect_do2) + abort (); +} + +int main(void){ +#ifndef NO_LABEL_VALUES + do1(); + do2(); +#endif + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/980526-2.c b/gcc/testsuite/gcc.c-torture/execute/980526-2.c new file mode 100644 index 000000000..c17f4ea6d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980526-2.c @@ -0,0 +1,57 @@ +typedef unsigned int dev_t; +typedef unsigned int kdev_t; + +static inline kdev_t to_kdev_t(int dev) +{ + int major, minor; + + if (sizeof(kdev_t) == 16) + return (kdev_t)dev; + major = (dev >> 8); + minor = (dev & 0xff); + return ((( major ) << 22 ) | ( minor )) ; + +} + +void do_mknod(const char * filename, int mode, kdev_t dev) +{ + if (dev==0x15800078) + exit(0); + else + abort(); +} + + +char * getname(const char * filename) +{ + register unsigned int a1,a2,a3,a4,a5,a6,a7,a8,a9; + a1 = (unsigned int)(filename) *5 + 1; + a2 = (unsigned int)(filename) *6 + 2; + a3 = (unsigned int)(filename) *7 + 3; + a4 = (unsigned int)(filename) *8 + 4; + a5 = (unsigned int)(filename) *9 + 5; + a6 = (unsigned int)(filename) *10 + 5; + a7 = (unsigned int)(filename) *11 + 5; + a8 = (unsigned int)(filename) *12 + 5; + a9 = (unsigned int)(filename) *13 + 5; + return (char *)(a1*a2+a3*a4+a5*a6+a7*a8+a9); +} + +int sys_mknod(const char * filename, int mode, dev_t dev) +{ + int error; + char * tmp; + + tmp = getname(filename); + error = ((long)( tmp )) ; + do_mknod(tmp,mode,to_kdev_t(dev)); + return error; +} + +int main(void) +{ + if (sizeof (int) != 4) + exit (0); + + return sys_mknod("test",1,0x12345678); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/980526-3.c b/gcc/testsuite/gcc.c-torture/execute/980526-3.c new file mode 100644 index 000000000..a564174e2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980526-3.c @@ -0,0 +1,20 @@ +int compare(x, y) +unsigned int x; +unsigned int y; +{ + if (x==y) + return 0; + else + return 1; +} + +main() +{ + unsigned int i, j, k, l; + i = 5; j = 2; k=0; l=2; + if (compare(5%(~(unsigned) 2), i%~j) + || compare(0, k%~l)) + abort(); + else + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/980602-1.c b/gcc/testsuite/gcc.c-torture/execute/980602-1.c new file mode 100644 index 000000000..2df728374 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980602-1.c @@ -0,0 +1,10 @@ +main() +{ + int i; + for (i = 1; i < 100; i++) + ; + if (i == 100) + exit (0); + abort (); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/980602-2.c b/gcc/testsuite/gcc.c-torture/execute/980602-2.c new file mode 100644 index 000000000..972553ed5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980602-2.c @@ -0,0 +1,21 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int +main (void) +{ + exit (0); +} +#else +struct { + unsigned bit : 30; +} t; + +int main() +{ + if (!(t.bit++)) + exit (0); + else + abort (); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/980604-1.c b/gcc/testsuite/gcc.c-torture/execute/980604-1.c new file mode 100644 index 000000000..8992a90c6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980604-1.c @@ -0,0 +1,20 @@ +int a = 1; +int b = -1; + +int c = 1; +int d = 0; + +main () +{ + double e; + double f; + double g; + + f = c; + g = d; + e = (a < b) ? f : g; + if (e) + abort (); + exit(0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/980605-1.c b/gcc/testsuite/gcc.c-torture/execute/980605-1.c new file mode 100644 index 000000000..2fc2691e5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980605-1.c @@ -0,0 +1,78 @@ +#include + +#ifndef STACK_SIZE +#define STACK_SIZE 200000 +#endif + +__inline__ static int +dummy (x) +{ + int y; + y = (long) (x * 4711.3); + return y; +} + +int getval (void); + +int +f2 (double x) +{ + unsigned short s; + int a, b, c, d, e, f, g, h, i, j; + + a = getval (); + b = getval (); + c = getval (); + d = getval (); + e = getval (); + f = getval (); + g = getval (); + h = getval (); + i = getval (); + j = getval (); + + + s = x; + + return a + b + c + d + e + f + g + h + i + j + s; +} + +int x = 1; + +int +getval (void) +{ + return x++; +} + +char buf[10]; + +void +f () +{ + char ar[STACK_SIZE/2]; + int a, b, c, d, e, f, g, h, i, j, k; + + a = getval (); + b = getval (); + c = getval (); + d = getval (); + e = getval (); + f = getval (); + g = getval (); + h = getval (); + i = getval (); + j = getval (); + + k = f2 (17.0); + + sprintf (buf, "%d\n", a + b + c + d + e + f + g + h + i + j + k); + if (a + b + c + d + e + f + g + h + i + j + k != 227) + abort (); +} + +main () +{ + f (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/980608-1.c b/gcc/testsuite/gcc.c-torture/execute/980608-1.c new file mode 100644 index 000000000..b34d13749 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980608-1.c @@ -0,0 +1,36 @@ +#include + +void f1(int a,int b,int c,int d,int e, int f,int g,int h,int i,int j, int k,int +l,int m,int n,int o) +{ + return; +} + +inline void debug(const char *msg,...) +{ + va_list ap; + va_start( ap, msg ); + + f1(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15); + + if ( va_arg(ap,int) != 101) + abort(); + if ( va_arg(ap,int) != 102) + abort(); + if ( va_arg(ap,int) != 103) + abort(); + if ( va_arg(ap,int) != 104) + abort(); + if ( va_arg(ap,int) != 105) + abort(); + if ( va_arg(ap,int) != 106) + abort(); + + va_end( ap ); +} + +int main(void) +{ + debug("%d %d %d %d %d %d\n", 101, 102, 103, 104, 105, 106); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/980612-1.c b/gcc/testsuite/gcc.c-torture/execute/980612-1.c new file mode 100644 index 000000000..db2438731 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980612-1.c @@ -0,0 +1,17 @@ +struct fd +{ + unsigned char a; + unsigned char b; +} f = { 5 }; + +struct fd *g() { return &f; } +int h() { return -1; } + +int main() +{ + struct fd *f = g(); + f->b = h(); + if (((f->a & 0x7f) & ~0x10) <= 2) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/980617-1.c b/gcc/testsuite/gcc.c-torture/execute/980617-1.c new file mode 100644 index 000000000..5f7768aca --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980617-1.c @@ -0,0 +1,14 @@ +void foo (unsigned int * p) +{ + if ((signed char)(*p & 0xFF) == 17 || (signed char)(*p & 0xFF) == 18) + return; + else + abort (); +} + +int main () +{ + int i = 0x30011; + foo(&i); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/980618-1.c b/gcc/testsuite/gcc.c-torture/execute/980618-1.c new file mode 100644 index 000000000..59db7f28b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980618-1.c @@ -0,0 +1,16 @@ +void func(int, int); + +int main() +{ + int x = 7; + func(!x, !7); + exit (0); +} + +void func(int x, int y) +{ + if (x == y) + return; + else + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/980701-1.c b/gcc/testsuite/gcc.c-torture/execute/980701-1.c new file mode 100644 index 000000000..391cc0ee1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980701-1.c @@ -0,0 +1,22 @@ +ns_name_skip (unsigned char **x, unsigned char *y) +{ + *x = 0; + return 0; +} + +unsigned char a[2]; + +int dn_skipname(unsigned char *ptr, unsigned char *eom) { + unsigned char *saveptr = ptr; + + if (ns_name_skip(&ptr, eom) == -1) + return (-1); + return (ptr - saveptr); +} + +main() +{ + if (dn_skipname (&a[0], &a[1]) == 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/980707-1.c b/gcc/testsuite/gcc.c-torture/execute/980707-1.c new file mode 100644 index 000000000..5095abe46 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980707-1.c @@ -0,0 +1,45 @@ +#include +#include + +char ** +buildargv (char *input) +{ + static char *arglist[256]; + int numargs = 0; + + while (1) + { + while (*input == ' ') + input++; + if (*input == 0) + break; + arglist [numargs++] = input; + while (*input != ' ' && *input != 0) + input++; + if (*input == 0) + break; + *(input++) = 0; + } + arglist [numargs] = NULL; + return arglist; +} + + +int main() +{ + char **args; + char input[256]; + int i; + + strcpy(input, " a b"); + args = buildargv(input); + + if (strcmp (args[0], "a")) + abort (); + if (strcmp (args[1], "b")) + abort (); + if (args[2] != NULL) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/980709-1.c b/gcc/testsuite/gcc.c-torture/execute/980709-1.c new file mode 100644 index 000000000..cda80765a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980709-1.c @@ -0,0 +1,14 @@ +#include + +main() +{ + volatile double a; + double c; + a = 32.0; + c = pow(a, 1.0/3.0); + if (c + 0.1 > 3.174802 + && c - 0.1 < 3.174802) + exit (0); + else + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/980709-1.x b/gcc/testsuite/gcc.c-torture/execute/980709-1.x new file mode 100644 index 000000000..f64f55886 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980709-1.x @@ -0,0 +1,20 @@ +# pow() is not available on m6811/m6812 target, this test will not link. +if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"]} { + return 1 +} +# XFAIL this test for AIX using -msoft-float. +# This test calls the system libm.a function pow. +# A false failure is reported if -msoft-float is used. +# AIX expects the the parameters to be passed in fp regs. +if { [istarget powerpc-*-aix*] || [istarget rs6000-*-aix*] } { + set torture_eval_before_execute { + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data { + "Can not call system libm.a with -msoft-float" \ + "*-*-aix*" \ + { "-msoft-float" } \ + { "" } + } + } +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/980716-1.c b/gcc/testsuite/gcc.c-torture/execute/980716-1.c new file mode 100644 index 000000000..91e5518d5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980716-1.c @@ -0,0 +1,26 @@ +#include + +void +stub(int num, ...) +{ + va_list ap; + char *end; + int i; + + for (i = 0; i < 2; i++) { + va_start(ap, num); + while ( 1 ) { + end = va_arg(ap, char *); + if (!end) break; + } + va_end(ap); + } +} + +int +main() +{ + stub(1, "ab", "bc", "cx", 0); + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/980929-1.c b/gcc/testsuite/gcc.c-torture/execute/980929-1.c new file mode 100644 index 000000000..1d9246e01 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/980929-1.c @@ -0,0 +1,21 @@ +void f(int i) +{ + if (i != 1000) + abort (); +} + + +int main() +{ + int n=1000; + int i; + + f(n); + for(i=0; i<1; ++i) { + f(n); + n=666; + &n; + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/981001-1.c b/gcc/testsuite/gcc.c-torture/execute/981001-1.c new file mode 100644 index 000000000..da63f4796 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/981001-1.c @@ -0,0 +1,38 @@ +#define NG 0x100L + +unsigned long flg = 0; + +long sub (int n) +{ + int a, b ; + + if (n >= 2) + { + if (n % 2 == 0) + { + a = sub (n / 2); + + return (a + 2 * sub (n / 2 - 1)) * a; + } + else + { + a = sub (n / 2 + 1); + b = sub (n / 2); + + return a * a + b * b; + } + } + else + return (long) n; +} + +int main (void) +{ + if (sub (30) != 832040L) + flg |= NG; + + if (flg) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/981019-1.c b/gcc/testsuite/gcc.c-torture/execute/981019-1.c new file mode 100644 index 000000000..5d1f00900 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/981019-1.c @@ -0,0 +1,44 @@ +extern int f2(void); +extern int f3(void); +extern void f1(void); + +void +ff(int fname, int part, int nparts) +{ + if (fname) /* bb 0 */ + { + if (nparts) /* bb 1 */ + f1(); /* bb 2 */ + } + else + fname = 2; /* bb 3 */ + + /* bb 4 is the branch to bb 10 + (bb 10 is physically at the end of the loop) */ + while (f3() /* bb 10 */) + { + if (nparts /* bb 5 */ && f2() /* bb 6 */) + { + f1(); /* bb 7 ... */ + nparts = part; + if (f3()) /* ... bb 7 */ + f1(); /* bb 8 */ + f1(); /* bb 9 */ + break; + } + } + + if (nparts) /* bb 11 */ + f1(); /* bb 12 */ + return; /* bb 13 */ +} + +int main(void) +{ + ff(0, 1, 0); + return 0; +} + +int f3(void) { static int x = 0; x = !x; return x; } +void f1(void) { abort(); } +int f2(void) { abort(); } diff --git a/gcc/testsuite/gcc.c-torture/execute/981130-1.c b/gcc/testsuite/gcc.c-torture/execute/981130-1.c new file mode 100644 index 000000000..72630b07e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/981130-1.c @@ -0,0 +1,30 @@ +struct s { int a; int b;}; +struct s s1; +struct s s2 = { 1, 2, }; + +void +check (a, b) + int a; + int b; +{ + if (a == b) + exit (0); + else + abort (); +} + +int +main () +{ + int * p; + int x; + + s1.a = 9; + p = & s1.a; + s1 = s2; + x = * p; + + check (x, 1); +} + + diff --git a/gcc/testsuite/gcc.c-torture/execute/981130-1.x b/gcc/testsuite/gcc.c-torture/execute/981130-1.x new file mode 100644 index 000000000..1565c68ad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/981130-1.x @@ -0,0 +1,22 @@ +# This test is known to fail on targets that use the instruction scheduler +# at optimisation levels of 2 or more because the alias analysis is confused +# by the reassignment of a variable structure to a fixed structure. The +# failure could be suppressed by preventing instruction scheduling: +# +# set additional_flags "-fno-schedule-insns2"; +# +# but this would disguise the fact that there is a problem. Instead we use +# we generate an xfail result and explain that it is alias analysis that +# is at fault. + +set torture_eval_before_execute { + + set compiler_conditional_xfail_data { + "alias analysis conflicts with instruction scheduling" \ + "m32r-*-*" \ + { "-O2" "-O1" "-O0" "-Os"} \ + { "" } + } +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/981206-1.c b/gcc/testsuite/gcc.c-torture/execute/981206-1.c new file mode 100644 index 000000000..12ec0ab18 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/981206-1.c @@ -0,0 +1,17 @@ +/* Verify unaligned address aliasing on Alpha EV[45]. */ + +static unsigned short x, y; + +void foo() +{ + x = 0x345; + y = 0x567; +} + +int main() +{ + foo (); + if (x != 0x345 || y != 0x567) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990106-1.c b/gcc/testsuite/gcc.c-torture/execute/990106-1.c new file mode 100644 index 000000000..6631bfd96 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990106-1.c @@ -0,0 +1,16 @@ +foo(bufp) +char *bufp; +{ + int x = 80; + return (*bufp++ = x ? 'a' : 'b'); +} + +main() +{ + char x; + + if (foo (&x) != 'a') + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990106-2.c b/gcc/testsuite/gcc.c-torture/execute/990106-2.c new file mode 100644 index 000000000..c2791efaa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990106-2.c @@ -0,0 +1,22 @@ +unsigned calc_mp(unsigned mod) +{ + unsigned a,b,c; + c=-1; + a=c/mod; + b=0-a*mod; + if (b > mod) { a += 1; b-=mod; } + return b; +} + +int main(int argc, char *argv[]) +{ + unsigned x = 1234; + unsigned y = calc_mp(x); + + if ((sizeof (y) == 4 && y != 680) + || (sizeof (y) == 2 && y != 134)) + abort (); + exit (0); +} + + diff --git a/gcc/testsuite/gcc.c-torture/execute/990117-1.c b/gcc/testsuite/gcc.c-torture/execute/990117-1.c new file mode 100644 index 000000000..9589ae746 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990117-1.c @@ -0,0 +1,16 @@ +int +foo (int x, int y, int i, int j) +{ + double tmp1 = ((double) x / y); + double tmp2 = ((double) i / j); + + return tmp1 < tmp2; +} + +main () +{ + if (foo (2, 24, 3, 4) == 0) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/990127-1.c b/gcc/testsuite/gcc.c-torture/execute/990127-1.c new file mode 100644 index 000000000..c49584820 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990127-1.c @@ -0,0 +1,31 @@ +main() +{ + int a,b,c; + int *pa, *pb, *pc; + int **ppa, **ppb, **ppc; + int i,j,k,x,y,z; + + a = 10; + b = 20; + c = 30; + pa = &a; pb = &b; pc = &c; + ppa = &pa; ppb = &pb; ppc = &pc; + x = 0; y = 0; z = 0; + + for(i=0;i<10;i++){ + if( pa == &a ) pa = &b; + else pa = &a; + while( (*pa)-- ){ + x++; + if( (*pa) < 3 ) break; + else pa = &b; + } + x++; + pa = &b; + } + + if ((*pa) != -5 || (*pb) != -5 || x != 43) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990127-2.c b/gcc/testsuite/gcc.c-torture/execute/990127-2.c new file mode 100644 index 000000000..0d0f49512 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990127-2.c @@ -0,0 +1,20 @@ +void +fpEq (double x, double y) +{ + if (x != y) + abort (); +} + +void +fpTest (double x, double y) +{ + double result1 = (35.7 * 100.0) / 45.0; + double result2 = (x * 100.0) / y; + fpEq (result1, result2); +} + +main () +{ + fpTest (35.7, 45.0); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990127-2.x b/gcc/testsuite/gcc.c-torture/execute/990127-2.x new file mode 100644 index 000000000..56455ab88 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990127-2.x @@ -0,0 +1,15 @@ +# On x86 targets, two floating-point double values can't be reliably compared +# for inequality due to excess precision of 80387 floating-point coprocessor. +# Use -mpc64 to force 80387 floating-point precision to 64 bits. This option +# has no effect on SSE, but it is needed in case of -m32 on x86_64 targets. + +if { [istarget i?86-*-linux*] + || [istarget i?86-*-kfreebsd*-gnu] + || [istarget i?86-*-knetbsd*-gnu] + || [istarget x86_64-*-linux*] + || [istarget x86_64-*-kfreebsd*-gnu] + || [istarget x86_64-*-knetbsd*-gnu] } { + set additional_flags "-mpc64" +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/990128-1.c b/gcc/testsuite/gcc.c-torture/execute/990128-1.c new file mode 100644 index 000000000..cfdab3e87 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990128-1.c @@ -0,0 +1,50 @@ +extern int printf (const char *,...); + +struct s { struct s *n; } *p; +struct s ss; +#define MAX 10 +struct s sss[MAX]; +int count = 0; + +void sub( struct s *p, struct s **pp ); +int look( struct s *p, struct s **pp ); + +main() +{ + struct s *pp; + struct s *next; + int i; + + p = &ss; + next = p; + for ( i = 0; i < MAX; i++ ) { + next->n = &sss[i]; + next = next->n; + } + next->n = 0; + + sub( p, &pp ); + if (count != MAX+2) + abort (); + + exit( 0 ); +} + +void sub( struct s *p, struct s **pp ) +{ + for ( ; look( p, pp ); ) { + if ( p ) + p = p->n; + else + break; + } +} + +int look( struct s *p, struct s **pp ) +{ + for ( ; p; p = p->n ) + ; + *pp = p; + count++; + return( 1 ); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990130-1.c b/gcc/testsuite/gcc.c-torture/execute/990130-1.c new file mode 100644 index 000000000..c38ecddbe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990130-1.c @@ -0,0 +1,23 @@ +int count = 0; +int dummy; + +static int * +bar(void) +{ + ++count; + return &dummy; +} + +static void +foo(void) +{ + asm("" : "+r"(*bar())); +} + +main() +{ + foo(); + if (count != 1) + abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990208-1.c b/gcc/testsuite/gcc.c-torture/execute/990208-1.c new file mode 100644 index 000000000..786e664f3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990208-1.c @@ -0,0 +1,50 @@ +/* As a quality of implementation issue, we should not prevent inlining + of function explicitly marked inline just because a label therein had + its address taken. */ + +#ifndef NO_LABEL_VALUES +static void *ptr1, *ptr2; +static int i = 1; + +static __inline__ void doit(void **pptr, int cond) +{ + if (cond) { + here: + *pptr = &&here; + } +} + +__attribute__ ((noinline)) +static void f(int cond) +{ + doit (&ptr1, cond); +} + +__attribute__ ((noinline)) +static void g(int cond) +{ + doit (&ptr2, cond); +} + +__attribute__ ((noinline)) +static void bar(void); + +int main() +{ + f (i); + bar(); + g (i); + +#ifdef __OPTIMIZE__ + if (ptr1 == ptr2) + abort (); +#endif + + exit (0); +} + +void bar(void) { } + +#else /* NO_LABEL_VALUES */ +int main() { exit(0); } +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/990211-1.c b/gcc/testsuite/gcc.c-torture/execute/990211-1.c new file mode 100644 index 000000000..e2fe7eea3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990211-1.c @@ -0,0 +1,61 @@ +/* Copyright (C) 1999 Free Software Foundation, Inc. + Contributed by Nathan Sidwell 20 Jan 1999 */ + +/* check range combining boolean operations work */ + +extern void abort(); + +#define N 77 + +void func(int i) +{ + /* fold-const does some clever things with range tests. Make sure + we get (some of) them right */ + + /* these must fail, regardless of the value of i */ + if ((i < 0) && (i >= 0)) + abort(); + if ((i > 0) && (i <= 0)) + abort(); + if ((i >= 0) && (i < 0)) + abort(); + if ((i <= 0) && (i > 0)) + abort(); + + if ((i < N) && (i >= N)) + abort(); + if ((i > N) && (i <= N)) + abort(); + if ((i >= N) && (i < N)) + abort(); + if ((i <= N) && (i > N)) + abort(); + + /* these must pass, regardless of the value of i */ + if (! ((i < 0) || (i >= 0))) + abort(); + if (! ((i > 0) || (i <= 0))) + abort(); + if (! ((i >= 0) || (i < 0))) + abort(); + if (! ((i <= 0) || (i > 0))) + abort(); + + if (! ((i < N) || (i >= N))) + abort(); + if (! ((i > N) || (i <= N))) + abort(); + if (! ((i >= N) || (i < N))) + abort(); + if (! ((i <= N) || (i > N))) + abort(); + + return; +} + +int main() +{ + func(0); + func(1); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990222-1.c b/gcc/testsuite/gcc.c-torture/execute/990222-1.c new file mode 100644 index 000000000..98b94f398 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990222-1.c @@ -0,0 +1,11 @@ +char line[4] = { '1', '9', '9', '\0' }; + +int main() +{ + char *ptr = line + 3; + + while ((*--ptr += 1) > '9') *ptr = '0'; + if (line[0] != '2' || line[1] != '0' || line[2] != '0') + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990324-1.c b/gcc/testsuite/gcc.c-torture/execute/990324-1.c new file mode 100644 index 000000000..d9baa0885 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990324-1.c @@ -0,0 +1,13 @@ +void f(long i) +{ + if ((signed char)i < 0 || (signed char)i == 0) + abort (); + else + exit (0); +} + +main() +{ + f(0xffffff01); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/990326-1.c b/gcc/testsuite/gcc.c-torture/execute/990326-1.c new file mode 100644 index 000000000..d7427cf85 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990326-1.c @@ -0,0 +1,407 @@ +struct a { + char a, b; + short c; +}; + +int +a1() +{ + static struct a x = { 1, 2, ~1 }, y = { 65, 2, ~2 }; + + return (x.a == (y.a & ~64) && x.b == y.b); +} + +int +a2() +{ + static struct a x = { 1, 66, ~1 }, y = { 1, 2, ~2 }; + + return (x.a == y.a && (x.b & ~64) == y.b); +} + +int +a3() +{ + static struct a x = { 9, 66, ~1 }, y = { 33, 18, ~2 }; + + return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16)); +} + +struct b { + int c; + short b, a; +}; + +int +b1() +{ + static struct b x = { ~1, 2, 1 }, y = { ~2, 2, 65 }; + + return (x.a == (y.a & ~64) && x.b == y.b); +} + +int +b2() +{ + static struct b x = { ~1, 66, 1 }, y = { ~2, 2, 1 }; + + return (x.a == y.a && (x.b & ~64) == y.b); +} + +int +b3() +{ + static struct b x = { ~1, 66, 9 }, y = { ~2, 18, 33 }; + + return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16)); +} + +struct c { + unsigned int c:4, b:14, a:14; +} __attribute__ ((aligned)); + +int +c1() +{ + static struct c x = { ~1, 2, 1 }, y = { ~2, 2, 65 }; + + return (x.a == (y.a & ~64) && x.b == y.b); +} + +int +c2() +{ + static struct c x = { ~1, 66, 1 }, y = { ~2, 2, 1 }; + + return (x.a == y.a && (x.b & ~64) == y.b); +} + +int +c3() +{ + static struct c x = { ~1, 66, 9 }, y = { ~2, 18, 33 }; + + return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16)); +} + +struct d { + unsigned int a:14, b:14, c:4; +} __attribute__ ((aligned)); + +int +d1() +{ + static struct d x = { 1, 2, ~1 }, y = { 65, 2, ~2 }; + + return (x.a == (y.a & ~64) && x.b == y.b); +} + +int +d2() +{ + static struct d x = { 1, 66, ~1 }, y = { 1, 2, ~2 }; + + return (x.a == y.a && (x.b & ~64) == y.b); +} + +int +d3() +{ + static struct d x = { 9, 66, ~1 }, y = { 33, 18, ~2 }; + + return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16)); +} + +struct e { + int c:4, b:14, a:14; +} __attribute__ ((aligned)); + +int +e1() +{ + static struct e x = { ~1, -2, -65 }, y = { ~2, -2, -1 }; + + return (x.a == (y.a & ~64) && x.b == y.b); +} + +int +e2() +{ + static struct e x = { ~1, -2, -1 }, y = { ~2, -66, -1 }; + + return (x.a == y.a && (x.b & ~64) == y.b); +} + +int +e3() +{ + static struct e x = { ~1, -18, -33 }, y = { ~2, -66, -9 }; + + return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16)); +} + +int +e4() +{ + static struct e x = { -1, -1, 0 }; + + return x.a == 0 && x.b & 0x2000; +} + +struct f { + int a:14, b:14, c:4; +} __attribute__ ((aligned)); + +int +f1() +{ + static struct f x = { -65, -2, ~1 }, y = { -1, -2, ~2 }; + + return (x.a == (y.a & ~64) && x.b == y.b); +} + +int +f2() +{ + static struct f x = { -1, -2, ~1 }, y = { -1, -66, ~2 }; + + return (x.a == y.a && (x.b & ~64) == y.b); +} + +int +f3() +{ + static struct f x = { -33, -18, ~1 }, y = { -9, -66, ~2 }; + + return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16)); +} + +int +f4() +{ + static struct f x = { 0, -1, -1 }; + + return x.a == 0 && x.b & 0x2000; +} + +struct gx { + int c:4, b:14, a:14; +} __attribute__ ((aligned)); +struct gy { + int b:14, a:14, c:4; +} __attribute__ ((aligned)); + +int +g1() +{ + static struct gx x = { ~1, -2, -65 }; + static struct gy y = { -2, -1, ~2 }; + + return (x.a == (y.a & ~64) && x.b == y.b); +} + +int +g2() +{ + static struct gx x = { ~1, -2, -1 }; + static struct gy y = { -66, -1, ~2 }; + + return (x.a == y.a && (x.b & ~64) == y.b); +} + +int +g3() +{ + static struct gx x = { ~1, -18, -33 }; + static struct gy y = { -66, -9, ~2 }; + + return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16)); +} + +int +g4() +{ + static struct gx x = { ~1, 0x0020, 0x0010 }; + static struct gy y = { 0x0200, 0x0100, ~2 }; + + return ((x.a & 0x00f0) == (y.a & 0x0f00) && + (x.b & 0x00f0) == (y.b & 0x0f00)); +} + +int +g5() +{ + static struct gx x = { ~1, 0x0200, 0x0100 }; + static struct gy y = { 0x0020, 0x0010, ~2 }; + + return ((x.a & 0x0f00) == (y.a & 0x00f0) && + (x.b & 0x0f00) == (y.b & 0x00f0)); +} + +int +g6() +{ + static struct gx x = { ~1, 0xfe20, 0xfd10 }; + static struct gy y = { 0xc22f, 0xc11f, ~2 }; + + return ((x.a & 0x03ff) == (y.a & 0x3ff0) && + (x.b & 0x03ff) == (y.b & 0x3ff0)); +} + +int +g7() +{ + static struct gx x = { ~1, 0xc22f, 0xc11f }; + static struct gy y = { 0xfe20, 0xfd10, ~2 }; + + return ((x.a & 0x3ff0) == (y.a & 0x03ff) && + (x.b & 0x3ff0) == (y.b & 0x03ff)); +} + +struct hx { + int a:14, b:14, c:4; +} __attribute__ ((aligned)); +struct hy { + int c:4, a:14, b:14; +} __attribute__ ((aligned)); + +int +h1() +{ + static struct hx x = { -65, -2, ~1 }; + static struct hy y = { ~2, -1, -2 }; + + return (x.a == (y.a & ~64) && x.b == y.b); +} + +int +h2() +{ + static struct hx x = { -1, -2, ~1 }; + static struct hy y = { ~2, -1, -66 }; + + return (x.a == y.a && (x.b & ~64) == y.b); +} + +int +h3() +{ + static struct hx x = { -33, -18, ~1 }; + static struct hy y = { ~2, -9, -66 }; + + return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16)); +} + +int +h4() +{ + static struct hx x = { 0x0010, 0x0020, ~1 }; + static struct hy y = { ~2, 0x0100, 0x0200 }; + + return ((x.a & 0x00f0) == (y.a & 0x0f00) && + (x.b & 0x00f0) == (y.b & 0x0f00)); +} + +int +h5() +{ + static struct hx x = { 0x0100, 0x0200, ~1 }; + static struct hy y = { ~2, 0x0010, 0x0020 }; + + return ((x.a & 0x0f00) == (y.a & 0x00f0) && + (x.b & 0x0f00) == (y.b & 0x00f0)); +} + +int +h6() +{ + static struct hx x = { 0xfd10, 0xfe20, ~1 }; + static struct hy y = { ~2, 0xc11f, 0xc22f }; + + return ((x.a & 0x03ff) == (y.a & 0x3ff0) && + (x.b & 0x03ff) == (y.b & 0x3ff0)); +} + +int +h7() +{ + static struct hx x = { 0xc11f, 0xc22f, ~1 }; + static struct hy y = { ~2, 0xfd10, 0xfe20 }; + + return ((x.a & 0x3ff0) == (y.a & 0x03ff) && + (x.b & 0x3ff0) == (y.b & 0x03ff)); +} + +int +main() +{ + if (!a1 ()) + abort (); + if (!a2 ()) + abort (); + if (!a3 ()) + abort (); + if (!b1 ()) + abort (); + if (!b2 ()) + abort (); + if (!b3 ()) + abort (); + if (!c1 ()) + abort (); + if (!c2 ()) + abort (); + if (!c3 ()) + abort (); + if (!d1 ()) + abort (); + if (!d2 ()) + abort (); + if (!d3 ()) + abort (); + if (!e1 ()) + abort (); + if (!e2 ()) + abort (); + if (!e3 ()) + abort (); + if (!e4 ()) + abort (); + if (!f1 ()) + abort (); + if (!f2 ()) + abort (); + if (!f3 ()) + abort (); + if (!f4 ()) + abort (); + if (!g1 ()) + abort (); + if (!g2 ()) + abort (); + if (!g3 ()) + abort (); + if (g4 ()) + abort (); + if (g5 ()) + abort (); + if (!g6 ()) + abort (); + if (!g7 ()) + abort (); + if (!h1 ()) + abort (); + if (!h2 ()) + abort (); + if (!h3 ()) + abort (); + if (h4 ()) + abort (); + if (h5 ()) + abort (); + if (!h6 ()) + abort (); + if (!h7 ()) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990404-1.c b/gcc/testsuite/gcc.c-torture/execute/990404-1.c new file mode 100644 index 000000000..be917d6d2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990404-1.c @@ -0,0 +1,27 @@ + +int x[10] = { 0,1,2,3,4,5,6,7,8,9}; + +int +main() +{ + int niterations = 0, i; + + for (;;) { + int i, mi, max; + max = 0; + for (i = 0; i < 10 ; i++) { + if (x[i] > max) { + max = x[i]; + mi = i; + } + } + if (max == 0) + break; + x[mi] = 0; + niterations++; + if (niterations > 10) + abort (); + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990413-2.c b/gcc/testsuite/gcc.c-torture/execute/990413-2.c new file mode 100644 index 000000000..262140a3f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990413-2.c @@ -0,0 +1,50 @@ +/* This tests for a bug in regstack that was breaking glibc's math library. */ + +extern void abort (void); + +static __inline double +minus_zero (void) +{ + union { double __d; int __i[2]; } __x; + __x.__i[0] = 0x0; + __x.__i[1] = 0x80000000; + return __x.__d; +} + +static __inline long double +__atan2l (long double __y, long double __x) +{ + register long double __value; + __asm __volatile__ ("fpatan\n\t" + : "=t" (__value) + : "0" (__x), "u" (__y) + : "st(1)"); + return __value; +} + +static __inline long double +__sqrtl (long double __x) +{ + register long double __result; + __asm __volatile__ ("fsqrt" : "=t" (__result) : "0" (__x)); + return __result; +} + +static __inline double +asin (double __x) +{ + return __atan2l (__x, __sqrtl (1.0 - __x * __x)); +} + +int +main (void) +{ + double x; + + x = minus_zero(); + x = asin (x); + + if (x != 0.0) /* actually -0.0, but 0.0 == -0.0 */ + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990413-2.x b/gcc/testsuite/gcc.c-torture/execute/990413-2.x new file mode 100644 index 000000000..58be1c0e0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990413-2.x @@ -0,0 +1,3 @@ +# This test is x86 specific. +if { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } { return 0 } +return 1 diff --git a/gcc/testsuite/gcc.c-torture/execute/990513-1.c b/gcc/testsuite/gcc.c-torture/execute/990513-1.c new file mode 100644 index 000000000..6ad228fb0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990513-1.c @@ -0,0 +1,26 @@ +#include + +void foo (int *BM_tab, int j) +{ + int *BM_tab_base; + + BM_tab_base = BM_tab; + BM_tab += 0400; + while (BM_tab_base != BM_tab) + { + *--BM_tab = j; + *--BM_tab = j; + *--BM_tab = j; + *--BM_tab = j; + } +} + +int main () +{ + int BM_tab[0400]; + memset (BM_tab, 0, sizeof (BM_tab)); + foo (BM_tab, 6); + if (BM_tab[0] != 6) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990524-1.c b/gcc/testsuite/gcc.c-torture/execute/990524-1.c new file mode 100644 index 000000000..6cfb34995 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990524-1.c @@ -0,0 +1,26 @@ +char a[] = "12345"; +char b[] = "12345"; + +void loop (char * pz, char * pzDta) +{ + for (;;) { + switch (*(pz++) = *(pzDta++)) { + case 0: + goto loopDone2; + + case '"': + case '\\': + pz[-1] = '\\'; + *(pz++) = pzDta[-1]; + } + } loopDone2:; + + if (a - pz != b - pzDta) + abort (); +} + +main() +{ + loop (a, b); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990525-1.c b/gcc/testsuite/gcc.c-torture/execute/990525-1.c new file mode 100644 index 000000000..39b65d101 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990525-1.c @@ -0,0 +1,23 @@ +struct blah { + int m1, m2; +}; + +void die(struct blah arg) +{ + int i ; + struct blah buf[1]; + + for (i = 0; i < 1 ; buf[i++] = arg) + ; + if (buf[0].m1 != 1) { + abort (); + } +} + +int main() +{ + struct blah s = { 1, 2 }; + + die(s); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990525-2.c b/gcc/testsuite/gcc.c-torture/execute/990525-2.c new file mode 100644 index 000000000..749785262 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990525-2.c @@ -0,0 +1,39 @@ +typedef struct { + int v[4]; +} Test1; + +Test1 func2(); + +int func1() +{ + Test1 test; + test = func2(); + + if (test.v[0] != 10) + abort (); + if (test.v[1] != 20) + abort (); + if (test.v[2] != 30) + abort (); + if (test.v[3] != 40) + abort (); +} + +Test1 func2() +{ + Test1 tmp; + tmp.v[0] = 10; + tmp.v[1] = 20; + tmp.v[2] = 30; + tmp.v[3] = 40; + return tmp; +} + + +int main() +{ + func1(); + exit (0); +} + + diff --git a/gcc/testsuite/gcc.c-torture/execute/990527-1.c b/gcc/testsuite/gcc.c-torture/execute/990527-1.c new file mode 100644 index 000000000..a865cbbc6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990527-1.c @@ -0,0 +1,30 @@ +int sum; + +void +g (int i) +{ + sum += i; +} + +void +f(int j) +{ + int i; + + for (i = 0; i < 9; i++) + { + j++; + g (j); + j = 9; + } +} + +int +main () +{ + f (0); + if (sum != 81) + abort (); + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/990531-1.c b/gcc/testsuite/gcc.c-torture/execute/990531-1.c new file mode 100644 index 000000000..d5501d3a7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990531-1.c @@ -0,0 +1,23 @@ + unsigned long bad(int reg, unsigned long inWord) + { + union { + unsigned long word; + unsigned char byte[4]; + } data; + + data.word = inWord; + data.byte[reg] = 0; + + return data.word; + } + +main() +{ + /* XXX This test could be generalized. */ + if (sizeof (long) != 4) + exit (0); + + if (bad (0, 0xdeadbeef) == 0xdeadbeef) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990604-1.c b/gcc/testsuite/gcc.c-torture/execute/990604-1.c new file mode 100644 index 000000000..4e23a8ea8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990604-1.c @@ -0,0 +1,19 @@ +int b; +void f () +{ + int i = 0; + if (b == 0) + do { + b = i; + i++; + } while (i < 10); +} + +int main () +{ + f (); + if (b != 9) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/990628-1.c b/gcc/testsuite/gcc.c-torture/execute/990628-1.c new file mode 100644 index 000000000..e010510cd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990628-1.c @@ -0,0 +1,56 @@ +#include + +struct { + long sqlcode; +} sqlca; + + +struct data_record { + int dummy; + int a[100]; +} *data_ptr, data_tmp; + + +int +num_records() +{ + return 1; +} + + +void +fetch() +{ + static int fetch_count; + + memset(&data_tmp, 0x55, sizeof(data_tmp)); + sqlca.sqlcode = (++fetch_count > 1 ? 100 : 0); +} + + +void +load_data() { + struct data_record *p; + int num = num_records(); + + data_ptr = malloc(num * sizeof(struct data_record)); + memset(data_ptr, 0xaa, num * sizeof(struct data_record)); + + fetch(); + p = data_ptr; + while (sqlca.sqlcode == 0) { + *p++ = data_tmp; + fetch(); + } +} + + +main() +{ + load_data(); + if (sizeof (int) == 2 && data_ptr[0].dummy != 0x5555) + abort (); + else if (sizeof (int) > 2 && data_ptr[0].dummy != 0x55555555) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990804-1.c b/gcc/testsuite/gcc.c-torture/execute/990804-1.c new file mode 100644 index 000000000..130c0fb5e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990804-1.c @@ -0,0 +1,30 @@ +int gfbyte ( void ) +{ + return 0; +} + +int main( void ) +{ + int i,j,k ; + + i = gfbyte(); + + i = i + 1 ; + + if ( i == 0 ) + k = -0 ; + else + k = i + 0 ; + + if (i != 1) + abort (); + + k = 1 ; + if ( k <= i) + do + j = gfbyte () ; + while ( k++ < i ) ; + + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/990811-1.c b/gcc/testsuite/gcc.c-torture/execute/990811-1.c new file mode 100644 index 000000000..95e1da9cd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990811-1.c @@ -0,0 +1,31 @@ +struct s {long a; int b;}; + +int foo(int x, void *y) +{ + switch(x) { + case 0: return ((struct s*)y)->a; + case 1: return *(signed char*)y; + case 2: return *(short*)y; + } + abort(); +} + +int main () +{ + struct s s; + short sh[10]; + signed char c[10]; + int i; + + s.a = 1; + s.b = 2; + for (i = 0; i < 10; i++) { + sh[i] = i; + c[i] = i; + } + + if (foo(0, &s) != 1) abort(); + if (foo(1, c+3) != 3) abort(); + if (foo(2, sh+3) != 3) abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990826-0.c b/gcc/testsuite/gcc.c-torture/execute/990826-0.c new file mode 100644 index 000000000..2807ea348 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990826-0.c @@ -0,0 +1,27 @@ +/* +From: niles@fan745.gsfc.nasa.gov +To: fortran@gnu.org +Subject: Re: Scary problems in g77 for RedHat 6.0. (glibc-2.1) +Date: Sun, 06 Jun 1999 23:37:23 -0400 +X-UIDL: 9c1e40c572e3b306464f703461764cd5 +*/ + +#include +#include + +int +main() +{ + if (floor (0.1) != 0.) + abort (); + return 0; +} + +/* +It will result in 36028797018963968.000000 on Alpha RedHat Linux 6.0 +using glibc-2.1 at least on my 21064. This may result in g77 bug +reports concerning the INT() function, just so you know. + + Thanks, + Rick Niles. +*/ diff --git a/gcc/testsuite/gcc.c-torture/execute/990826-0.x b/gcc/testsuite/gcc.c-torture/execute/990826-0.x new file mode 100644 index 000000000..689aebfe3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990826-0.x @@ -0,0 +1,20 @@ +# floor() is not available on m6811/m6812 target, this test will not link. +if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"]} { + return 1 +} +# XFAIL this test for AIX using -msoft-float. +# This test calls the system libm.a function floor. +# A false failure is reported if -msoft-float is used. +# AIX expects the the parameters to be passed in fp regs. +if { [istarget powerpc-*-aix*] || [istarget rs6000-*-aix*] } { + set torture_eval_before_execute { + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data { + "Can not call system libm.a with -msoft-float" \ + "*-*-aix*" \ + { "-msoft-float" } \ + { "" } + } + } +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/990827-1.c b/gcc/testsuite/gcc.c-torture/execute/990827-1.c new file mode 100644 index 000000000..6116e7886 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990827-1.c @@ -0,0 +1,21 @@ +unsigned test(unsigned one , unsigned bit) +{ + unsigned val= bit & 1; + unsigned zero= one >> 1; + + val++; + return zero + ( val>> 1 ); +} + +int main() +{ + if (test (1,0) != 0) + abort (); + if (test (1,1) != 1) + abort (); + if (test (1,65535) != 1) + abort (); + exit (0); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990829-1.c b/gcc/testsuite/gcc.c-torture/execute/990829-1.c new file mode 100644 index 000000000..82f818645 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990829-1.c @@ -0,0 +1,15 @@ +double test (const double le, const double ri) +{ + double val = ( ri - le ) / ( ri * ( le + 1.0 ) ); + return val; +} + +int main () +{ + double retval; + + retval = test(1.0,2.0); + if (retval < 0.24 || retval > 0.26) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990923-1.c b/gcc/testsuite/gcc.c-torture/execute/990923-1.c new file mode 100644 index 000000000..4f4e87abc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990923-1.c @@ -0,0 +1,19 @@ +#define mask 0xffff0000L +#define value 0xabcd0000L + +long +foo (long x) +{ + if ((x & mask) == value) + return x & 0xffffL; + return 1; +} + +int +main (void) +{ + if (foo (value) != 0 || foo (0) != 1) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/991014-1.c b/gcc/testsuite/gcc.c-torture/execute/991014-1.c new file mode 100644 index 000000000..e0bcd6d8b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/991014-1.c @@ -0,0 +1,54 @@ + +typedef __SIZE_TYPE__ Size_t; + +#if __SIZEOF_LONG__ < __SIZEOF_POINTER__ +#define bufsize ((1LL << (8 * sizeof(Size_t) - 2))-256) +#else +#define bufsize ((1L << (8 * sizeof(Size_t) - 2))-256) +#endif + +struct huge_struct +{ + short buf[bufsize]; + int a; + int b; + int c; + int d; +}; + +union huge_union +{ + int a; + char buf[bufsize]; +}; + +Size_t union_size() +{ + return sizeof(union huge_union); +} + +Size_t struct_size() +{ + return sizeof(struct huge_struct); +} + +Size_t struct_a_offset() +{ + return (Size_t)(&((struct huge_struct *) 0)->a); +} + +int main() +{ + /* Check the exact sizeof value. bufsize is aligned on 256b. */ + if (union_size() != sizeof(char) * bufsize) + abort(); + + if (struct_size() != sizeof(short) * bufsize + 4*sizeof(int)) + abort(); + + if (struct_a_offset() < sizeof(short) * bufsize) + abort(); + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/991016-1.c b/gcc/testsuite/gcc.c-torture/execute/991016-1.c new file mode 100644 index 000000000..c3122342d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/991016-1.c @@ -0,0 +1,55 @@ +/* Two of these types will, on current gcc targets, have the same + mode but have different alias sets. DOIT tries to get gcse to + invalidly hoist one of the values out of the loop. */ + +typedef int T0; +typedef long T1; +typedef long long T2; + +int +doit(int sel, int n, void *p) +{ + T0 * const p0 = p; + T1 * const p1 = p; + T2 * const p2 = p; + + switch (sel) + { + case 0: + do + *p0 += *p0; + while (--n); + return *p0 == 0; + + case 1: + do + *p1 += *p1; + while (--n); + return *p1 == 0; + + case 2: + do + *p2 += *p2; + while (--n); + return *p2 == 0; + + default: + abort (); + } +} + +int +main() +{ + T0 v0; T1 v1; T2 v2; + + v0 = 1; doit(0, 5, &v0); + v1 = 1; doit(1, 5, &v1); + v2 = 1; doit(2, 5, &v2); + + if (v0 != 32) abort (); + if (v1 != 32) abort (); + if (v2 != 32) abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/991019-1.c b/gcc/testsuite/gcc.c-torture/execute/991019-1.c new file mode 100644 index 000000000..39726cd0b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/991019-1.c @@ -0,0 +1,28 @@ +typedef struct { + double epsilon; +} material_type; + +material_type foo(double x) +{ + material_type m; + + m.epsilon = 1.0 + x; + return m; +} + +main() +{ + int i; + material_type x; + + /* We must iterate enough times to overflow the FP stack on the + x86. */ + for (i = 0; i < 10; i++) + { + x = foo (1.0); + if (x.epsilon != 1.0 + 1.0) + abort (); + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/991023-1.c b/gcc/testsuite/gcc.c-torture/execute/991023-1.c new file mode 100644 index 000000000..697eb931f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/991023-1.c @@ -0,0 +1,24 @@ + + +int blah; +foo() +{ + int i; + + for (i=0 ; i< 7 ; i++) + { + if (i == 7 - 1) + blah = 0xfcc; + else + blah = 0xfee; + } + return blah; +} + + +main() +{ + if (foo () != 0xfcc) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/991030-1.c b/gcc/testsuite/gcc.c-torture/execute/991030-1.c new file mode 100644 index 000000000..dff11d0a6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/991030-1.c @@ -0,0 +1,9 @@ +double x = 0x1.fp1; +int main() +{ + if (x != 3.875) + abort (); + exit (0); +} + + diff --git a/gcc/testsuite/gcc.c-torture/execute/991112-1.c b/gcc/testsuite/gcc.c-torture/execute/991112-1.c new file mode 100644 index 000000000..e43c7beeb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/991112-1.c @@ -0,0 +1,19 @@ +/* This code was miscompiled at -O3 on x86. + Reported by Jim Meyering; distilled from bash. */ + +int rl_show_char (int c) { return 0; } + +int rl_character_len (int c, int pos) +{ + return isprint (c) ? 1 : 2; +} + +int main(void) +{ + int (*x)(int, int) = rl_character_len; + if (x('a', 1) != 1) + abort(); + if (x('\002', 1) != 2) + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/991118-1.c b/gcc/testsuite/gcc.c-torture/execute/991118-1.c new file mode 100644 index 000000000..77ba888a2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/991118-1.c @@ -0,0 +1,79 @@ +struct tmp +{ + long long int pad : 12; + long long int field : 52; +}; + +struct tmp2 +{ + long long int field : 52; + long long int pad : 12; +}; + +struct tmp3 +{ + long long int pad : 11; + long long int field : 53; +}; + +struct tmp4 +{ + long long int field : 53; + long long int pad : 11; +}; + +struct tmp +sub (struct tmp tmp) +{ + tmp.field ^= 0x0008765412345678LL; + return tmp; +} + +struct tmp2 +sub2 (struct tmp2 tmp2) +{ + tmp2.field ^= 0x0008765412345678LL; + return tmp2; +} + +struct tmp3 +sub3 (struct tmp3 tmp3) +{ + tmp3.field ^= 0x0018765412345678LL; + return tmp3; +} + +struct tmp4 +sub4 (struct tmp4 tmp4) +{ + tmp4.field ^= 0x0018765412345678LL; + return tmp4; +} + +struct tmp tmp = {0x123, 0x123456789ABCDLL}; +struct tmp2 tmp2 = {0x123456789ABCDLL, 0x123}; +struct tmp3 tmp3 = {0x123, 0x1FFFF00000000LL}; +struct tmp4 tmp4 = {0x1FFFF00000000LL, 0x123}; + +main() +{ + + if (sizeof (long long) != 8) + exit (0); + + tmp = sub (tmp); + tmp2 = sub2 (tmp2); + + if (tmp.pad != 0x123 || tmp.field != 0xFFF9551175BDFDB5LL) + abort (); + if (tmp2.pad != 0x123 || tmp2.field != 0xFFF9551175BDFDB5LL) + abort (); + + tmp3 = sub3 (tmp3); + tmp4 = sub4 (tmp4); + if (tmp3.pad != 0x123 || tmp3.field != 0xFFF989AB12345678LL) + abort (); + if (tmp4.pad != 0x123 || tmp4.field != 0xFFF989AB12345678LL) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/991201-1.c b/gcc/testsuite/gcc.c-torture/execute/991201-1.c new file mode 100644 index 000000000..16595a45d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/991201-1.c @@ -0,0 +1,39 @@ +struct vc_data { + unsigned long space; + unsigned char vc_palette[16*3]; +}; + +struct vc { + struct vc_data *d; +}; + +struct vc_data a_con; +struct vc vc_cons[63] = { &a_con }; +int default_red[16]; +int default_grn[16]; +int default_blu[16]; + +extern void bar(int); + +void reset_palette(int currcons) +{ + int j, k; + for (j=k=0; j<16; j++) { + (vc_cons[currcons].d->vc_palette) [k++] = default_red[j]; + (vc_cons[currcons].d->vc_palette) [k++] = default_grn[j]; + (vc_cons[currcons].d->vc_palette) [k++] = default_blu[j]; + } + bar(k); +} + +void bar(int k) +{ + if (k != 16*3) + abort(); +} + +int main() +{ + reset_palette(0); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/991202-1.c b/gcc/testsuite/gcc.c-torture/execute/991202-1.c new file mode 100644 index 000000000..502acc749 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/991202-1.c @@ -0,0 +1,16 @@ +int x, y; + +int +main() +{ + x = 2; + y = x; + do + { + x = y; + y = 2 * y; + } + while ( ! ((y - x) >= 20)); + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/991202-2.c b/gcc/testsuite/gcc.c-torture/execute/991202-2.c new file mode 100644 index 000000000..fa97e2d43 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/991202-2.c @@ -0,0 +1,17 @@ + +int +f1 () +{ + unsigned long x, y = 1; + + x = ((y * 8192) - 216) % 16; + return x; +} + +int +main () +{ + if (f1 () != 8) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/991202-3.c b/gcc/testsuite/gcc.c-torture/execute/991202-3.c new file mode 100644 index 000000000..f5718b220 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/991202-3.c @@ -0,0 +1,22 @@ + +unsigned int f (unsigned int a) +{ + return a * 65536 / 8; +} + +unsigned int g (unsigned int a) +{ + return a * 65536; +} + +unsigned int h (unsigned int a) +{ + return a / 8; +} + +int main () +{ + if (f (65536) != h (g (65536))) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/991216-1.c b/gcc/testsuite/gcc.c-torture/execute/991216-1.c new file mode 100644 index 000000000..bfedefb1e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/991216-1.c @@ -0,0 +1,116 @@ +#define VALUE 0x123456789abcdefLL +#define AFTER 0x55 + +void +test1 (int a, long long value, int after) +{ + if (a != 1 + || value != VALUE + || after != AFTER) + abort (); +} + +void +test2 (int a, int b, long long value, int after) +{ + if (a != 1 + || b != 2 + || value != VALUE + || after != AFTER) + abort (); +} + +void +test3 (int a, int b, int c, long long value, int after) +{ + if (a != 1 + || b != 2 + || c != 3 + || value != VALUE + || after != AFTER) + abort (); +} + +void +test4 (int a, int b, int c, int d, long long value, int after) +{ + if (a != 1 + || b != 2 + || c != 3 + || d != 4 + || value != VALUE + || after != AFTER) + abort (); +} + +void +test5 (int a, int b, int c, int d, int e, long long value, int after) +{ + if (a != 1 + || b != 2 + || c != 3 + || d != 4 + || e != 5 + || value != VALUE + || after != AFTER) + abort (); +} + +void +test6 (int a, int b, int c, int d, int e, int f, long long value, int after) +{ + if (a != 1 + || b != 2 + || c != 3 + || d != 4 + || e != 5 + || f != 6 + || value != VALUE + || after != AFTER) + abort (); +} + +void +test7 (int a, int b, int c, int d, int e, int f, int g, long long value, int after) +{ + if (a != 1 + || b != 2 + || c != 3 + || d != 4 + || e != 5 + || f != 6 + || g != 7 + || value != VALUE + || after != AFTER) + abort (); +} + +void +test8 (int a, int b, int c, int d, int e, int f, int g, int h, long long value, int after) +{ + if (a != 1 + || b != 2 + || c != 3 + || d != 4 + || e != 5 + || f != 6 + || g != 7 + || h != 8 + || value != VALUE + || after != AFTER) + abort (); +} + +int +main () +{ + test1 (1, VALUE, AFTER); + test2 (1, 2, VALUE, AFTER); + test3 (1, 2, 3, VALUE, AFTER); + test4 (1, 2, 3, 4, VALUE, AFTER); + test5 (1, 2, 3, 4, 5, VALUE, AFTER); + test6 (1, 2, 3, 4, 5, 6, VALUE, AFTER); + test7 (1, 2, 3, 4, 5, 6, 7, VALUE, AFTER); + test8 (1, 2, 3, 4, 5, 6, 7, 8, VALUE, AFTER); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/991216-2.c b/gcc/testsuite/gcc.c-torture/execute/991216-2.c new file mode 100644 index 000000000..0956135f5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/991216-2.c @@ -0,0 +1,40 @@ +#include + +#define VALUE 0x123456789abcdefLL +#define AFTER 0x55 + +void +test (int n, ...) +{ + va_list ap; + int i; + + va_start (ap, n); + for (i = 2; i <= n; i++) + { + if (va_arg (ap, int) != i) + abort (); + } + + if (va_arg (ap, long long) != VALUE) + abort (); + + if (va_arg (ap, int) != AFTER) + abort (); + + va_end (ap); +} + +int +main () +{ + test (1, VALUE, AFTER); + test (2, 2, VALUE, AFTER); + test (3, 2, 3, VALUE, AFTER); + test (4, 2, 3, 4, VALUE, AFTER); + test (5, 2, 3, 4, 5, VALUE, AFTER); + test (6, 2, 3, 4, 5, 6, VALUE, AFTER); + test (7, 2, 3, 4, 5, 6, 7, VALUE, AFTER); + test (8, 2, 3, 4, 5, 6, 7, 8, VALUE, AFTER); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/991216-4.c b/gcc/testsuite/gcc.c-torture/execute/991216-4.c new file mode 100644 index 000000000..4cc4c8c13 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/991216-4.c @@ -0,0 +1,16 @@ +/* Test against a problem with loop reversal. */ +static void bug(int size, int tries) +{ + int i; + int num = 0; + while (num < size) + { + for (i = 1; i < tries; i++) num++; + } +} + +int main() +{ + bug(5, 10); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/991221-1.c b/gcc/testsuite/gcc.c-torture/execute/991221-1.c new file mode 100644 index 000000000..7106fee60 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/991221-1.c @@ -0,0 +1,13 @@ +int main( void ) +{ + unsigned long totalsize = 80; + unsigned long msize = 64; + + if (sizeof(long) != 4) + exit(0); + + if ( totalsize > (2147483647L * 2UL + 1) + || (msize != 0 && ((msize - 1) > (2147483647L * 2UL + 1) ))) + abort(); + exit( 0 ); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/991227-1.c b/gcc/testsuite/gcc.c-torture/execute/991227-1.c new file mode 100644 index 000000000..46b0951e9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/991227-1.c @@ -0,0 +1,11 @@ +char* doit(int flag) +{ + return 1 + (flag ? "\0wrong\n" : "\0right\n"); +} +int main() +{ + char *result = doit(0); + if (*result == 'r' && result[1] == 'i') + exit(0); + abort(); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/991228-1.c b/gcc/testsuite/gcc.c-torture/execute/991228-1.c new file mode 100644 index 000000000..c6fe78e7d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/991228-1.c @@ -0,0 +1,25 @@ +__extension__ union { double d; int i[2]; } u = { d: -0.25 }; + +/* This assumes the endianness of words in a long long is the same as + that for doubles, which doesn't hold for a few platforms, but we + can probably special case them here, as appropriate. */ +long long endianness_test = 1; +#define MSW (*(int*)&endianness_test) + +int +signbit(double x) +{ + __extension__ union { double d; int i[2]; } u = { d: x }; + return u.i[MSW] < 0; +} + +int main(void) +{ + if (2*sizeof(int) != sizeof(double) || u.i[MSW] >= 0) + exit(0); + + if (!signbit(-0.25)) + abort(); + + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/align-1.c b/gcc/testsuite/gcc.c-torture/execute/align-1.c new file mode 100644 index 000000000..2dc1aad2a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/align-1.c @@ -0,0 +1,9 @@ +typedef int new_int __attribute__ ((aligned(16))); +struct S { int x; }; + +int main() +{ + if (sizeof(struct S) != sizeof(int)) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/align-2.c b/gcc/testsuite/gcc.c-torture/execute/align-2.c new file mode 100644 index 000000000..b886da750 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/align-2.c @@ -0,0 +1,50 @@ +/* Simple alignment checks; + looking for compiler/assembler alignment disagreements, + agreement between struct initialization and access. */ +struct a_short { char c; short s; } s_c_s = { 'a', 13 }; +struct a_int { char c ; int i; } s_c_i = { 'b', 14 }; +struct b_int { short s; int i; } s_s_i = { 15, 16 }; +struct a_float { char c; float f; } s_c_f = { 'c', 17.0 }; +struct b_float { short s; float f; } s_s_f = { 18, 19.0 }; +struct a_double { char c; double d; } s_c_d = { 'd', 20.0 }; +struct b_double { short s; double d; } s_s_d = { 21, 22.0 }; +struct c_double { int i; double d; } s_i_d = { 23, 24.0 }; +struct d_double { float f; double d; } s_f_d = { 25.0, 26.0 }; +struct a_ldouble { char c; long double ld; } s_c_ld = { 'e', 27.0 }; +struct b_ldouble { short s; long double ld; } s_s_ld = { 28, 29.0 }; +struct c_ldouble { int i; long double ld; } s_i_ld = { 30, 31.0 }; +struct d_ldouble { float f; long double ld; } s_f_ld = { 32.0, 33.0 }; +struct e_ldouble { double d; long double ld; } s_d_ld = { 34.0, 35.0 }; + +int main () +{ + if (s_c_s.c != 'a') abort (); + if (s_c_s.s != 13) abort (); + if (s_c_i.c != 'b') abort (); + if (s_c_i.i != 14) abort (); + if (s_s_i.s != 15) abort (); + if (s_s_i.i != 16) abort (); + if (s_c_f.c != 'c') abort (); + if (s_c_f.f != 17.0) abort (); + if (s_s_f.s != 18) abort (); + if (s_s_f.f != 19.0) abort (); + if (s_c_d.c != 'd') abort (); + if (s_c_d.d != 20.0) abort (); + if (s_s_d.s != 21) abort (); + if (s_s_d.d != 22.0) abort (); + if (s_i_d.i != 23) abort (); + if (s_i_d.d != 24.0) abort (); + if (s_f_d.f != 25.0) abort (); + if (s_f_d.d != 26.0) abort (); + if (s_c_ld.c != 'e') abort (); + if (s_c_ld.ld != 27.0) abort (); + if (s_s_ld.s != 28) abort (); + if (s_s_ld.ld != 29.0) abort (); + if (s_i_ld.i != 30) abort (); + if (s_i_ld.ld != 31.0) abort (); + if (s_f_ld.f != 32.0) abort (); + if (s_f_ld.ld != 33.0) abort (); + if (s_d_ld.d != 34.0) abort (); + if (s_d_ld.ld != 35.0) abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/align-3.c b/gcc/testsuite/gcc.c-torture/execute/align-3.c new file mode 100644 index 000000000..2838e7732 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/align-3.c @@ -0,0 +1,12 @@ +void func(void) __attribute__((aligned(256))); + +void func(void) +{ +} + +int main() +{ + if (__alignof__(func) != 256) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/align-nest.c b/gcc/testsuite/gcc.c-torture/execute/align-nest.c new file mode 100644 index 000000000..2ff2952c7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/align-nest.c @@ -0,0 +1,28 @@ + +void foo(int n) +{ + typedef struct + { + int value; + } myint; + + struct S + { + int i[n]; + unsigned int b:1; + myint mi; + } __attribute__ ((packed)) __attribute__ ((aligned (4))); + + struct S s[2]; + int k; + + for (k = 0; k < 2; k ++) + s[k].mi.value = 0; +} + +int main () +{ + foo (2); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/alloca-1.c b/gcc/testsuite/gcc.c-torture/execute/alloca-1.c new file mode 100644 index 000000000..a8d1384c6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/alloca-1.c @@ -0,0 +1,21 @@ +/* Verify that alloca storage is sufficiently aligned. */ +/* ??? May fail if BIGGEST_ALIGNMENT > STACK_BOUNDARY. Which, I guess + can only happen on !STRICT_ALIGNMENT targets. */ + +typedef __SIZE_TYPE__ size_t; + +struct dummy { int x __attribute__((aligned)); }; +#define BIGGEST_ALIGNMENT __alignof__(struct dummy) + +_Bool foo(void) +{ + char *p = __builtin_alloca(32); + return ((size_t)p & (BIGGEST_ALIGNMENT - 1)) == 0; +} + +int main() +{ + if (!foo()) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/anon-1.c b/gcc/testsuite/gcc.c-torture/execute/anon-1.c new file mode 100644 index 000000000..98a9ed71d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/anon-1.c @@ -0,0 +1,29 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* Source: Neil Booth, 4 Nov 2001, derived from PR 2820 - field lookup in + nested anonymous entities was broken. */ + +struct +{ + int x; + struct + { + int a; + union + { + int b; + }; + }; +} foo; + +int +main(int argc, char *argv[]) +{ + foo.b = 6; + foo.a = 5; + + if (foo.b != 6) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/arith-1.c b/gcc/testsuite/gcc.c-torture/execute/arith-1.c new file mode 100644 index 000000000..58df322e6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/arith-1.c @@ -0,0 +1,15 @@ +unsigned +sat_add (unsigned i) +{ + unsigned ret = i + 1; + if (ret < i) + ret = i; + return ret; +} + +main () +{ + if (sat_add (~0U) != ~0U) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/arith-rand-ll.c b/gcc/testsuite/gcc.c-torture/execute/arith-rand-ll.c new file mode 100644 index 000000000..6c3cf1885 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/arith-rand-ll.c @@ -0,0 +1,114 @@ +long long +simple_rand () +{ + static unsigned long long seed = 47114711; + unsigned long long this = seed * 1103515245 + 12345; + seed = this; + return this >> 8; +} + +unsigned long long int +random_bitstring () +{ + unsigned long long int x; + int n_bits; + long long ran; + int tot_bits = 0; + + x = 0; + for (;;) + { + ran = simple_rand (); + n_bits = (ran >> 1) % 16; + tot_bits += n_bits; + + if (n_bits == 0) + return x; + else + { + x <<= n_bits; + if (ran & 1) + x |= (1 << n_bits) - 1; + + if (tot_bits > 8 * sizeof (long long) + 6) + return x; + } + } +} + +#define ABS(x) ((x) >= 0 ? (x) : -(x)) + +main () +{ + long long int i; + + for (i = 0; i < 10000; i++) + { + unsigned long long x, y; + x = random_bitstring (); + y = random_bitstring (); + + if (sizeof (int) == sizeof (long long)) + goto save_time; + + { unsigned long long xx = x, yy = y, r1, r2; + if (yy == 0) continue; + r1 = xx / yy; + r2 = xx % yy; + if (r2 >= yy || r1 * yy + r2 != xx) + abort (); + } + { signed long long xx = x, yy = y, r1, r2; + if ((unsigned long long) xx << 1 == 0 && yy == -1) + continue; + r1 = xx / yy; + r2 = xx % yy; + if (ABS (r2) >= (unsigned long long) ABS (yy) || (signed long long) (r1 * yy + r2) != xx) + abort (); + } + save_time: + { unsigned int xx = x, yy = y, r1, r2; + if (yy == 0) continue; + r1 = xx / yy; + r2 = xx % yy; + if (r2 >= yy || r1 * yy + r2 != xx) + abort (); + } + { signed int xx = x, yy = y, r1, r2; + if ((unsigned int) xx << 1 == 0 && yy == -1) + continue; + r1 = xx / yy; + r2 = xx % yy; + if (ABS (r2) >= (unsigned int) ABS (yy) || (signed int) (r1 * yy + r2) != xx || ((xx < 0) != (r2 < 0) && r2)) + abort (); + } + { unsigned short xx = x, yy = y, r1, r2; + if (yy == 0) continue; + r1 = xx / yy; + r2 = xx % yy; + if (r2 >= yy || r1 * yy + r2 != xx) + abort (); + } + { signed short xx = x, yy = y, r1, r2; + r1 = xx / yy; + r2 = xx % yy; + if (ABS (r2) >= (unsigned short) ABS (yy) || (signed short) (r1 * yy + r2) != xx) + abort (); + } + { unsigned char xx = x, yy = y, r1, r2; + if (yy == 0) continue; + r1 = xx / yy; + r2 = xx % yy; + if (r2 >= yy || r1 * yy + r2 != xx) + abort (); + } + { signed char xx = x, yy = y, r1, r2; + r1 = xx / yy; + r2 = xx % yy; + if (ABS (r2) >= (unsigned char) ABS (yy) || (signed char) (r1 * yy + r2) != xx) + abort (); + } + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/arith-rand.c b/gcc/testsuite/gcc.c-torture/execute/arith-rand.c new file mode 100644 index 000000000..4af146a1a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/arith-rand.c @@ -0,0 +1,114 @@ +long +simple_rand () +{ + static unsigned long seed = 47114711; + unsigned long this = seed * 1103515245 + 12345; + seed = this; + return this >> 8; +} + +unsigned long int +random_bitstring () +{ + unsigned long int x; + int n_bits; + long ran; + int tot_bits = 0; + + x = 0; + for (;;) + { + ran = simple_rand (); + n_bits = (ran >> 1) % 16; + tot_bits += n_bits; + + if (n_bits == 0) + return x; + else + { + x <<= n_bits; + if (ran & 1) + x |= (1 << n_bits) - 1; + + if (tot_bits > 8 * sizeof (long) + 6) + return x; + } + } +} + +#define ABS(x) ((x) >= 0 ? (x) : -(x)) + +main () +{ + long int i; + + for (i = 0; i < 1000; i++) + { + unsigned long x, y; + x = random_bitstring (); + y = random_bitstring (); + + if (sizeof (int) == sizeof (long)) + goto save_time; + + { unsigned long xx = x, yy = y, r1, r2; + if (yy == 0) continue; + r1 = xx / yy; + r2 = xx % yy; + if (r2 >= yy || r1 * yy + r2 != xx) + abort (); + } + { signed long xx = x, yy = y, r1, r2; + if ((unsigned long) xx << 1 == 0 && yy == -1) + continue; + r1 = xx / yy; + r2 = xx % yy; + if (ABS (r2) >= (unsigned long) ABS (yy) || (signed long) (r1 * yy + r2) != xx) + abort (); + } + save_time: + { unsigned int xx = x, yy = y, r1, r2; + if (yy == 0) continue; + r1 = xx / yy; + r2 = xx % yy; + if (r2 >= yy || r1 * yy + r2 != xx) + abort (); + } + { signed int xx = x, yy = y, r1, r2; + if ((unsigned int) xx << 1 == 0 && yy == -1) + continue; + r1 = xx / yy; + r2 = xx % yy; + if (ABS (r2) >= (unsigned int) ABS (yy) || (signed int) (r1 * yy + r2) != xx) + abort (); + } + { unsigned short xx = x, yy = y, r1, r2; + if (yy == 0) continue; + r1 = xx / yy; + r2 = xx % yy; + if (r2 >= yy || r1 * yy + r2 != xx) + abort (); + } + { signed short xx = x, yy = y, r1, r2; + r1 = xx / yy; + r2 = xx % yy; + if (ABS (r2) >= (unsigned short) ABS (yy) || (signed short) (r1 * yy + r2) != xx) + abort (); + } + { unsigned char xx = x, yy = y, r1, r2; + if (yy == 0) continue; + r1 = xx / yy; + r2 = xx % yy; + if (r2 >= yy || r1 * yy + r2 != xx) + abort (); + } + { signed char xx = x, yy = y, r1, r2; + r1 = xx / yy; + r2 = xx % yy; + if (ABS (r2) >= (unsigned char) ABS (yy) || (signed char) (r1 * yy + r2) != xx) + abort (); + } + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ashldi-1.c b/gcc/testsuite/gcc.c-torture/execute/ashldi-1.c new file mode 100644 index 000000000..66716972f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ashldi-1.c @@ -0,0 +1,221 @@ +#include + +extern void abort(void); +extern void exit(int); + +#if __LONG_LONG_MAX__ == 9223372036854775807LL +#define BITS 64 + +static unsigned long long const data[64] = { + 0x123456789abcdefULL, + 0x2468acf13579bdeULL, + 0x48d159e26af37bcULL, + 0x91a2b3c4d5e6f78ULL, + 0x123456789abcdef0ULL, + 0x2468acf13579bde0ULL, + 0x48d159e26af37bc0ULL, + 0x91a2b3c4d5e6f780ULL, + 0x23456789abcdef00ULL, + 0x468acf13579bde00ULL, + 0x8d159e26af37bc00ULL, + 0x1a2b3c4d5e6f7800ULL, + 0x3456789abcdef000ULL, + 0x68acf13579bde000ULL, + 0xd159e26af37bc000ULL, + 0xa2b3c4d5e6f78000ULL, + 0x456789abcdef0000ULL, + 0x8acf13579bde0000ULL, + 0x159e26af37bc0000ULL, + 0x2b3c4d5e6f780000ULL, + 0x56789abcdef00000ULL, + 0xacf13579bde00000ULL, + 0x59e26af37bc00000ULL, + 0xb3c4d5e6f7800000ULL, + 0x6789abcdef000000ULL, + 0xcf13579bde000000ULL, + 0x9e26af37bc000000ULL, + 0x3c4d5e6f78000000ULL, + 0x789abcdef0000000ULL, + 0xf13579bde0000000ULL, + 0xe26af37bc0000000ULL, + 0xc4d5e6f780000000ULL, + 0x89abcdef00000000ULL, + 0x13579bde00000000ULL, + 0x26af37bc00000000ULL, + 0x4d5e6f7800000000ULL, + 0x9abcdef000000000ULL, + 0x3579bde000000000ULL, + 0x6af37bc000000000ULL, + 0xd5e6f78000000000ULL, + 0xabcdef0000000000ULL, + 0x579bde0000000000ULL, + 0xaf37bc0000000000ULL, + 0x5e6f780000000000ULL, + 0xbcdef00000000000ULL, + 0x79bde00000000000ULL, + 0xf37bc00000000000ULL, + 0xe6f7800000000000ULL, + 0xcdef000000000000ULL, + 0x9bde000000000000ULL, + 0x37bc000000000000ULL, + 0x6f78000000000000ULL, + 0xdef0000000000000ULL, + 0xbde0000000000000ULL, + 0x7bc0000000000000ULL, + 0xf780000000000000ULL, + 0xef00000000000000ULL, + 0xde00000000000000ULL, + 0xbc00000000000000ULL, + 0x7800000000000000ULL, + 0xf000000000000000ULL, + 0xe000000000000000ULL, + 0xc000000000000000ULL, + 0x8000000000000000ULL +}; + +#elif __LONG_LONG_MAX__ == 2147483647LL +#define BITS 32 + +static unsigned long long const data[32] = { + 0x1234567fULL, + 0x2468acfeULL, + 0x48d159fcULL, + 0x91a2b3f8ULL, + 0x234567f0ULL, + 0x468acfe0ULL, + 0x8d159fc0ULL, + 0x1a2b3f80ULL, + 0x34567f00ULL, + 0x68acfe00ULL, + 0xd159fc00ULL, + 0xa2b3f800ULL, + 0x4567f000ULL, + 0x8acfe000ULL, + 0x159fc000ULL, + 0x2b3f8000ULL, + 0x567f0000ULL, + 0xacfe0000ULL, + 0x59fc0000ULL, + 0xb3f80000ULL, + 0x67f00000ULL, + 0xcfe00000ULL, + 0x9fc00000ULL, + 0x3f800000ULL, + 0x7f000000ULL, + 0xfe000000ULL, + 0xfc000000ULL, + 0xf8000000ULL, + 0xf0000000ULL, + 0xe0000000ULL, + 0xc0000000ULL, + 0x80000000ULL +}; + +#else +#error "Update the test case." +#endif + +static unsigned long long +variable_shift(unsigned long long x, int i) +{ + return x << i; +} + +static unsigned long long +constant_shift(unsigned long long x, int i) +{ + switch (i) + { + case 0: x = x << 0; break; + case 1: x = x << 1; break; + case 2: x = x << 2; break; + case 3: x = x << 3; break; + case 4: x = x << 4; break; + case 5: x = x << 5; break; + case 6: x = x << 6; break; + case 7: x = x << 7; break; + case 8: x = x << 8; break; + case 9: x = x << 9; break; + case 10: x = x << 10; break; + case 11: x = x << 11; break; + case 12: x = x << 12; break; + case 13: x = x << 13; break; + case 14: x = x << 14; break; + case 15: x = x << 15; break; + case 16: x = x << 16; break; + case 17: x = x << 17; break; + case 18: x = x << 18; break; + case 19: x = x << 19; break; + case 20: x = x << 20; break; + case 21: x = x << 21; break; + case 22: x = x << 22; break; + case 23: x = x << 23; break; + case 24: x = x << 24; break; + case 25: x = x << 25; break; + case 26: x = x << 26; break; + case 27: x = x << 27; break; + case 28: x = x << 28; break; + case 29: x = x << 29; break; + case 30: x = x << 30; break; + case 31: x = x << 31; break; +#if BITS > 32 + case 32: x = x << 32; break; + case 33: x = x << 33; break; + case 34: x = x << 34; break; + case 35: x = x << 35; break; + case 36: x = x << 36; break; + case 37: x = x << 37; break; + case 38: x = x << 38; break; + case 39: x = x << 39; break; + case 40: x = x << 40; break; + case 41: x = x << 41; break; + case 42: x = x << 42; break; + case 43: x = x << 43; break; + case 44: x = x << 44; break; + case 45: x = x << 45; break; + case 46: x = x << 46; break; + case 47: x = x << 47; break; + case 48: x = x << 48; break; + case 49: x = x << 49; break; + case 50: x = x << 50; break; + case 51: x = x << 51; break; + case 52: x = x << 52; break; + case 53: x = x << 53; break; + case 54: x = x << 54; break; + case 55: x = x << 55; break; + case 56: x = x << 56; break; + case 57: x = x << 57; break; + case 58: x = x << 58; break; + case 59: x = x << 59; break; + case 60: x = x << 60; break; + case 61: x = x << 61; break; + case 62: x = x << 62; break; + case 63: x = x << 63; break; +#endif + + default: + abort (); + } + return x; +} + +int +main() +{ + int i; + + for (i = 0; i < BITS; ++i) + { + unsigned long long y = variable_shift (data[0], i); + if (y != data[i]) + abort (); + } + for (i = 0; i < BITS; ++i) + { + unsigned long long y = constant_shift (data[0], i); + if (y != data[i]) + abort (); + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ashrdi-1.c b/gcc/testsuite/gcc.c-torture/execute/ashrdi-1.c new file mode 100644 index 000000000..c032b0c18 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ashrdi-1.c @@ -0,0 +1,335 @@ +#include + +extern void abort(void); +extern void exit(int); + +#if __LONG_LONG_MAX__ == 9223372036854775807LL +#define BITS 64 + +static long long const zext[64] = { + 0x7654321fedcba980LL, + 0x3b2a190ff6e5d4c0LL, + 0x1d950c87fb72ea60LL, + 0xeca8643fdb97530LL, + 0x7654321fedcba98LL, + 0x3b2a190ff6e5d4cLL, + 0x1d950c87fb72ea6LL, + 0xeca8643fdb9753LL, + 0x7654321fedcba9LL, + 0x3b2a190ff6e5d4LL, + 0x1d950c87fb72eaLL, + 0xeca8643fdb975LL, + 0x7654321fedcbaLL, + 0x3b2a190ff6e5dLL, + 0x1d950c87fb72eLL, + 0xeca8643fdb97LL, + 0x7654321fedcbLL, + 0x3b2a190ff6e5LL, + 0x1d950c87fb72LL, + 0xeca8643fdb9LL, + 0x7654321fedcLL, + 0x3b2a190ff6eLL, + 0x1d950c87fb7LL, + 0xeca8643fdbLL, + 0x7654321fedLL, + 0x3b2a190ff6LL, + 0x1d950c87fbLL, + 0xeca8643fdLL, + 0x7654321feLL, + 0x3b2a190ffLL, + 0x1d950c87fLL, + 0xeca8643fLL, + 0x7654321fLL, + 0x3b2a190fLL, + 0x1d950c87LL, + 0xeca8643LL, + 0x7654321LL, + 0x3b2a190LL, + 0x1d950c8LL, + 0xeca864LL, + 0x765432LL, + 0x3b2a19LL, + 0x1d950cLL, + 0xeca86LL, + 0x76543LL, + 0x3b2a1LL, + 0x1d950LL, + 0xeca8LL, + 0x7654LL, + 0x3b2aLL, + 0x1d95LL, + 0xecaLL, + 0x765LL, + 0x3b2LL, + 0x1d9LL, + 0xecLL, + 0x76LL, + 0x3bLL, + 0x1dLL, + 0xeLL, + 0x7LL, + 0x3LL, + 0x1LL, + 0LL +}; + +static long long const sext[64] = { + 0x8edcba9f76543210LL, + 0xc76e5d4fbb2a1908LL, + 0xe3b72ea7dd950c84LL, + 0xf1db9753eeca8642LL, + 0xf8edcba9f7654321LL, + 0xfc76e5d4fbb2a190LL, + 0xfe3b72ea7dd950c8LL, + 0xff1db9753eeca864LL, + 0xff8edcba9f765432LL, + 0xffc76e5d4fbb2a19LL, + 0xffe3b72ea7dd950cLL, + 0xfff1db9753eeca86LL, + 0xfff8edcba9f76543LL, + 0xfffc76e5d4fbb2a1LL, + 0xfffe3b72ea7dd950LL, + 0xffff1db9753eeca8LL, + 0xffff8edcba9f7654LL, + 0xffffc76e5d4fbb2aLL, + 0xffffe3b72ea7dd95LL, + 0xfffff1db9753eecaLL, + 0xfffff8edcba9f765LL, + 0xfffffc76e5d4fbb2LL, + 0xfffffe3b72ea7dd9LL, + 0xffffff1db9753eecLL, + 0xffffff8edcba9f76LL, + 0xffffffc76e5d4fbbLL, + 0xffffffe3b72ea7ddLL, + 0xfffffff1db9753eeLL, + 0xfffffff8edcba9f7LL, + 0xfffffffc76e5d4fbLL, + 0xfffffffe3b72ea7dLL, + 0xffffffff1db9753eLL, + 0xffffffff8edcba9fLL, + 0xffffffffc76e5d4fLL, + 0xffffffffe3b72ea7LL, + 0xfffffffff1db9753LL, + 0xfffffffff8edcba9LL, + 0xfffffffffc76e5d4LL, + 0xfffffffffe3b72eaLL, + 0xffffffffff1db975LL, + 0xffffffffff8edcbaLL, + 0xffffffffffc76e5dLL, + 0xffffffffffe3b72eLL, + 0xfffffffffff1db97LL, + 0xfffffffffff8edcbLL, + 0xfffffffffffc76e5LL, + 0xfffffffffffe3b72LL, + 0xffffffffffff1db9LL, + 0xffffffffffff8edcLL, + 0xffffffffffffc76eLL, + 0xffffffffffffe3b7LL, + 0xfffffffffffff1dbLL, + 0xfffffffffffff8edLL, + 0xfffffffffffffc76LL, + 0xfffffffffffffe3bLL, + 0xffffffffffffff1dLL, + 0xffffffffffffff8eLL, + 0xffffffffffffffc7LL, + 0xffffffffffffffe3LL, + 0xfffffffffffffff1LL, + 0xfffffffffffffff8LL, + 0xfffffffffffffffcLL, + 0xfffffffffffffffeLL, + 0xffffffffffffffffLL +}; + +#elif __LONG_LONG_MAX__ == 2147483647LL +#define BITS 32 + +static long long const zext[32] = { + 0x76543218LL, + 0x3b2a190cLL, + 0x1d950c86LL, + 0xeca8643LL, + 0x7654321LL, + 0x3b2a190LL, + 0x1d950c8LL, + 0xeca864LL, + 0x765432LL, + 0x3b2a19LL, + 0x1d950cLL, + 0xeca86LL, + 0x76543LL, + 0x3b2a1LL, + 0x1d950LL, + 0xeca8LL, + 0x7654LL, + 0x3b2aLL, + 0x1d95LL, + 0xecaLL, + 0x765LL, + 0x3b2LL, + 0x1d9LL, + 0xecLL, + 0x76LL, + 0x3bLL, + 0x1dLL, + 0xeLL, + 0x7LL, + 0x3LL, + 0x1LL, + 0LL +}; + +static long long const sext[64] = { + 0x87654321LL, + 0xc3b2a190LL, + 0xe1d950c8LL, + 0xf0eca864LL, + 0xf8765432LL, + 0xfc3b2a19LL, + 0xfe1d950cLL, + 0xff0eca86LL, + 0xff876543LL, + 0xffc3b2a1LL, + 0xffe1d950LL, + 0xfff0eca8LL, + 0xfff87654LL, + 0xfffc3b2aLL, + 0xfffe1d95LL, + 0xffff0ecaLL, + 0xffff8765LL, + 0xffffc3b2LL, + 0xffffe1d9LL, + 0xfffff0ecLL, + 0xfffff876LL, + 0xfffffc3bLL, + 0xfffffe1dLL, + 0xffffff0eLL, + 0xffffff87LL, + 0xffffffc3LL, + 0xffffffe1LL, + 0xfffffff0LL, + 0xfffffff8LL, + 0xfffffffcLL, + 0xfffffffeLL, + 0xffffffffLL +}; + +#else +#error "Update the test case." +#endif + +static long long +variable_shift(long long x, int i) +{ + return x >> i; +} + +static long long +constant_shift(long long x, int i) +{ + switch (i) + { + case 0: x = x >> 0; break; + case 1: x = x >> 1; break; + case 2: x = x >> 2; break; + case 3: x = x >> 3; break; + case 4: x = x >> 4; break; + case 5: x = x >> 5; break; + case 6: x = x >> 6; break; + case 7: x = x >> 7; break; + case 8: x = x >> 8; break; + case 9: x = x >> 9; break; + case 10: x = x >> 10; break; + case 11: x = x >> 11; break; + case 12: x = x >> 12; break; + case 13: x = x >> 13; break; + case 14: x = x >> 14; break; + case 15: x = x >> 15; break; + case 16: x = x >> 16; break; + case 17: x = x >> 17; break; + case 18: x = x >> 18; break; + case 19: x = x >> 19; break; + case 20: x = x >> 20; break; + case 21: x = x >> 21; break; + case 22: x = x >> 22; break; + case 23: x = x >> 23; break; + case 24: x = x >> 24; break; + case 25: x = x >> 25; break; + case 26: x = x >> 26; break; + case 27: x = x >> 27; break; + case 28: x = x >> 28; break; + case 29: x = x >> 29; break; + case 30: x = x >> 30; break; + case 31: x = x >> 31; break; +#if BITS > 32 + case 32: x = x >> 32; break; + case 33: x = x >> 33; break; + case 34: x = x >> 34; break; + case 35: x = x >> 35; break; + case 36: x = x >> 36; break; + case 37: x = x >> 37; break; + case 38: x = x >> 38; break; + case 39: x = x >> 39; break; + case 40: x = x >> 40; break; + case 41: x = x >> 41; break; + case 42: x = x >> 42; break; + case 43: x = x >> 43; break; + case 44: x = x >> 44; break; + case 45: x = x >> 45; break; + case 46: x = x >> 46; break; + case 47: x = x >> 47; break; + case 48: x = x >> 48; break; + case 49: x = x >> 49; break; + case 50: x = x >> 50; break; + case 51: x = x >> 51; break; + case 52: x = x >> 52; break; + case 53: x = x >> 53; break; + case 54: x = x >> 54; break; + case 55: x = x >> 55; break; + case 56: x = x >> 56; break; + case 57: x = x >> 57; break; + case 58: x = x >> 58; break; + case 59: x = x >> 59; break; + case 60: x = x >> 60; break; + case 61: x = x >> 61; break; + case 62: x = x >> 62; break; + case 63: x = x >> 63; break; +#endif + + default: + abort (); + } + return x; +} + +int +main() +{ + int i; + + for (i = 0; i < BITS; ++i) + { + long long y = variable_shift (zext[0], i); + if (y != zext[i]) + abort (); + } + for (i = 0; i < BITS; ++i) + { + long long y = variable_shift (sext[0], i); + if (y != sext[i]) + abort (); + } + for (i = 0; i < BITS; ++i) + { + long long y = constant_shift (zext[0], i); + if (y != zext[i]) + abort (); + } + for (i = 0; i < BITS; ++i) + { + long long y = constant_shift (sext[0], i); + if (y != sext[i]) + abort (); + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/bcp-1.c b/gcc/testsuite/gcc.c-torture/execute/bcp-1.c new file mode 100644 index 000000000..8dd8e22d7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/bcp-1.c @@ -0,0 +1,91 @@ +__attribute__ ((externally_visible)) int global; +int func(void); + +/* These must fail. */ +int bad0(void) { return __builtin_constant_p(global); } +int bad1(void) { return __builtin_constant_p(global++); } +inline int bad2(int x) { return __builtin_constant_p(x++); } +inline int bad3(int x) { return __builtin_constant_p(x); } +inline int bad4(const char *x) { return __builtin_constant_p(x); } +int bad5(void) { return bad2(1); } +inline int bad6(int x) { return __builtin_constant_p(x+1); } +int bad7(void) { return __builtin_constant_p(func()); } +int bad8(void) { char buf[10]; return __builtin_constant_p(buf); } +int bad9(const char *x) { return __builtin_constant_p(x[123456]); } +int bad10(void) { return __builtin_constant_p(&global); } + +/* These must pass, or we've broken gcc2 functionality. */ +int good0(void) { return __builtin_constant_p(1); } +int good1(void) { return __builtin_constant_p("hi"); } +int good2(void) { return __builtin_constant_p((1234 + 45) & ~7); } + +/* These are extensions to gcc2. Failure indicates an optimization + regression. */ +int opt0(void) { return bad3(1); } +int opt1(void) { return bad6(1); } +int opt2(void) { return __builtin_constant_p("hi"[0]); } + +/* + * Opt3 is known to fail. It is one of the important cases that glibc + * was interested in though, so keep this around as a reminder. + * + * The solution is to add bits to recover bytes from constant pool + * elements given nothing but a constant pool label and an offset. + * When we can do that, and we can simplify strlen after the fact, + * then we can enable recognition of constant pool labels as constants. + */ + +/* int opt3(void) { return bad4("hi"); } */ + + +/* Call through tables so -finline-functions can't screw with us. */ +int (* volatile bad_t0[])(void) = { + bad0, bad1, bad5, bad7, bad8, bad10 +}; + +int (* volatile bad_t1[])(int x) = { + bad2, bad3, bad6 +}; + +int (* volatile bad_t2[])(const char *x) = { + bad4, bad9 +}; + +int (* volatile good_t0[])(void) = { + good0, good1, good2 +}; + +int (* volatile opt_t0[])(void) = { + opt0, opt1, opt2 /* , opt3 */ +}; + +#define N(arr) (sizeof(arr)/sizeof(*arr)) + +int main() +{ + int i; + + for (i = 0; i < N(bad_t0); ++i) + if ((*bad_t0[i])()) + abort(); + + for (i = 0; i < N(bad_t1); ++i) + if ((*bad_t1[i])(1)) + abort(); + + for (i = 0; i < N(bad_t2); ++i) + if ((*bad_t2[i])("hi")) + abort(); + + for (i = 0; i < N(good_t0); ++i) + if (! (*good_t0[i])()) + abort(); + +#ifdef __OPTIMIZE__ + for (i = 0; i < N(opt_t0); ++i) + if (! (*opt_t0[i])()) + abort(); +#endif + + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/bf-layout-1.c b/gcc/testsuite/gcc.c-torture/execute/bf-layout-1.c new file mode 100644 index 000000000..a82429ba2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/bf-layout-1.c @@ -0,0 +1,9 @@ +struct { long f8:8; long f24:24; } a; +struct { long f32:32; } b; + +main () +{ + if (sizeof (a) != sizeof (b)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/bf-pack-1.c b/gcc/testsuite/gcc.c-torture/execute/bf-pack-1.c new file mode 100644 index 000000000..ca3b1db76 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/bf-pack-1.c @@ -0,0 +1,23 @@ +struct foo +{ + unsigned half:16; + unsigned long whole:32 __attribute__ ((packed)); +}; + +f (struct foo *q) +{ + if (q->half != 0x1234) + abort (); + if (q->whole != 0x56789abcL) + abort (); +} + +main () +{ + struct foo bar; + + bar.half = 0x1234; + bar.whole = 0x56789abcL; + f (&bar); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/bf-sign-1.c b/gcc/testsuite/gcc.c-torture/execute/bf-sign-1.c new file mode 100644 index 000000000..3cc3eac15 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/bf-sign-1.c @@ -0,0 +1,18 @@ +main () +{ + struct { + signed int s:3; + unsigned int u:3; + int i:3; + } x = {-1, -1, -1}; + + if (x.u != 7) + abort (); + if (x.s != - 1) + abort (); + + if (x.i != -1 && x.i != 7) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/bf-sign-2.c b/gcc/testsuite/gcc.c-torture/execute/bf-sign-2.c new file mode 100644 index 000000000..e8e17176a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/bf-sign-2.c @@ -0,0 +1,66 @@ +/* + This test checks promotion of bitfields. Bitfields should be promoted + very much like chars and shorts: + + Bitfields (signed or unsigned) should be promoted to signed int if their + value will fit in a signed int, otherwise to an unsigned int if their + value will fit in an unsigned int, otherwise we don't promote them (ANSI/ISO + does not specify the behavior of bitfields larger than an unsigned int). + + We test the behavior by subtracting two from the promoted value: this will + result in a negitive value for signed types, a positive value for unsigned + types. This test (of course) assumes that the compiler is correctly + implementing signed and unsigned arithmetic. + */ + +struct X { + unsigned int u3:3; + signed long int s31:31; + signed long int s32:32; + unsigned long int u31:31; + unsigned long int u32:32; + unsigned long long ull3 :3; + unsigned long long ull35:35; + unsigned u15:15; +}; + +struct X x; + +main () +{ + if ((x.u3 - 2) >= 0) /* promoted value should be signed */ + abort (); + + if ((x.s31 - 2) >= 0) /* promoted value should be signed */ + abort (); + + if ((x.s32 - 2) >= 0) /* promoted value should be signed */ + abort (); + + if ((x.u15 - 2) >= 0) /* promoted value should be signed */ + abort (); + + /* Conditionalize check on whether integers are 4 bytes or larger, i.e. + larger than a 31 bit bitfield. */ + if (sizeof (int) >= 4) + { + if ((x.u31 - 2) >= 0) /* promoted value should be signed */ + abort (); + } + else + { + if ((x.u31 - 2) < 0) /* promoted value should be UNsigned */ + abort (); + } + + if ((x.u32 - 2) < 0) /* promoted value should be UNsigned */ + abort (); + + if ((x.ull3 - 2) >= 0) /* promoted value should be signed */ + abort (); + + if ((x.ull35 - 2) < 0) /* promoted value should be UNsigned */ + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/bf64-1.c b/gcc/testsuite/gcc.c-torture/execute/bf64-1.c new file mode 100644 index 000000000..60028fb1a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/bf64-1.c @@ -0,0 +1,40 @@ +struct tmp +{ + long long int pad : 12; + long long int field : 52; +}; + +struct tmp2 +{ + long long int field : 52; + long long int pad : 12; +}; + +struct tmp +sub (struct tmp tmp) +{ + tmp.field |= 0x0008765412345678LL; + return tmp; +} + +struct tmp2 +sub2 (struct tmp2 tmp2) +{ + tmp2.field |= 0x0008765412345678LL; + return tmp2; +} + +main() +{ + struct tmp tmp = {0x123, 0xFFF000FFF000FLL}; + struct tmp2 tmp2 = {0xFFF000FFF000FLL, 0x123}; + + tmp = sub (tmp); + tmp2 = sub2 (tmp2); + + if (tmp.pad != 0x123 || tmp.field != 0xFFFFFF541FFF567FLL) + abort (); + if (tmp2.pad != 0x123 || tmp2.field != 0xFFFFFF541FFF567FLL) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/bf64-1.x b/gcc/testsuite/gcc.c-torture/execute/bf64-1.x new file mode 100644 index 000000000..f3069f284 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/bf64-1.x @@ -0,0 +1,8 @@ +# The MCore ABI specifies that bitfields may not exceed 32 bits. +# Hence this tes will fail. + +if { [istarget "mcore-*-*"] } { + set torture_execute_xfail "mcore-*-*" +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/bitfld-1.c b/gcc/testsuite/gcc.c-torture/execute/bitfld-1.c new file mode 100644 index 000000000..b7e86e810 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/bitfld-1.c @@ -0,0 +1,54 @@ +/* Copyright 2002 Free Software Foundation, Inc. + + Tests correct signedness of operations on bitfields; in particular + that integer promotions are done correctly, including the case when + casts are present. + + The C front end was eliding the cast of an unsigned bitfield to + unsigned as a no-op, when in fact it forces a conversion to a + full-width unsigned int. (At the time of writing, the C++ front end + has a different bug; it erroneously promotes the uncast unsigned + bitfield to an unsigned int). + + Source: Neil Booth, 25 Jan 2002, based on PR 3325 (and 3326, which + is a different manifestation of the same bug). +*/ + +extern void abort (); + +int +main(int argc, char *argv[]) +{ + struct x { signed int i : 7; unsigned int u : 7; } bit; + + unsigned int u; + int i; + unsigned int unsigned_result = -13U % 61; + int signed_result = -13 % 61; + + bit.u = 61, u = 61; + bit.i = -13, i = -13; + + if (i % u != unsigned_result) + abort (); + if (i % (unsigned int) u != unsigned_result) + abort (); + + /* Somewhat counter-intuitively, bit.u is promoted to an int, making + the operands and result an int. */ + if (i % bit.u != signed_result) + abort (); + + if (bit.i % bit.u != signed_result) + abort (); + + /* But with a cast to unsigned int, the unsigned int is promoted to + itself as a no-op, and the operands and result are unsigned. */ + if (i % (unsigned int) bit.u != unsigned_result) + abort (); + + if (bit.i % (unsigned int) bit.u != unsigned_result) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/bitfld-2.c b/gcc/testsuite/gcc.c-torture/execute/bitfld-2.c new file mode 100644 index 000000000..445879b14 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/bitfld-2.c @@ -0,0 +1,28 @@ +/* Test whether bit field boundaries aren't advanced if bit field type + has alignment large enough. */ +extern void abort (void); +extern void exit (int); + +struct A { + unsigned short a : 5; + unsigned short b : 5; + unsigned short c : 6; +}; + +struct B { + unsigned short a : 5; + unsigned short b : 3; + unsigned short c : 8; +}; + +int main () +{ + /* If short is not at least 16 bits wide, don't test anything. */ + if ((unsigned short) 65521 != 65521) + exit (0); + + if (sizeof (struct A) != sizeof (struct B)) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/bitfld-3.c b/gcc/testsuite/gcc.c-torture/execute/bitfld-3.c new file mode 100644 index 000000000..52a4147cc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/bitfld-3.c @@ -0,0 +1,54 @@ +/* Test that operations on bit-fields yield results reduced to bit-field + type. */ +/* Origin: Joseph Myers */ + +extern void exit (int); +extern void abort (void); + +struct s { + unsigned long long u33: 33; + unsigned long long u40: 40; + unsigned long long u41: 41; +}; + +struct s a = { 0x100000, 0x100000, 0x100000 }; +struct s b = { 0x100000000ULL, 0x100000000ULL, 0x100000000ULL }; +struct s c = { 0x1FFFFFFFFULL, 0, 0 }; + +int +main (void) +{ + if (a.u33 * a.u33 != 0 || a.u33 * a.u40 != 0 || a.u40 * a.u33 != 0 + || a.u40 * a.u40 != 0) + abort (); + if (a.u33 * a.u41 != 0x10000000000ULL + || a.u40 * a.u41 != 0x10000000000ULL + || a.u41 * a.u33 != 0x10000000000ULL + || a.u41 * a.u40 != 0x10000000000ULL + || a.u41 * a.u41 != 0x10000000000ULL) + abort (); + if (b.u33 + b.u33 != 0) + abort (); + if (b.u33 + b.u40 != 0x200000000ULL + || b.u33 + b.u41 != 0x200000000ULL + || b.u40 + b.u33 != 0x200000000ULL + || b.u40 + b.u40 != 0x200000000ULL + || b.u40 + b.u41 != 0x200000000ULL + || b.u41 + b.u33 != 0x200000000ULL + || b.u41 + b.u40 != 0x200000000ULL + || b.u41 + b.u41 != 0x200000000ULL) + abort (); + if (a.u33 - b.u33 != 0x100100000ULL + || a.u33 - b.u40 != 0xFF00100000ULL + || a.u33 - b.u41 != 0x1FF00100000ULL + || a.u40 - b.u33 != 0xFF00100000ULL + || a.u40 - b.u40 != 0xFF00100000ULL + || a.u40 - b.u41 != 0x1FF00100000ULL + || a.u41 - b.u33 != 0x1FF00100000ULL + || a.u41 - b.u40 != 0x1FF00100000ULL + || a.u41 - b.u41 != 0x1FF00100000ULL) + abort (); + if (++c.u33 != 0 || --c.u40 != 0xFFFFFFFFFFULL || c.u41-- != 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/bitfld-4.c b/gcc/testsuite/gcc.c-torture/execute/bitfld-4.c new file mode 100644 index 000000000..6f7d7e25c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/bitfld-4.c @@ -0,0 +1,21 @@ +/* When comparisons of bit-fields to unsigned constants got shortened, + the shortened signed constant was wrongly marked as overflowing, + leading to a later integer_zerop failure and misoptimization. + + Related to bug tree-optimization/16437 but shows the problem on + 32-bit systems. */ +/* Origin: Joseph Myers */ + +extern void abort (void); + +struct s { int a:12, b:20; }; + +struct s x = { -123, -456 }; + +int +main (void) +{ + if (x.a != -123U || x.b != -456U) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/bitfld-4.x b/gcc/testsuite/gcc.c-torture/execute/bitfld-4.x new file mode 100644 index 000000000..121fcfecc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/bitfld-4.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_int16] } { + return 1 +} + +return 0; diff --git a/gcc/testsuite/gcc.c-torture/execute/bitfld-5.c b/gcc/testsuite/gcc.c-torture/execute/bitfld-5.c new file mode 100644 index 000000000..ca88d9221 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/bitfld-5.c @@ -0,0 +1,35 @@ +/* See http://gcc.gnu.org/ml/gcc/2009-06/msg00072.html. */ + +extern void abort (void); + +struct s +{ + unsigned long long a:2; + unsigned long long b:40; + unsigned long long c:22; +}; + +__attribute__ ((noinline)) void +g (unsigned long long a, unsigned long long b) +{ + asm (""); + if (a != b) + abort (); +} + +__attribute__ ((noinline)) void +f (struct s s, unsigned long long b) +{ + asm (""); + g (((unsigned long long) (s.b-8)) + 8, b); +} + +int +main () +{ + struct s s = {1, 10, 3}; + struct s t = {1, 2, 3}; + f (s, 10); + f (t, 0x10000000002); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/built-in-setjmp.c b/gcc/testsuite/gcc.c-torture/execute/built-in-setjmp.c new file mode 100644 index 000000000..9da787884 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/built-in-setjmp.c @@ -0,0 +1,39 @@ +extern int strcmp(const char *, const char *); +extern char *strcpy(char *, const char *); +extern void abort(void); +extern void exit(int); + +void *buf[20]; + +void __attribute__((noinline)) +sub2 (void) +{ + __builtin_longjmp (buf, 1); +} + +int +main () +{ + char *p = (char *) __builtin_alloca (20); + + strcpy (p, "test"); + + if (__builtin_setjmp (buf)) + { + if (strcmp (p, "test") != 0) + abort (); + + exit (0); + } + + { + int *q = (int *) __builtin_alloca (p[2] * sizeof (int)); + int i; + + for (i = 0; i < p[2]; i++) + q[i] = 0; + + while (1) + sub2 (); + } +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtin-bitops-1.c b/gcc/testsuite/gcc.c-torture/execute/builtin-bitops-1.c new file mode 100644 index 000000000..8c3122cc6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtin-bitops-1.c @@ -0,0 +1,263 @@ +#include +#include + +#if __INT_MAX__ > 2147483647L +# if __INT_MAX__ >= 9223372036854775807L +# define BITSIZEOF_INT 64 +# else +# define BITSIZEOF_INT 32 +# endif +#else +# if __INT_MAX__ >= 2147483647L +# define BITSIZEOF_INT 32 +# else +# define BITSIZEOF_INT 16 +# endif +#endif + +#if __LONG_MAX__ > 2147483647L +# if __LONG_MAX__ >= 9223372036854775807L +# define BITSIZEOF_LONG 64 +# else +# define BITSIZEOF_LONG 32 +# endif +#else +# define BITSIZEOF_LONG 32 +#endif + +#if __LONG_LONG_MAX__ > 2147483647L +# if __LONG_LONG_MAX__ >= 9223372036854775807L +# define BITSIZEOF_LONG_LONG 64 +# else +# define BITSIZEOF_LONG_LONG 32 +# endif +#else +# define BITSIZEOF_LONG_LONG 32 +#endif + +#define MAKE_FUNS(suffix, type) \ +int my_ffs##suffix(type x) { \ + int i; \ + if (x == 0) \ + return 0; \ + for (i = 0; i < CHAR_BIT * sizeof (type); i++) \ + if (x & ((type) 1 << i)) \ + break; \ + return i + 1; \ +} \ + \ +int my_ctz##suffix(type x) { \ + int i; \ + for (i = 0; i < CHAR_BIT * sizeof (type); i++) \ + if (x & ((type) 1 << i)) \ + break; \ + return i; \ +} \ + \ +int my_clz##suffix(type x) { \ + int i; \ + for (i = 0; i < CHAR_BIT * sizeof (type); i++) \ + if (x & ((type) 1 << ((CHAR_BIT * sizeof (type)) - i - 1))) \ + break; \ + return i; \ +} \ + \ +int my_popcount##suffix(type x) { \ + int i; \ + int count = 0; \ + for (i = 0; i < CHAR_BIT * sizeof (type); i++) \ + if (x & ((type) 1 << i)) \ + count++; \ + return count; \ +} \ + \ +int my_parity##suffix(type x) { \ + int i; \ + int count = 0; \ + for (i = 0; i < CHAR_BIT * sizeof (type); i++) \ + if (x & ((type) 1 << i)) \ + count++; \ + return count & 1; \ +} + +MAKE_FUNS (, unsigned); +MAKE_FUNS (l, unsigned long); +MAKE_FUNS (ll, unsigned long long); + +extern void abort (void); +extern void exit (int); + +#define NUMS16 \ + { \ + 0x0000U, \ + 0x0001U, \ + 0x8000U, \ + 0x0002U, \ + 0x4000U, \ + 0x0100U, \ + 0x0080U, \ + 0xa5a5U, \ + 0x5a5aU, \ + 0xcafeU, \ + 0xffffU \ + } + +#define NUMS32 \ + { \ + 0x00000000UL, \ + 0x00000001UL, \ + 0x80000000UL, \ + 0x00000002UL, \ + 0x40000000UL, \ + 0x00010000UL, \ + 0x00008000UL, \ + 0xa5a5a5a5UL, \ + 0x5a5a5a5aUL, \ + 0xcafe0000UL, \ + 0x00cafe00UL, \ + 0x0000cafeUL, \ + 0xffffffffUL \ + } + +#define NUMS64 \ + { \ + 0x0000000000000000ULL, \ + 0x0000000000000001ULL, \ + 0x8000000000000000ULL, \ + 0x0000000000000002ULL, \ + 0x4000000000000000ULL, \ + 0x0000000100000000ULL, \ + 0x0000000080000000ULL, \ + 0xa5a5a5a5a5a5a5a5ULL, \ + 0x5a5a5a5a5a5a5a5aULL, \ + 0xcafecafe00000000ULL, \ + 0x0000cafecafe0000ULL, \ + 0x00000000cafecafeULL, \ + 0xffffffffffffffffULL \ + } + +unsigned int ints[] = +#if BITSIZEOF_INT == 64 +NUMS64; +#elif BITSIZEOF_INT == 32 +NUMS32; +#else +NUMS16; +#endif + +unsigned long longs[] = +#if BITSIZEOF_LONG == 64 +NUMS64; +#else +NUMS32; +#endif + +unsigned long long longlongs[] = +#if BITSIZEOF_LONG_LONG == 64 +NUMS64; +#else +NUMS32; +#endif + +#define N(table) (sizeof (table) / sizeof (table[0])) + +int +main (void) +{ + int i; + + for (i = 0; i < N(ints); i++) + { + if (__builtin_ffs (ints[i]) != my_ffs (ints[i])) + abort (); + if (ints[i] != 0 + && __builtin_clz (ints[i]) != my_clz (ints[i])) + abort (); + if (ints[i] != 0 + && __builtin_ctz (ints[i]) != my_ctz (ints[i])) + abort (); + if (__builtin_popcount (ints[i]) != my_popcount (ints[i])) + abort (); + if (__builtin_parity (ints[i]) != my_parity (ints[i])) + abort (); + } + + for (i = 0; i < N(longs); i++) + { + if (__builtin_ffsl (longs[i]) != my_ffsl (longs[i])) + abort (); + if (longs[i] != 0 + && __builtin_clzl (longs[i]) != my_clzl (longs[i])) + abort (); + if (longs[i] != 0 + && __builtin_ctzl (longs[i]) != my_ctzl (longs[i])) + abort (); + if (__builtin_popcountl (longs[i]) != my_popcountl (longs[i])) + abort (); + if (__builtin_parityl (longs[i]) != my_parityl (longs[i])) + abort (); + } + + for (i = 0; i < N(longlongs); i++) + { + if (__builtin_ffsll (longlongs[i]) != my_ffsll (longlongs[i])) + abort (); + if (longlongs[i] != 0 + && __builtin_clzll (longlongs[i]) != my_clzll (longlongs[i])) + abort (); + if (longlongs[i] != 0 + && __builtin_ctzll (longlongs[i]) != my_ctzll (longlongs[i])) + abort (); + if (__builtin_popcountll (longlongs[i]) != my_popcountll (longlongs[i])) + abort (); + if (__builtin_parityll (longlongs[i]) != my_parityll (longlongs[i])) + abort (); + } + + /* Test constant folding. */ + +#define TEST(x, suffix) \ + if (__builtin_ffs##suffix (x) != my_ffs##suffix (x)) \ + abort (); \ + if (x != 0 && __builtin_clz##suffix (x) != my_clz##suffix (x)) \ + abort (); \ + if (x != 0 && __builtin_ctz##suffix (x) != my_ctz##suffix (x)) \ + abort (); \ + if (__builtin_popcount##suffix (x) != my_popcount##suffix (x)) \ + abort (); \ + if (__builtin_parity##suffix (x) != my_parity##suffix (x)) \ + abort (); + +#if BITSIZEOF_INT == 32 + TEST(0x00000000UL,); + TEST(0x00000001UL,); + TEST(0x80000000UL,); + TEST(0x40000000UL,); + TEST(0x00010000UL,); + TEST(0x00008000UL,); + TEST(0xa5a5a5a5UL,); + TEST(0x5a5a5a5aUL,); + TEST(0xcafe0000UL,); + TEST(0x00cafe00UL,); + TEST(0x0000cafeUL,); + TEST(0xffffffffUL,); +#endif + +#if BITSIZEOF_LONG_LONG == 64 + TEST(0x0000000000000000ULL, ll); + TEST(0x0000000000000001ULL, ll); + TEST(0x8000000000000000ULL, ll); + TEST(0x0000000000000002ULL, ll); + TEST(0x4000000000000000ULL, ll); + TEST(0x0000000100000000ULL, ll); + TEST(0x0000000080000000ULL, ll); + TEST(0xa5a5a5a5a5a5a5a5ULL, ll); + TEST(0x5a5a5a5a5a5a5a5aULL, ll); + TEST(0xcafecafe00000000ULL, ll); + TEST(0x0000cafecafe0000ULL, ll); + TEST(0x00000000cafecafeULL, ll); + TEST(0xffffffffffffffffULL, ll); +#endif + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtin-constant.c b/gcc/testsuite/gcc.c-torture/execute/builtin-constant.c new file mode 100644 index 000000000..9e5bfb8bf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtin-constant.c @@ -0,0 +1,26 @@ +/* PR optimization/8423. */ + +#define btest(x) __builtin_constant_p(x) ? "1" : "0" + +#ifdef __OPTIMIZE__ +void +foo (char *i) +{ + if (*i == '0') + abort (); +} +#else +void +foo (char *i) +{ +} +#endif + +int +main (void) +{ + int size = sizeof (int); + foo (btest (size)); + foo (btest (size)); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-1.c b/gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-1.c new file mode 100644 index 000000000..4ee05a94d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-1.c @@ -0,0 +1,69 @@ +/* Test that __builtin_prefetch does no harm. + + Prefetch using all valid combinations of rw and locality values. + These must be compile-time constants. */ + +#define NO_TEMPORAL_LOCALITY 0 +#define LOW_TEMPORAL_LOCALITY 1 +#define MODERATE_TEMPORAL_LOCALITY 1 +#define HIGH_TEMPORAL_LOCALITY 3 + +#define WRITE_ACCESS 1 +#define READ_ACCESS 0 + +enum locality { none, low, moderate, high }; +enum rw { read, write }; + +int arr[10]; + +void +good_const (const int *p) +{ + __builtin_prefetch (p, 0, 0); + __builtin_prefetch (p, 0, 1); + __builtin_prefetch (p, 0, 2); + __builtin_prefetch (p, READ_ACCESS, 3); + __builtin_prefetch (p, 1, NO_TEMPORAL_LOCALITY); + __builtin_prefetch (p, 1, LOW_TEMPORAL_LOCALITY); + __builtin_prefetch (p, 1, MODERATE_TEMPORAL_LOCALITY); + __builtin_prefetch (p, WRITE_ACCESS, HIGH_TEMPORAL_LOCALITY); +} + +void +good_enum (const int *p) +{ + __builtin_prefetch (p, read, none); + __builtin_prefetch (p, read, low); + __builtin_prefetch (p, read, moderate); + __builtin_prefetch (p, read, high); + __builtin_prefetch (p, write, none); + __builtin_prefetch (p, write, low); + __builtin_prefetch (p, write, moderate); + __builtin_prefetch (p, write, high); +} + +void +good_expr (const int *p) +{ + __builtin_prefetch (p, 1 - 1, 6 - (2 * 3)); + __builtin_prefetch (p, 1 + 0, 1 + 2); +} + +void +good_vararg (const int *p) +{ + __builtin_prefetch (p, 0, 3); + __builtin_prefetch (p, 0); + __builtin_prefetch (p, 1); + __builtin_prefetch (p); +} + +int +main () +{ + good_const (arr); + good_enum (arr); + good_expr (arr); + good_vararg (arr); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-2.c b/gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-2.c new file mode 100644 index 000000000..530a1b0ef --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-2.c @@ -0,0 +1,152 @@ +/* Test that __builtin_prefetch does no harm. + + Prefetch data using a variety of storage classes and address + expressions. */ + +int glob_int_arr[100]; +int *glob_ptr_int = glob_int_arr; +int glob_int = 4; + +static stat_int_arr[100]; +static int *stat_ptr_int = stat_int_arr; +static int stat_int; + +struct S { + int a; + short b, c; + char d[8]; + struct S *next; +}; + +struct S str; +struct S *ptr_str = &str; + +/* Prefetch global variables using the address of the variable. */ + +void +simple_global () +{ + __builtin_prefetch (glob_int_arr, 0, 0); + __builtin_prefetch (glob_ptr_int, 0, 0); + __builtin_prefetch (&glob_int, 0, 0); +} + +/* Prefetch file-level static variables using the address of the variable. */ + +void +simple_file () +{ + __builtin_prefetch (stat_int_arr, 0, 0); + __builtin_prefetch (stat_ptr_int, 0, 0); + __builtin_prefetch (&stat_int, 0, 0); +} + +/* Prefetch local static variables using the address of the variable. */ + +void +simple_static_local () +{ + static int gx[100]; + static int *hx = gx; + static int ix; + __builtin_prefetch (gx, 0, 0); + __builtin_prefetch (hx, 0, 0); + __builtin_prefetch (&ix, 0, 0); +} + +/* Prefetch local stack variables using the address of the variable. */ + +void +simple_local () +{ + int gx[100]; + int *hx = gx; + int ix; + __builtin_prefetch (gx, 0, 0); + __builtin_prefetch (hx, 0, 0); + __builtin_prefetch (&ix, 0, 0); +} + +/* Prefetch arguments using the address of the variable. */ + +void +simple_arg (int g[100], int *h, int i) +{ + __builtin_prefetch (g, 0, 0); + __builtin_prefetch (h, 0, 0); + __builtin_prefetch (&i, 0, 0); +} + +/* Prefetch using address expressions involving global variables. */ + +void +expr_global (void) +{ + __builtin_prefetch (&str, 0, 0); + __builtin_prefetch (ptr_str, 0, 0); + __builtin_prefetch (&str.b, 0, 0); + __builtin_prefetch (&ptr_str->b, 0, 0); + __builtin_prefetch (&str.d, 0, 0); + __builtin_prefetch (&ptr_str->d, 0, 0); + __builtin_prefetch (str.next, 0, 0); + __builtin_prefetch (ptr_str->next, 0, 0); + __builtin_prefetch (str.next->d, 0, 0); + __builtin_prefetch (ptr_str->next->d, 0, 0); + + __builtin_prefetch (&glob_int_arr, 0, 0); + __builtin_prefetch (glob_ptr_int, 0, 0); + __builtin_prefetch (&glob_int_arr[2], 0, 0); + __builtin_prefetch (&glob_ptr_int[3], 0, 0); + __builtin_prefetch (glob_int_arr+3, 0, 0); + __builtin_prefetch (glob_int_arr+glob_int, 0, 0); + __builtin_prefetch (glob_ptr_int+5, 0, 0); + __builtin_prefetch (glob_ptr_int+glob_int, 0, 0); +} + +/* Prefetch using address expressions involving local variables. */ + +void +expr_local (void) +{ + int b[10]; + int *pb = b; + struct S t; + struct S *pt = &t; + int j = 4; + + __builtin_prefetch (&t, 0, 0); + __builtin_prefetch (pt, 0, 0); + __builtin_prefetch (&t.b, 0, 0); + __builtin_prefetch (&pt->b, 0, 0); + __builtin_prefetch (&t.d, 0, 0); + __builtin_prefetch (&pt->d, 0, 0); + __builtin_prefetch (t.next, 0, 0); + __builtin_prefetch (pt->next, 0, 0); + __builtin_prefetch (t.next->d, 0, 0); + __builtin_prefetch (pt->next->d, 0, 0); + + __builtin_prefetch (&b, 0, 0); + __builtin_prefetch (pb, 0, 0); + __builtin_prefetch (&b[2], 0, 0); + __builtin_prefetch (&pb[3], 0, 0); + __builtin_prefetch (b+3, 0, 0); + __builtin_prefetch (b+j, 0, 0); + __builtin_prefetch (pb+5, 0, 0); + __builtin_prefetch (pb+j, 0, 0); +} + +int +main () +{ + simple_global (); + simple_file (); + simple_static_local (); + simple_local (); + simple_arg (glob_int_arr, glob_ptr_int, glob_int); + + str.next = &str; + expr_global (); + expr_local (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-3.c b/gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-3.c new file mode 100644 index 000000000..2e2e808c1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-3.c @@ -0,0 +1,113 @@ +/* Test that __builtin_prefetch does no harm. + + Prefetch data using a variety of storage classes and address + expressions with volatile variables and pointers. */ + +int glob_int_arr[100]; +int glob_int = 4; +volatile int glob_vol_int_arr[100]; +int * volatile glob_vol_ptr_int = glob_int_arr; +volatile int *glob_ptr_vol_int = glob_vol_int_arr; +volatile int * volatile glob_vol_ptr_vol_int = glob_vol_int_arr; +volatile int glob_vol_int; + +static stat_int_arr[100]; +static volatile int stat_vol_int_arr[100]; +static int * volatile stat_vol_ptr_int = stat_int_arr; +static volatile int *stat_ptr_vol_int = stat_vol_int_arr; +static volatile int * volatile stat_vol_ptr_vol_int = stat_vol_int_arr; +static volatile int stat_vol_int; + +struct S { + int a; + short b, c; + char d[8]; + struct S *next; +}; + +struct S str; +volatile struct S vol_str; +struct S * volatile vol_ptr_str = &str; +volatile struct S *ptr_vol_str = &vol_str; +volatile struct S * volatile vol_ptr_vol_str = &vol_str; + +/* Prefetch volatile global variables using the address of the variable. */ + +void +simple_vol_global () +{ + __builtin_prefetch (glob_vol_int_arr, 0, 0); + __builtin_prefetch (glob_vol_ptr_int, 0, 0); + __builtin_prefetch (glob_ptr_vol_int, 0, 0); + __builtin_prefetch (glob_vol_ptr_vol_int, 0, 0); + __builtin_prefetch (&glob_vol_int, 0, 0); +} + +/* Prefetch volatile static variables using the address of the variable. */ + +void +simple_vol_file () +{ + __builtin_prefetch (stat_vol_int_arr, 0, 0); + __builtin_prefetch (stat_vol_ptr_int, 0, 0); + __builtin_prefetch (stat_ptr_vol_int, 0, 0); + __builtin_prefetch (stat_vol_ptr_vol_int, 0, 0); + __builtin_prefetch (&stat_vol_int, 0, 0); +} + +/* Prefetch using address expressions involving volatile global variables. */ + +void +expr_vol_global (void) +{ + __builtin_prefetch (&vol_str, 0, 0); + __builtin_prefetch (ptr_vol_str, 0, 0); + __builtin_prefetch (vol_ptr_str, 0, 0); + __builtin_prefetch (vol_ptr_vol_str, 0, 0); + __builtin_prefetch (&vol_str.b, 0, 0); + __builtin_prefetch (&ptr_vol_str->b, 0, 0); + __builtin_prefetch (&vol_ptr_str->b, 0, 0); + __builtin_prefetch (&vol_ptr_vol_str->b, 0, 0); + __builtin_prefetch (&vol_str.d, 0, 0); + __builtin_prefetch (&vol_ptr_str->d, 0, 0); + __builtin_prefetch (&ptr_vol_str->d, 0, 0); + __builtin_prefetch (&vol_ptr_vol_str->d, 0, 0); + __builtin_prefetch (vol_str.next, 0, 0); + __builtin_prefetch (vol_ptr_str->next, 0, 0); + __builtin_prefetch (ptr_vol_str->next, 0, 0); + __builtin_prefetch (vol_ptr_vol_str->next, 0, 0); + __builtin_prefetch (vol_str.next->d, 0, 0); + __builtin_prefetch (vol_ptr_str->next->d, 0, 0); + __builtin_prefetch (ptr_vol_str->next->d, 0, 0); + __builtin_prefetch (vol_ptr_vol_str->next->d, 0, 0); + + __builtin_prefetch (&glob_vol_int_arr, 0, 0); + __builtin_prefetch (glob_vol_ptr_int, 0, 0); + __builtin_prefetch (glob_ptr_vol_int, 0, 0); + __builtin_prefetch (glob_vol_ptr_vol_int, 0, 0); + __builtin_prefetch (&glob_vol_int_arr[2], 0, 0); + __builtin_prefetch (&glob_vol_ptr_int[3], 0, 0); + __builtin_prefetch (&glob_ptr_vol_int[3], 0, 0); + __builtin_prefetch (&glob_vol_ptr_vol_int[3], 0, 0); + __builtin_prefetch (glob_vol_int_arr+3, 0, 0); + __builtin_prefetch (glob_vol_int_arr+glob_vol_int, 0, 0); + __builtin_prefetch (glob_vol_ptr_int+5, 0, 0); + __builtin_prefetch (glob_ptr_vol_int+5, 0, 0); + __builtin_prefetch (glob_vol_ptr_vol_int+5, 0, 0); + __builtin_prefetch (glob_vol_ptr_int+glob_vol_int, 0, 0); + __builtin_prefetch (glob_ptr_vol_int+glob_vol_int, 0, 0); + __builtin_prefetch (glob_vol_ptr_vol_int+glob_vol_int, 0, 0); +} + +int +main () +{ + simple_vol_global (); + simple_vol_file (); + + str.next = &str; + vol_str.next = &str; + expr_vol_global (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-4.c b/gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-4.c new file mode 100644 index 000000000..ade892b21 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-4.c @@ -0,0 +1,271 @@ +/* Test that __builtin_prefetch does no harm. + + Check that the expression containing the address to prefetch is + evaluated if it has side effects, even if the target does not support + data prefetch. Check changes to pointers and to array indices that are + either global variables or arguments. */ + +#define ARRSIZE 100 + +int arr[ARRSIZE]; +int *ptr = &arr[20]; +int arrindex = 4; + +/* Check that assignment within a prefetch argument is evaluated. */ + +int +assign_arg_ptr (int *p) +{ + int *q; + __builtin_prefetch ((q = p), 0, 0); + return q == p; +} + +int +assign_glob_ptr (void) +{ + int *q; + __builtin_prefetch ((q = ptr), 0, 0); + return q == ptr; +} + +int +assign_arg_idx (int *p, int i) +{ + int j; + __builtin_prefetch (&p[j = i], 0, 0); + return j == i; +} + +int +assign_glob_idx (void) +{ + int j; + __builtin_prefetch (&ptr[j = arrindex], 0, 0); + return j == arrindex; +} + +/* Check that pre/post increment/decrement within a prefetch argument are + evaluated. */ + +int +preinc_arg_ptr (int *p) +{ + int *q; + q = p + 1; + __builtin_prefetch (++p, 0, 0); + return p == q; +} + +int +preinc_glob_ptr (void) +{ + int *q; + q = ptr + 1; + __builtin_prefetch (++ptr, 0, 0); + return ptr == q; +} + +int +postinc_arg_ptr (int *p) +{ + int *q; + q = p + 1; + __builtin_prefetch (p++, 0, 0); + return p == q; +} + +int +postinc_glob_ptr (void) +{ + int *q; + q = ptr + 1; + __builtin_prefetch (ptr++, 0, 0); + return ptr == q; +} + +int +predec_arg_ptr (int *p) +{ + int *q; + q = p - 1; + __builtin_prefetch (--p, 0, 0); + return p == q; +} + +int +predec_glob_ptr (void) +{ + int *q; + q = ptr - 1; + __builtin_prefetch (--ptr, 0, 0); + return ptr == q; +} + +int +postdec_arg_ptr (int *p) +{ + int *q; + q = p - 1; + __builtin_prefetch (p--, 0, 0); + return p == q; +} + +int +postdec_glob_ptr (void) +{ + int *q; + q = ptr - 1; + __builtin_prefetch (ptr--, 0, 0); + return ptr == q; +} + +int +preinc_arg_idx (int *p, int i) +{ + int j = i + 1; + __builtin_prefetch (&p[++i], 0, 0); + return i == j; +} + + +int +preinc_glob_idx (void) +{ + int j = arrindex + 1; + __builtin_prefetch (&ptr[++arrindex], 0, 0); + return arrindex == j; +} + +int +postinc_arg_idx (int *p, int i) +{ + int j = i + 1; + __builtin_prefetch (&p[i++], 0, 0); + return i == j; +} + +int +postinc_glob_idx (void) +{ + int j = arrindex + 1; + __builtin_prefetch (&ptr[arrindex++], 0, 0); + return arrindex == j; +} + +int +predec_arg_idx (int *p, int i) +{ + int j = i - 1; + __builtin_prefetch (&p[--i], 0, 0); + return i == j; +} + +int +predec_glob_idx (void) +{ + int j = arrindex - 1; + __builtin_prefetch (&ptr[--arrindex], 0, 0); + return arrindex == j; +} + +int +postdec_arg_idx (int *p, int i) +{ + int j = i - 1; + __builtin_prefetch (&p[i--], 0, 0); + return i == j; +} + +int +postdec_glob_idx (void) +{ + int j = arrindex - 1; + __builtin_prefetch (&ptr[arrindex--], 0, 0); + return arrindex == j; +} + +/* Check that function calls within the first prefetch argument are + evaluated. */ + +int getptrcnt = 0; + +int * +getptr (int *p) +{ + getptrcnt++; + return p + 1; +} + +int +funccall_arg_ptr (int *p) +{ + __builtin_prefetch (getptr (p), 0, 0); + return getptrcnt == 1; +} + +int getintcnt = 0; + +int +getint (int i) +{ + getintcnt++; + return i + 1; +} + +int +funccall_arg_idx (int *p, int i) +{ + __builtin_prefetch (&p[getint (i)], 0, 0); + return getintcnt == 1; +} + +int +main () +{ + if (!assign_arg_ptr (ptr)) + abort (); + if (!assign_glob_ptr ()) + abort (); + if (!assign_arg_idx (ptr, 4)) + abort (); + if (!assign_glob_idx ()) + abort (); + if (!preinc_arg_ptr (ptr)) + abort (); + if (!preinc_glob_ptr ()) + abort (); + if (!postinc_arg_ptr (ptr)) + abort (); + if (!postinc_glob_ptr ()) + abort (); + if (!predec_arg_ptr (ptr)) + abort (); + if (!predec_glob_ptr ()) + abort (); + if (!postdec_arg_ptr (ptr)) + abort (); + if (!postdec_glob_ptr ()) + abort (); + if (!preinc_arg_idx (ptr, 3)) + abort (); + if (!preinc_glob_idx ()) + abort (); + if (!postinc_arg_idx (ptr, 3)) + abort (); + if (!postinc_glob_idx ()) + abort (); + if (!predec_arg_idx (ptr, 3)) + abort (); + if (!predec_glob_idx ()) + abort (); + if (!postdec_arg_idx (ptr, 3)) + abort (); + if (!postdec_glob_idx ()) + abort (); + if (!funccall_arg_ptr (ptr)) + abort (); + if (!funccall_arg_idx (ptr, 3)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-5.c b/gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-5.c new file mode 100644 index 000000000..f42a2c0ca --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-5.c @@ -0,0 +1,60 @@ +/* Test that __builtin_prefetch does no harm. + + Use addresses that are unlikely to be word-aligned. Some targets + have alignment requirements for prefetch addresses, so make sure the + compiler takes care of that. This fails if it aborts, anything else + is OK. */ + +struct S { + short a; + short b; + char c[8]; +} s; + +char arr[100]; +char *ptr = arr; +int idx = 3; + +void +arg_ptr (char *p) +{ + __builtin_prefetch (p, 0, 0); +} + +void +arg_idx (char *p, int i) +{ + __builtin_prefetch (&p[i], 0, 0); +} + +void +glob_ptr (void) +{ + __builtin_prefetch (ptr, 0, 0); +} + +void +glob_idx (void) +{ + __builtin_prefetch (&ptr[idx], 0, 0); +} + +int +main () +{ + __builtin_prefetch (&s.b, 0, 0); + __builtin_prefetch (&s.c[1], 0, 0); + + arg_ptr (&s.c[1]); + arg_ptr (ptr+3); + arg_idx (ptr, 3); + arg_idx (ptr+1, 2); + idx = 3; + glob_ptr (); + glob_idx (); + ptr++; + idx = 2; + glob_ptr (); + glob_idx (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-6.c b/gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-6.c new file mode 100644 index 000000000..f643c5c72 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtin-prefetch-6.c @@ -0,0 +1,46 @@ +/* Test that __builtin_prefetch does no harm. + + Data prefetch should not fault if used with an invalid address. */ + +#include + +#define ARRSIZE 65 +int *bad_addr[ARRSIZE]; +int arr_used; + +/* Fill bad_addr with a range of values in the hopes that on any target + some will be invalid addresses. */ +void +init_addrs (void) +{ + int i; + int bits_per_ptr = sizeof (void *) * 8; + for (i = 0; i < bits_per_ptr; i++) + bad_addr[i] = (void *)(1UL << i); + arr_used = bits_per_ptr + 1; /* The last element used is zero. */ +} + +void +prefetch_for_read (void) +{ + int i; + for (i = 0; i < ARRSIZE; i++) + __builtin_prefetch (bad_addr[i], 0, 0); +} + +void +prefetch_for_write (void) +{ + int i; + for (i = 0; i < ARRSIZE; i++) + __builtin_prefetch (bad_addr[i], 1, 0); +} + +int +main () +{ + init_addrs (); + prefetch_for_read (); + prefetch_for_write (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtin-types-compatible-p.c b/gcc/testsuite/gcc.c-torture/execute/builtin-types-compatible-p.c new file mode 100644 index 000000000..a998ef776 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtin-types-compatible-p.c @@ -0,0 +1,35 @@ +int i; +double d; + +/* Make sure we return a constant. */ +float rootbeer[__builtin_types_compatible_p (int, typeof(i))]; + +typedef enum { hot, dog, poo, bear } dingos; +typedef enum { janette, laura, amanda } cranberry; + +typedef float same1; +typedef float same2; + +int main (void); + +int main (void) +{ + /* Compatible types. */ + if (!(__builtin_types_compatible_p (int, const int) + && __builtin_types_compatible_p (typeof (hot), int) + && __builtin_types_compatible_p (typeof (hot), typeof (laura)) + && __builtin_types_compatible_p (int[5], int[]) + && __builtin_types_compatible_p (same1, same2))) + abort (); + + /* Incompatible types. */ + if (__builtin_types_compatible_p (char *, int) + || __builtin_types_compatible_p (char *, const char *) + || __builtin_types_compatible_p (long double, double) + || __builtin_types_compatible_p (typeof (i), typeof (d)) + || __builtin_types_compatible_p (typeof (dingos), typeof (cranberry)) + || __builtin_types_compatible_p (char, int) + || __builtin_types_compatible_p (char *, char **)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/20010124-1-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/20010124-1-lib.c new file mode 100644 index 000000000..5f6a7487f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/20010124-1-lib.c @@ -0,0 +1,50 @@ +/* Verify that structure return doesn't invoke memcpy on + overlapping objects. */ + +extern void abort (void); +extern int inside_main; +typedef __SIZE_TYPE__ size_t; + +struct S { + char stuff[1024]; +}; + +union U { + struct { + int space; + struct S s; + } a; + struct { + struct S s; + int space; + } b; +}; + +struct S f(struct S *p) +{ + return *p; +} + +void g(union U *p) +{ +} + +void *memcpy(void *a, const void *b, size_t len) +{ + if (inside_main) + { + if (a < b && a+len > b) + abort (); + if (b < a && b+len > a) + abort (); + return a; + } + else + { + char *dst = (char *) a; + const char *src = (const char *) b; + while (len--) + *dst++ = *src++; + return a; + } +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/20010124-1.c b/gcc/testsuite/gcc.c-torture/execute/builtins/20010124-1.c new file mode 100644 index 000000000..816287344 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/20010124-1.c @@ -0,0 +1,30 @@ +/* Verify that structure return doesn't invoke memcpy on + overlapping objects. */ + +extern void abort (void); + +struct S { + char stuff[1024]; +}; + +union U { + struct { + int space; + struct S s; + } a; + struct { + struct S s; + int space; + } b; +}; + +struct S f(struct S *); +void g(union U *); + +void main_test(void) +{ + union U u; + u.b.s = f(&u.a.s); + u.a.s = f(&u.b.s); + g(&u); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/abs-1-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/abs-1-lib.c new file mode 100644 index 000000000..57446b263 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/abs-1-lib.c @@ -0,0 +1,22 @@ +extern void abort (void); +extern int abs_called; +extern int inside_main; + +/* The labs call should have been optimized, but the abs call + shouldn't have been. */ + +int +abs (int x) +{ + if (inside_main) + abs_called = 1; + return (x < 0 ? -x : x); +} + +long +labs (long x) +{ + if (inside_main) + abort (); + return (x < 0 ? -x : x); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/abs-1.c b/gcc/testsuite/gcc.c-torture/execute/builtins/abs-1.c new file mode 100644 index 000000000..6ca246d39 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/abs-1.c @@ -0,0 +1,22 @@ +/* Test for -fno-builtin-FUNCTION. */ +/* Origin: Joseph Myers . */ +/* GCC normally handles abs and labs as built-in functions even without + optimization. So test that with -fno-builtin-abs, labs is so handled + but abs isn't. */ + +int abs_called = 0; + +extern int abs (int); +extern long labs (long); +extern void abort (void); + +void +main_test (void) +{ + if (labs (0) != 0) + abort (); + if (abs (0) != 0) + abort (); + if (!abs_called) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/abs-1.x b/gcc/testsuite/gcc.c-torture/execute/builtins/abs-1.x new file mode 100644 index 000000000..80d76c528 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/abs-1.x @@ -0,0 +1,2 @@ +set additional_flags -fno-builtin-abs +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/abs-2-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/abs-2-lib.c new file mode 100644 index 000000000..494e5390e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/abs-2-lib.c @@ -0,0 +1 @@ +#include "lib/abs.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/abs-2.c b/gcc/testsuite/gcc.c-torture/execute/builtins/abs-2.c new file mode 100644 index 000000000..c13c4556e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/abs-2.c @@ -0,0 +1,106 @@ +/* Test for builtin abs, labs, llabs, imaxabs. */ +/* Origin: Joseph Myers */ + +#include +typedef __INTMAX_TYPE__ intmax_t; +#define INTMAX_MAX __INTMAX_MAX__ + +extern int abs (int); +extern long labs (long); +extern long long llabs (long long); +extern intmax_t imaxabs (intmax_t); +extern void abort (void); +extern void link_error (void); + +void +main_test (void) +{ + /* For each type, test both runtime and compile time (constant folding) + optimization. */ + volatile int i0 = 0, i1 = 1, im1 = -1, imin = -INT_MAX, imax = INT_MAX; + volatile long l0 = 0L, l1 = 1L, lm1 = -1L, lmin = -LONG_MAX, lmax = LONG_MAX; + volatile long long ll0 = 0LL, ll1 = 1LL, llm1 = -1LL; + volatile long long llmin = -__LONG_LONG_MAX__, llmax = __LONG_LONG_MAX__; + volatile intmax_t imax0 = 0, imax1 = 1, imaxm1 = -1; + volatile intmax_t imaxmin = -INTMAX_MAX, imaxmax = INTMAX_MAX; + if (abs (i0) != 0) + abort (); + if (abs (0) != 0) + link_error (); + if (abs (i1) != 1) + abort (); + if (abs (1) != 1) + link_error (); + if (abs (im1) != 1) + abort (); + if (abs (-1) != 1) + link_error (); + if (abs (imin) != INT_MAX) + abort (); + if (abs (-INT_MAX) != INT_MAX) + link_error (); + if (abs (imax) != INT_MAX) + abort (); + if (abs (INT_MAX) != INT_MAX) + link_error (); + if (labs (l0) != 0L) + abort (); + if (labs (0L) != 0L) + link_error (); + if (labs (l1) != 1L) + abort (); + if (labs (1L) != 1L) + link_error (); + if (labs (lm1) != 1L) + abort (); + if (labs (-1L) != 1L) + link_error (); + if (labs (lmin) != LONG_MAX) + abort (); + if (labs (-LONG_MAX) != LONG_MAX) + link_error (); + if (labs (lmax) != LONG_MAX) + abort (); + if (labs (LONG_MAX) != LONG_MAX) + link_error (); + if (llabs (ll0) != 0LL) + abort (); + if (llabs (0LL) != 0LL) + link_error (); + if (llabs (ll1) != 1LL) + abort (); + if (llabs (1LL) != 1LL) + link_error (); + if (llabs (llm1) != 1LL) + abort (); + if (llabs (-1LL) != 1LL) + link_error (); + if (llabs (llmin) != __LONG_LONG_MAX__) + abort (); + if (llabs (-__LONG_LONG_MAX__) != __LONG_LONG_MAX__) + link_error (); + if (llabs (llmax) != __LONG_LONG_MAX__) + abort (); + if (llabs (__LONG_LONG_MAX__) != __LONG_LONG_MAX__) + link_error (); + if (imaxabs (imax0) != 0) + abort (); + if (imaxabs (0) != 0) + link_error (); + if (imaxabs (imax1) != 1) + abort (); + if (imaxabs (1) != 1) + link_error (); + if (imaxabs (imaxm1) != 1) + abort (); + if (imaxabs (-1) != 1) + link_error (); + if (imaxabs (imaxmin) != INTMAX_MAX) + abort (); + if (imaxabs (-INTMAX_MAX) != INTMAX_MAX) + link_error (); + if (imaxabs (imaxmax) != INTMAX_MAX) + abort (); + if (imaxabs (INTMAX_MAX) != INTMAX_MAX) + link_error (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/abs-3-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/abs-3-lib.c new file mode 100644 index 000000000..494e5390e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/abs-3-lib.c @@ -0,0 +1 @@ +#include "lib/abs.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/abs-3.c b/gcc/testsuite/gcc.c-torture/execute/builtins/abs-3.c new file mode 100644 index 000000000..cb0d89eb0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/abs-3.c @@ -0,0 +1,102 @@ +/* Test for builtin abs, labs, llabs, imaxabs. Test for __builtin versions. */ +/* Origin: Joseph Myers */ + +#include +typedef __INTMAX_TYPE__ intmax_t; +#define INTMAX_MAX __INTMAX_MAX__ + +extern void abort (void); +extern void link_error (void); + +void +main_test (void) +{ + /* For each type, test both runtime and compile time (constant folding) + optimization. */ + volatile int i0 = 0, i1 = 1, im1 = -1, imin = -INT_MAX, imax = INT_MAX; + volatile long l0 = 0L, l1 = 1L, lm1 = -1L, lmin = -LONG_MAX, lmax = LONG_MAX; + volatile long long ll0 = 0LL, ll1 = 1LL, llm1 = -1LL; + volatile long long llmin = -__LONG_LONG_MAX__, llmax = __LONG_LONG_MAX__; + volatile intmax_t imax0 = 0, imax1 = 1, imaxm1 = -1; + volatile intmax_t imaxmin = -INTMAX_MAX, imaxmax = INTMAX_MAX; + if (__builtin_abs (i0) != 0) + abort (); + if (__builtin_abs (0) != 0) + link_error (); + if (__builtin_abs (i1) != 1) + abort (); + if (__builtin_abs (1) != 1) + link_error (); + if (__builtin_abs (im1) != 1) + abort (); + if (__builtin_abs (-1) != 1) + link_error (); + if (__builtin_abs (imin) != INT_MAX) + abort (); + if (__builtin_abs (-INT_MAX) != INT_MAX) + link_error (); + if (__builtin_abs (imax) != INT_MAX) + abort (); + if (__builtin_abs (INT_MAX) != INT_MAX) + link_error (); + if (__builtin_labs (l0) != 0L) + abort (); + if (__builtin_labs (0L) != 0L) + link_error (); + if (__builtin_labs (l1) != 1L) + abort (); + if (__builtin_labs (1L) != 1L) + link_error (); + if (__builtin_labs (lm1) != 1L) + abort (); + if (__builtin_labs (-1L) != 1L) + link_error (); + if (__builtin_labs (lmin) != LONG_MAX) + abort (); + if (__builtin_labs (-LONG_MAX) != LONG_MAX) + link_error (); + if (__builtin_labs (lmax) != LONG_MAX) + abort (); + if (__builtin_labs (LONG_MAX) != LONG_MAX) + link_error (); + if (__builtin_llabs (ll0) != 0LL) + abort (); + if (__builtin_llabs (0LL) != 0LL) + link_error (); + if (__builtin_llabs (ll1) != 1LL) + abort (); + if (__builtin_llabs (1LL) != 1LL) + link_error (); + if (__builtin_llabs (llm1) != 1LL) + abort (); + if (__builtin_llabs (-1LL) != 1LL) + link_error (); + if (__builtin_llabs (llmin) != __LONG_LONG_MAX__) + abort (); + if (__builtin_llabs (-__LONG_LONG_MAX__) != __LONG_LONG_MAX__) + link_error (); + if (__builtin_llabs (llmax) != __LONG_LONG_MAX__) + abort (); + if (__builtin_llabs (__LONG_LONG_MAX__) != __LONG_LONG_MAX__) + link_error (); + if (__builtin_imaxabs (imax0) != 0) + abort (); + if (__builtin_imaxabs (0) != 0) + link_error (); + if (__builtin_imaxabs (imax1) != 1) + abort (); + if (__builtin_imaxabs (1) != 1) + link_error (); + if (__builtin_imaxabs (imaxm1) != 1) + abort (); + if (__builtin_imaxabs (-1) != 1) + link_error (); + if (__builtin_imaxabs (imaxmin) != INTMAX_MAX) + abort (); + if (__builtin_imaxabs (-INTMAX_MAX) != INTMAX_MAX) + link_error (); + if (__builtin_imaxabs (imaxmax) != INTMAX_MAX) + abort (); + if (__builtin_imaxabs (INTMAX_MAX) != INTMAX_MAX) + link_error (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp b/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp new file mode 100644 index 000000000..a54f3c1b5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp @@ -0,0 +1,54 @@ +# Copyright (C) 2003, 2008 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# This harness is for testing builtin support. Each test has two files: +# +# - foo.c defines the main testing function, main_test(). +# - foo-lib.c implements the library functions that foo.c is testing. +# +# The functions in foo-lib.c will often want to abort on certain inputs. +# They can use the global variable inside_main to see whether they are +# being called from the test program or part of the common runtime. +# +# In many cases, the library functions will behave as normal at -O0 +# and abort when optimisation is enabled. Such implementations should +# go into the lib/ directory so that they can be included by any test +# that needs them. They shouldn't call any external functions in case +# those functions were overridden too. + +load_lib torture-options.exp +load_lib c-torture.exp + +torture-init +set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS + +set additional_flags "" +if [istarget "powerpc-*-darwin*"] { + lappend additional_flags "-Wl,-multiply_defined,suppress" +} + +foreach src [lsort [find $srcdir/$subdir *.c]] { + if {![string match *-lib.c $src] && [runtest_file_p $runtests $src]} { + c-torture-execute [list $src \ + [file root $src]-lib.c \ + $srcdir/$subdir/lib/main.c] \ + $additional_flags + } +} + +torture-finish diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/chk.h b/gcc/testsuite/gcc.c-torture/execute/builtins/chk.h new file mode 100644 index 000000000..625fdef09 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/chk.h @@ -0,0 +1,89 @@ +#ifndef os +# define os(ptr) __builtin_object_size (ptr, 0) +#endif + +/* This is one of the alternatives for object size checking. + If dst has side-effects, size checking will never be done. */ +#undef memcpy +#define memcpy(dst, src, len) \ + __builtin___memcpy_chk (dst, src, len, os (dst)) +#undef mempcpy +#define mempcpy(dst, src, len) \ + __builtin___mempcpy_chk (dst, src, len, os (dst)) +#undef memmove +#define memmove(dst, src, len) \ + __builtin___memmove_chk (dst, src, len, os (dst)) +#undef memset +#define memset(dst, val, len) \ + __builtin___memset_chk (dst, val, len, os (dst)) +#undef strcpy +#define strcpy(dst, src) \ + __builtin___strcpy_chk (dst, src, os (dst)) +#undef stpcpy +#define stpcpy(dst, src) \ + __builtin___stpcpy_chk (dst, src, os (dst)) +#undef strcat +#define strcat(dst, src) \ + __builtin___strcat_chk (dst, src, os (dst)) +#undef strncpy +#define strncpy(dst, src, len) \ + __builtin___strncpy_chk (dst, src, len, os (dst)) +#undef strncat +#define strncat(dst, src, len) \ + __builtin___strncat_chk (dst, src, len, os (dst)) +#undef sprintf +#define sprintf(dst, ...) \ + __builtin___sprintf_chk (dst, 0, os (dst), __VA_ARGS__) +#undef vsprintf +#define vsprintf(dst, fmt, ap) \ + __builtin___vsprintf_chk (dst, 0, os (dst), fmt, ap) +#undef snprintf +#define snprintf(dst, len, ...) \ + __builtin___snprintf_chk (dst, len, 0, os (dst), __VA_ARGS__) +#undef vsnprintf +#define vsnprintf(dst, len, fmt, ap) \ + __builtin___vsnprintf_chk (dst, len, 0, os (dst), fmt, ap) + +/* Now "redefine" even builtins for the purpose of testing. */ +#undef __builtin_memcpy +#define __builtin_memcpy(dst, src, len) memcpy (dst, src, len) +#undef __builtin_mempcpy +#define __builtin_mempcpy(dst, src, len) mempcpy (dst, src, len) +#undef __builtin_memmove +#define __builtin_memmove(dst, src, len) memmove (dst, src, len) +#undef __builtin_memset +#define __builtin_memset(dst, val, len) memset (dst, val, len) +#undef __builtin_strcpy +#define __builtin_strcpy(dst, src) strcpy (dst, src) +#undef __builtin_stpcpy +#define __builtin_stpcpy(dst, src) stpcpy (dst, src) +#undef __builtin_strcat +#define __builtin_strcat(dst, src) strcat (dst, src) +#undef __builtin_strncpy +#define __builtin_strncpy(dst, src, len) strncpy (dst, src, len) +#undef __builtin_strncat +#define __builtin_strncat(dst, src, len) strncat (dst, src, len) +#undef __builtin_sprintf +#define __builtin_sprintf(dst, ...) sprintf (dst, __VA_ARGS__) +#undef __builtin_vsprintf +#define __builtin_vsprintf(dst, fmt, ap) vsprintf (dst, fmt, ap) +#undef __builtin_snprintf +#define __builtin_snprintf(dst, len, ...) snprintf (dst, len, __VA_ARGS__) +#undef __builtin_vsnprintf +#define __builtin_vsnprintf(dst, len, fmt, ap) vsnprintf (dst, len, fmt, ap) + +extern void *chk_fail_buf[]; +extern volatile int chk_fail_allowed, chk_calls; +extern volatile int memcpy_disallowed, mempcpy_disallowed, memmove_disallowed; +extern volatile int memset_disallowed, strcpy_disallowed, stpcpy_disallowed; +extern volatile int strncpy_disallowed, strcat_disallowed, strncat_disallowed; +extern volatile int sprintf_disallowed, vsprintf_disallowed; +extern volatile int snprintf_disallowed, vsnprintf_disallowed; + +/* A storage class that ensures that declarations bind locally. We want + to test non-static declarations where we know it is safe to do so. */ +#if __PIC__ && !__PIE__ +#define LOCAL static +#else +#define LOCAL +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/complex-1-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/complex-1-lib.c new file mode 100644 index 000000000..22d7db180 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/complex-1-lib.c @@ -0,0 +1,70 @@ +extern int inside_main; +extern void abort (void); +#ifdef __OPTIMIZE__ +#define ABORT_INSIDE_MAIN do { if (inside_main) abort (); } while (0) +#else +#define ABORT_INSIDE_MAIN do { } while (0) +#endif + +static float _Complex +conjf (float _Complex z) +{ + ABORT_INSIDE_MAIN; + return ~z; +} + +static double _Complex +conj (double _Complex z) +{ + ABORT_INSIDE_MAIN; + return ~z; +} + +static long double _Complex +conjl (long double _Complex z) +{ + ABORT_INSIDE_MAIN; + return ~z; +} + +static float +crealf (float _Complex z) +{ + ABORT_INSIDE_MAIN; + return __real__ z; +} + +static double +creal (double _Complex z) +{ + ABORT_INSIDE_MAIN; + return __real__ z; +} + +static long double +creall (long double _Complex z) +{ + ABORT_INSIDE_MAIN; + return __real__ z; +} + +static float +cimagf (float _Complex z) +{ + ABORT_INSIDE_MAIN; + return __imag__ z; +} + +static double +cimag (double _Complex z) +{ + ABORT_INSIDE_MAIN; + return __imag__ z; +} + +static long double +cimagl (long double _Complex z) +{ + ABORT_INSIDE_MAIN; + return __imag__ z; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/complex-1.c b/gcc/testsuite/gcc.c-torture/execute/builtins/complex-1.c new file mode 100644 index 000000000..362a0e41e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/complex-1.c @@ -0,0 +1,102 @@ +/* Test for builtin conj, creal, cimag. */ +/* Origin: Joseph Myers */ + +extern float _Complex conjf (float _Complex); +extern double _Complex conj (double _Complex); +extern long double _Complex conjl (long double _Complex); + +extern float crealf (float _Complex); +extern double creal (double _Complex); +extern long double creall (long double _Complex); + +extern float cimagf (float _Complex); +extern double cimag (double _Complex); +extern long double cimagl (long double _Complex); + +extern void abort (void); +extern void link_error (void); + +void +main_test (void) +{ + /* For each type, test both runtime and compile time (constant folding) + optimization. */ + volatile float _Complex fc = 1.0F + 2.0iF; + volatile double _Complex dc = 1.0 + 2.0i; + volatile long double _Complex ldc = 1.0L + 2.0iL; + /* Test floats. */ + if (conjf (fc) != 1.0F - 2.0iF) + abort (); + if (__builtin_conjf (fc) != 1.0F - 2.0iF) + abort (); + if (conjf (1.0F + 2.0iF) != 1.0F - 2.0iF) + link_error (); + if (__builtin_conjf (1.0F + 2.0iF) != 1.0F - 2.0iF) + link_error (); + if (crealf (fc) != 1.0F) + abort (); + if (__builtin_crealf (fc) != 1.0F) + abort (); + if (crealf (1.0F + 2.0iF) != 1.0F) + link_error (); + if (__builtin_crealf (1.0F + 2.0iF) != 1.0F) + link_error (); + if (cimagf (fc) != 2.0F) + abort (); + if (__builtin_cimagf (fc) != 2.0F) + abort (); + if (cimagf (1.0F + 2.0iF) != 2.0F) + link_error (); + if (__builtin_cimagf (1.0F + 2.0iF) != 2.0F) + link_error (); + /* Test doubles. */ + if (conj (dc) != 1.0 - 2.0i) + abort (); + if (__builtin_conj (dc) != 1.0 - 2.0i) + abort (); + if (conj (1.0 + 2.0i) != 1.0 - 2.0i) + link_error (); + if (__builtin_conj (1.0 + 2.0i) != 1.0 - 2.0i) + link_error (); + if (creal (dc) != 1.0) + abort (); + if (__builtin_creal (dc) != 1.0) + abort (); + if (creal (1.0 + 2.0i) != 1.0) + link_error (); + if (__builtin_creal (1.0 + 2.0i) != 1.0) + link_error (); + if (cimag (dc) != 2.0) + abort (); + if (__builtin_cimag (dc) != 2.0) + abort (); + if (cimag (1.0 + 2.0i) != 2.0) + link_error (); + if (__builtin_cimag (1.0 + 2.0i) != 2.0) + link_error (); + /* Test long doubles. */ + if (conjl (ldc) != 1.0L - 2.0iL) + abort (); + if (__builtin_conjl (ldc) != 1.0L - 2.0iL) + abort (); + if (conjl (1.0L + 2.0iL) != 1.0L - 2.0iL) + link_error (); + if (__builtin_conjl (1.0L + 2.0iL) != 1.0L - 2.0iL) + link_error (); + if (creall (ldc) != 1.0L) + abort (); + if (__builtin_creall (ldc) != 1.0L) + abort (); + if (creall (1.0L + 2.0iL) != 1.0L) + link_error (); + if (__builtin_creall (1.0L + 2.0iL) != 1.0L) + link_error (); + if (cimagl (ldc) != 2.0L) + abort (); + if (__builtin_cimagl (ldc) != 2.0L) + abort (); + if (cimagl (1.0L + 2.0iL) != 2.0L) + link_error (); + if (__builtin_cimagl (1.0L + 2.0iL) != 2.0L) + link_error (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/fprintf-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/fprintf-lib.c new file mode 100644 index 000000000..b6a1e913d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/fprintf-lib.c @@ -0,0 +1 @@ +#include "lib/fprintf.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/fprintf.c b/gcc/testsuite/gcc.c-torture/execute/builtins/fprintf.c new file mode 100644 index 000000000..f7db2e061 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/fprintf.c @@ -0,0 +1,61 @@ +/* Copyright (C) 2001 Free Software Foundation. + + Ensure all expected transformations of builtin fprintf occur and + that we honor side effects in the arguments. + + Written by Kaveh R. Ghazi, 1/7/2001. */ + +#include +extern int fprintf_unlocked (FILE *, const char *, ...); +extern void abort(void); + +void +main_test (void) +{ + FILE *s_array[] = {stdout, NULL}, **s_ptr = s_array; + const char *const s1 = "hello world"; + const char *const s2[] = { s1, 0 }, *const*s3; + + fprintf (*s_ptr, ""); + fprintf (*s_ptr, "%s", ""); + fprintf (*s_ptr, "%s", "hello"); + fprintf (*s_ptr, "%s", "\n"); + fprintf (*s_ptr, "%s", *s2); + s3 = s2; + fprintf (*s_ptr, "%s", *s3++); + if (s3 != s2+1 || *s3 != 0) + abort(); + s3 = s2; + fprintf (*s_ptr++, "%s", *s3++); + if (s3 != s2+1 || *s3 != 0 || s_ptr != s_array+1 || *s_ptr != 0) + abort(); + + s_ptr = s_array; + fprintf (*s_ptr, "%c", '\n'); + fprintf (*s_ptr, "%c", **s2); + s3 = s2; + fprintf (*s_ptr, "%c", **s3++); + if (s3 != s2+1 || *s3 != 0) + abort(); + s3 = s2; + fprintf (*s_ptr++, "%c", **s3++); + if (s3 != s2+1 || *s3 != 0 || s_ptr != s_array+1 || *s_ptr != 0) + abort(); + + s_ptr = s_array; + fprintf (*s_ptr++, "hello world"); + if (s_ptr != s_array+1 || *s_ptr != 0) + abort(); + s_ptr = s_array; + fprintf (*s_ptr, "\n"); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + __builtin_fprintf (*s_ptr, "%s", "hello world\n"); + /* Check the unlocked style, these evaluate to nothing to avoid + problems on systems without the unlocked functions. */ + fprintf_unlocked (*s_ptr, ""); + __builtin_fprintf_unlocked (*s_ptr, ""); + fprintf_unlocked (*s_ptr, "%s", ""); + __builtin_fprintf_unlocked (*s_ptr, "%s", ""); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/fprintf.x b/gcc/testsuite/gcc.c-torture/execute/builtins/fprintf.x new file mode 100644 index 000000000..c8fdaf5b2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/fprintf.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_freestanding] } { + return 1; +} + +return 0; diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/fputs-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/fputs-lib.c new file mode 100644 index 000000000..c2292a781 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/fputs-lib.c @@ -0,0 +1,24 @@ +#include +#include +extern void abort (void); +extern int inside_main; +extern size_t strlen(const char *); +int +fputs(const char *string, FILE *stream) +{ + size_t n = strlen(string); + size_t r; +#if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ + if (inside_main) + abort(); +#endif + r = fwrite (string, 1, n, stream); + return n > r ? EOF : 0; +} + +/* Locking stdio doesn't matter for the purposes of this test. */ +int +fputs_unlocked(const char *string, FILE *stream) +{ + return fputs (string, stream); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/fputs.c b/gcc/testsuite/gcc.c-torture/execute/builtins/fputs.c new file mode 100644 index 000000000..93fa97364 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/fputs.c @@ -0,0 +1,65 @@ +/* Copyright (C) 2000, 2001 Free Software Foundation. + + Ensure all expected transformations of builtin fputs occur and that + we honor side effects in the stream argument. + + Written by Kaveh R. Ghazi, 10/30/2000. */ + +#include +extern void abort(void); + +int i; + +void +main_test(void) +{ + FILE *s_array[] = {stdout, NULL}, **s_ptr = s_array; + const char *const s1 = "hello world"; + + fputs ("", *s_ptr); + fputs ("\n", *s_ptr); + fputs ("bye", *s_ptr); + fputs (s1, *s_ptr); + fputs (s1+5, *s_ptr); + fputs (s1+10, *s_ptr); + fputs (s1+11, *s_ptr); + + /* Check side-effects when transforming fputs -> NOP. */ + fputs ("", *s_ptr++); + if (s_ptr != s_array+1 || *s_ptr != 0) + abort(); + + /* Check side-effects when transforming fputs -> fputc. */ + s_ptr = s_array; + fputs ("\n", *s_ptr++); + if (s_ptr != s_array+1 || *s_ptr != 0) + abort(); + + /* Check side-effects when transforming fputs -> fwrite. */ + s_ptr = s_array; + fputs ("hello\n", *s_ptr++); + if (s_ptr != s_array+1 || *s_ptr != 0) + abort(); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + s_ptr = s_array; + __builtin_fputs ("", *s_ptr); + /* These builtin stubs are called by __builtin_fputs, ensure their + prototypes are set correctly too. */ + __builtin_fputc ('\n', *s_ptr); + __builtin_fwrite ("hello\n", 1, 6, *s_ptr); + /* Check the unlocked style, these evaluate to nothing to avoid + problems on systems without the unlocked functions. */ + fputs_unlocked ("", *s_ptr); + __builtin_fputs_unlocked ("", *s_ptr); + + /* Check side-effects in conditional expression. */ + s_ptr = s_array; + fputs (i++ ? "f" : "x", *s_ptr++); + if (s_ptr != s_array+1 || *s_ptr != 0 || i != 1) + abort(); + fputs (--i ? "\n" : "\n", *--s_ptr); + if (s_ptr != s_array || i != 0) + abort(); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/abs.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/abs.c new file mode 100644 index 000000000..1e0857f73 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/abs.c @@ -0,0 +1,41 @@ +extern int inside_main; +extern void abort (void); +#ifdef __OPTIMIZE__ +#define ABORT_INSIDE_MAIN do { if (inside_main) abort (); } while (0) +#else +#define ABORT_INSIDE_MAIN do { } while (0) +#endif + +typedef __INTMAX_TYPE__ intmax_t; + +__attribute__ ((__noinline__)) +int +abs (int x) +{ + ABORT_INSIDE_MAIN; + return x < 0 ? -x : x; +} + +__attribute__ ((__noinline__)) +long +labs (long x) +{ + ABORT_INSIDE_MAIN; + return x < 0 ? -x : x; +} + +__attribute__ ((__noinline__)) +long long +llabs (long long x) +{ + ABORT_INSIDE_MAIN; + return x < 0 ? -x : x; +} + +__attribute__ ((__noinline__)) +intmax_t +imaxabs (intmax_t x) +{ + ABORT_INSIDE_MAIN; + return x < 0 ? -x : x; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/bfill.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/bfill.c new file mode 100644 index 000000000..deb6cf522 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/bfill.c @@ -0,0 +1,16 @@ +extern int inside_main; + +__attribute__ ((__noinline__)) +void +bfill (void *s, __SIZE_TYPE__ n, int ch) +{ + char *p; + + for (p = s; n-- > 0; p++) + *p = ch; + +#ifdef __OPTIMIZE__ + if (inside_main) + abort (); +#endif +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/bzero.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/bzero.c new file mode 100644 index 000000000..a02b5358b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/bzero.c @@ -0,0 +1,16 @@ +extern int inside_main; + +__attribute__ ((__noinline__)) +void +bzero (void *s, __SIZE_TYPE__ n) +{ + char *p; + + for (p = s; n-- > 0; p++) + *p = 0; + +#ifdef __OPTIMIZE__ + if (inside_main) + abort (); +#endif +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/chk.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/chk.c new file mode 100644 index 000000000..e5197902b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/chk.c @@ -0,0 +1,478 @@ +#include +#ifdef __unix__ +#include +#endif + +extern void abort (void); + +extern int inside_main; +void *chk_fail_buf[256] __attribute__((aligned (16))); +volatile int chk_fail_allowed, chk_calls; +volatile int memcpy_disallowed, mempcpy_disallowed, memmove_disallowed; +volatile int memset_disallowed, strcpy_disallowed, stpcpy_disallowed; +volatile int strncpy_disallowed, strcat_disallowed, strncat_disallowed; +volatile int sprintf_disallowed, vsprintf_disallowed; +volatile int snprintf_disallowed, vsnprintf_disallowed; +extern __SIZE_TYPE__ strlen (const char *); +extern int vsprintf (char *, const char *, va_list); + +void __attribute__((noreturn)) +__chk_fail (void) +{ + if (chk_fail_allowed) + __builtin_longjmp (chk_fail_buf, 1); + abort (); +} + +void * +memcpy (void *dst, const void *src, __SIZE_TYPE__ n) +{ + const char *srcp; + char *dstp; + +#ifdef __OPTIMIZE__ + if (memcpy_disallowed && inside_main) + abort (); +#endif + + srcp = src; + dstp = dst; + while (n-- != 0) + *dstp++ = *srcp++; + + return dst; +} + +void * +__memcpy_chk (void *dst, const void *src, __SIZE_TYPE__ n, __SIZE_TYPE__ size) +{ + /* If size is -1, GCC should always optimize the call into memcpy. */ + if (size == (__SIZE_TYPE__) -1) + abort (); + ++chk_calls; + if (n > size) + __chk_fail (); + return memcpy (dst, src, n); +} + +void * +mempcpy (void *dst, const void *src, __SIZE_TYPE__ n) +{ + const char *srcp; + char *dstp; + +#ifdef __OPTIMIZE__ + if (mempcpy_disallowed && inside_main) + abort (); +#endif + + srcp = src; + dstp = dst; + while (n-- != 0) + *dstp++ = *srcp++; + + return dstp; +} + +void * +__mempcpy_chk (void *dst, const void *src, __SIZE_TYPE__ n, __SIZE_TYPE__ size) +{ + /* If size is -1, GCC should always optimize the call into mempcpy. */ + if (size == (__SIZE_TYPE__) -1) + abort (); + ++chk_calls; + if (n > size) + __chk_fail (); + return mempcpy (dst, src, n); +} + +void * +memmove (void *dst, const void *src, __SIZE_TYPE__ n) +{ + const char *srcp; + char *dstp; + +#ifdef __OPTIMIZE__ + if (memmove_disallowed && inside_main) + abort (); +#endif + + srcp = src; + dstp = dst; + if (srcp < dstp) + while (n-- != 0) + dstp[n] = srcp[n]; + else + while (n-- != 0) + *dstp++ = *srcp++; + + return dst; +} + +void * +__memmove_chk (void *dst, const void *src, __SIZE_TYPE__ n, __SIZE_TYPE__ size) +{ + /* If size is -1, GCC should always optimize the call into memmove. */ + if (size == (__SIZE_TYPE__) -1) + abort (); + ++chk_calls; + if (n > size) + __chk_fail (); + return memmove (dst, src, n); +} + +void * +memset (void *dst, int c, __SIZE_TYPE__ n) +{ + /* Single-byte memsets should be done inline when optimisation + is enabled. */ +#ifdef __OPTIMIZE__ + if (memset_disallowed && inside_main && n < 2) + abort (); +#endif + + while (n-- != 0) + n[(char *) dst] = c; + + return dst; +} + +void * +__memset_chk (void *dst, int c, __SIZE_TYPE__ n, __SIZE_TYPE__ size) +{ + /* If size is -1, GCC should always optimize the call into memset. */ + if (size == (__SIZE_TYPE__) -1) + abort (); + ++chk_calls; + if (n > size) + __chk_fail (); + return memset (dst, c, n); +} + +char * +strcpy (char *d, const char *s) +{ + char *r = d; +#ifdef __OPTIMIZE__ + if (strcpy_disallowed && inside_main) + abort (); +#endif + while ((*d++ = *s++)); + return r; +} + +char * +__strcpy_chk (char *d, const char *s, __SIZE_TYPE__ size) +{ + /* If size is -1, GCC should always optimize the call into strcpy. */ + if (size == (__SIZE_TYPE__) -1) + abort (); + ++chk_calls; + if (strlen (s) >= size) + __chk_fail (); + return strcpy (d, s); +} + +char * +stpcpy (char *dst, const char *src) +{ +#ifdef __OPTIMIZE__ + if (stpcpy_disallowed && inside_main) + abort (); +#endif + + while (*src != 0) + *dst++ = *src++; + + *dst = 0; + return dst; +} + +char * +__stpcpy_chk (char *d, const char *s, __SIZE_TYPE__ size) +{ + /* If size is -1, GCC should always optimize the call into stpcpy. */ + if (size == (__SIZE_TYPE__) -1) + abort (); + ++chk_calls; + if (strlen (s) >= size) + __chk_fail (); + return stpcpy (d, s); +} + +char * +strncpy (char *s1, const char *s2, __SIZE_TYPE__ n) +{ + char *dest = s1; +#ifdef __OPTIMIZE__ + if (strncpy_disallowed && inside_main) + abort(); +#endif + for (; *s2 && n; n--) + *s1++ = *s2++; + while (n--) + *s1++ = 0; + return dest; +} + +char * +__strncpy_chk (char *s1, const char *s2, __SIZE_TYPE__ n, __SIZE_TYPE__ size) +{ + /* If size is -1, GCC should always optimize the call into strncpy. */ + if (size == (__SIZE_TYPE__) -1) + abort (); + ++chk_calls; + if (n > size) + __chk_fail (); + return strncpy (s1, s2, n); +} + +char * +strcat (char *dst, const char *src) +{ + char *p = dst; + +#ifdef __OPTIMIZE__ + if (strcat_disallowed && inside_main) + abort (); +#endif + + while (*p) + p++; + while ((*p++ = *src++)) + ; + return dst; +} + +char * +__strcat_chk (char *d, const char *s, __SIZE_TYPE__ size) +{ + /* If size is -1, GCC should always optimize the call into strcat. */ + if (size == (__SIZE_TYPE__) -1) + abort (); + ++chk_calls; + if (strlen (d) + strlen (s) >= size) + __chk_fail (); + return strcat (d, s); +} + +char * +strncat (char *s1, const char *s2, __SIZE_TYPE__ n) +{ + char *dest = s1; + char c; +#ifdef __OPTIMIZE__ + if (strncat_disallowed && inside_main) + abort(); +#endif + while (*s1) s1++; + c = '\0'; + while (n > 0) + { + c = *s2++; + *s1++ = c; + if (c == '\0') + return dest; + n--; + } + if (c != '\0') + *s1 = '\0'; + return dest; +} + +char * +__strncat_chk (char *d, const char *s, __SIZE_TYPE__ n, __SIZE_TYPE__ size) +{ + __SIZE_TYPE__ len = strlen (d), n1 = n; + const char *s1 = s; + + /* If size is -1, GCC should always optimize the call into strncat. */ + if (size == (__SIZE_TYPE__) -1) + abort (); + ++chk_calls; + while (len < size && n1 > 0) + { + if (*s1++ == '\0') + break; + ++len; + --n1; + } + + if (len >= size) + __chk_fail (); + return strncat (d, s, n); +} + +/* No chk test in GCC testsuite needs more bytes than this. + As we can't expect vsnprintf to be available on the target, + assume 4096 bytes is enough. */ +static char chk_sprintf_buf[4096]; + +int +__sprintf_chk (char *str, int flag, __SIZE_TYPE__ size, const char *fmt, ...) +{ + int ret; + va_list ap; + + /* If size is -1 and flag 0, GCC should always optimize the call into + sprintf. */ + if (size == (__SIZE_TYPE__) -1 && flag == 0) + abort (); + ++chk_calls; +#ifdef __OPTIMIZE__ + if (sprintf_disallowed && inside_main) + abort(); +#endif + va_start (ap, fmt); + ret = vsprintf (chk_sprintf_buf, fmt, ap); + va_end (ap); + if (ret >= 0) + { + if (ret >= size) + __chk_fail (); + memcpy (str, chk_sprintf_buf, ret + 1); + } + return ret; +} + +int +__vsprintf_chk (char *str, int flag, __SIZE_TYPE__ size, const char *fmt, + va_list ap) +{ + int ret; + + /* If size is -1 and flag 0, GCC should always optimize the call into + vsprintf. */ + if (size == (__SIZE_TYPE__) -1 && flag == 0) + abort (); + ++chk_calls; +#ifdef __OPTIMIZE__ + if (vsprintf_disallowed && inside_main) + abort(); +#endif + ret = vsprintf (chk_sprintf_buf, fmt, ap); + if (ret >= 0) + { + if (ret >= size) + __chk_fail (); + memcpy (str, chk_sprintf_buf, ret + 1); + } + return ret; +} + +int +__snprintf_chk (char *str, __SIZE_TYPE__ len, int flag, __SIZE_TYPE__ size, + const char *fmt, ...) +{ + int ret; + va_list ap; + + /* If size is -1 and flag 0, GCC should always optimize the call into + snprintf. */ + if (size == (__SIZE_TYPE__) -1 && flag == 0) + abort (); + ++chk_calls; + if (size < len) + __chk_fail (); +#ifdef __OPTIMIZE__ + if (snprintf_disallowed && inside_main) + abort(); +#endif + va_start (ap, fmt); + ret = vsprintf (chk_sprintf_buf, fmt, ap); + va_end (ap); + if (ret >= 0) + { + if (ret < len) + memcpy (str, chk_sprintf_buf, ret + 1); + else + { + memcpy (str, chk_sprintf_buf, len - 1); + str[len - 1] = '\0'; + } + } + return ret; +} + +int +__vsnprintf_chk (char *str, __SIZE_TYPE__ len, int flag, __SIZE_TYPE__ size, + const char *fmt, va_list ap) +{ + int ret; + + /* If size is -1 and flag 0, GCC should always optimize the call into + vsnprintf. */ + if (size == (__SIZE_TYPE__) -1 && flag == 0) + abort (); + ++chk_calls; + if (size < len) + __chk_fail (); +#ifdef __OPTIMIZE__ + if (vsnprintf_disallowed && inside_main) + abort(); +#endif + ret = vsprintf (chk_sprintf_buf, fmt, ap); + if (ret >= 0) + { + if (ret < len) + memcpy (str, chk_sprintf_buf, ret + 1); + else + { + memcpy (str, chk_sprintf_buf, len - 1); + str[len - 1] = '\0'; + } + } + return ret; +} + +int +snprintf (char *str, __SIZE_TYPE__ len, const char *fmt, ...) +{ + int ret; + va_list ap; + +#ifdef __OPTIMIZE__ + if (snprintf_disallowed && inside_main) + abort(); +#endif + va_start (ap, fmt); + ret = vsprintf (chk_sprintf_buf, fmt, ap); + va_end (ap); + if (ret >= 0) + { + if (ret < len) + memcpy (str, chk_sprintf_buf, ret + 1); + else if (len) + { + memcpy (str, chk_sprintf_buf, len - 1); + str[len - 1] = '\0'; + } + } + return ret; +} + +/* uClibc's vsprintf calls vsnprintf. */ +#ifndef __UCLIBC__ +int +vsnprintf (char *str, __SIZE_TYPE__ len, const char *fmt, va_list ap) +{ + int ret; + +#ifdef __OPTIMIZE__ + if (vsnprintf_disallowed && inside_main) + abort(); +#endif + ret = vsprintf (chk_sprintf_buf, fmt, ap); + if (ret >= 0) + { + if (ret < len) + memcpy (str, chk_sprintf_buf, ret + 1); + else if (len) + { + memcpy (str, chk_sprintf_buf, len - 1); + str[len - 1] = '\0'; + } + } + return ret; +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/fprintf.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/fprintf.c new file mode 100644 index 000000000..853a705e8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/fprintf.c @@ -0,0 +1,37 @@ +#include +#include +extern void abort (void); +extern int inside_main; + +__attribute__ ((__noinline__)) +int +fprintf (FILE *fp, const char *string, ...) +{ + va_list ap; + int r; +#ifdef __OPTIMIZE__ + if (inside_main) + abort(); +#endif + va_start (ap, string); + r = vfprintf (fp, string, ap); + va_end (ap); + return r; +} + +/* Locking stdio doesn't matter for the purposes of this test. */ +__attribute__ ((__noinline__)) +int +fprintf_unlocked (FILE *fp, const char *string, ...) +{ + va_list ap; + int r; +#ifdef __OPTIMIZE__ + if (inside_main) + abort(); +#endif + va_start (ap, string); + r = vfprintf (fp, string, ap); + va_end (ap); + return r; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c new file mode 100644 index 000000000..a9bb6c6b8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c @@ -0,0 +1,25 @@ +extern void abort(void); +extern void main_test (void); +extern void abort (void); +int inside_main; + +int +main () +{ + inside_main = 1; + main_test (); + inside_main = 0; + return 0; +} + +/* When optimizing, all the constant cases should have been + constant folded, so no calls to link_error should remain. + In any case, link_error should not be called. */ + +#ifndef __OPTIMIZE__ +void +link_error (void) +{ + abort (); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memchr.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memchr.c new file mode 100644 index 000000000..2f15c57a7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memchr.c @@ -0,0 +1,22 @@ +extern void abort(void); +extern int inside_main; + +__attribute__ ((__noinline__)) +void * +memchr (const void *s, int c, __SIZE_TYPE__ n) +{ + const unsigned char uc = c; + const unsigned char *sp; + +#ifdef __OPTIMIZE__ + if (inside_main) + abort (); +#endif + + sp = s; + for (; n != 0; ++sp, --n) + if (*sp == uc) + return (void *) sp; + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memcmp.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memcmp.c new file mode 100644 index 000000000..fd6556d22 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memcmp.c @@ -0,0 +1,23 @@ +extern void abort(void); +extern int inside_main; + +__attribute__ ((__noinline__)) +int +memcmp (const void *s1, const void *s2, __SIZE_TYPE__ len) +{ + const unsigned char *sp1, *sp2; + +#ifdef __OPTIMIZE__ + if (inside_main) + abort (); +#endif + + sp1 = s1; + sp2 = s2; + while (len != 0 && *sp1 == *sp2) + sp1++, sp2++, len--; + + if (len == 0) + return 0; + return *sp1 - *sp2; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memmove.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memmove.c new file mode 100644 index 000000000..08fcd0801 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memmove.c @@ -0,0 +1,32 @@ +extern void abort (void); +extern int inside_main; + +__attribute__ ((__noinline__)) +void * +memmove (void *dst, const void *src, __SIZE_TYPE__ n) +{ + char *dstp; + const char *srcp; + +#ifdef __OPTIMIZE__ + if (inside_main) + abort (); +#endif + + srcp = src; + dstp = dst; + if (srcp < dstp) + while (n-- != 0) + dstp[n] = srcp[n]; + else + while (n-- != 0) + *dstp++ = *srcp++; + + return dst; +} + +void +bcopy (const void *src, void *dst, __SIZE_TYPE__ n) +{ + memmove (dst, src, n); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/mempcpy.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/mempcpy.c new file mode 100644 index 000000000..bc16da536 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/mempcpy.c @@ -0,0 +1,22 @@ +extern void abort (void); +extern int inside_main; + +__attribute__ ((__noinline__)) +void * +mempcpy (void *dst, const void *src, __SIZE_TYPE__ n) +{ + const char *srcp; + char *dstp; + +#ifdef __OPTIMIZE__ + if (inside_main) + abort (); +#endif + + srcp = src; + dstp = dst; + while (n-- != 0) + *dstp++ = *srcp++; + + return dstp; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memset.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memset.c new file mode 100644 index 000000000..90545abbf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memset.c @@ -0,0 +1,20 @@ +extern void abort (void); +extern int inside_main; + +__attribute__ ((__noinline__)) +void * +memset (void *dst, int c, __SIZE_TYPE__ n) +{ + while (n-- != 0) + n[(char *) dst] = c; + + /* Single-byte memsets should be done inline when optimisation + is enabled. Do this after the copy in case we're being called to + initialize bss. */ +#ifdef __OPTIMIZE__ + if (inside_main && n < 2) + abort (); +#endif + + return dst; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/printf.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/printf.c new file mode 100644 index 000000000..4be7578d1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/printf.c @@ -0,0 +1,38 @@ +#include +#include +extern void abort (void); +extern int inside_main; + +__attribute__ ((__noinline__)) +int +printf (const char *string, ...) +{ + va_list ap; + int r; +#ifdef __OPTIMIZE__ + if (inside_main) + abort(); +#endif + va_start (ap, string); + r = vprintf (string, ap); + va_end (ap); + return r; +} + + +/* Locking stdio doesn't matter for the purposes of this test. */ +__attribute__ ((__noinline__)) +int +printf_unlocked (const char *string, ...) +{ + va_list ap; + int r; +#ifdef __OPTIMIZE__ + if (inside_main) + abort(); +#endif + va_start (ap, string); + r = vprintf (string, ap); + va_end (ap); + return r; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/sprintf.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/sprintf.c new file mode 100644 index 000000000..3ac447b11 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/sprintf.c @@ -0,0 +1,22 @@ +#include +#include +extern void abort (void); +extern int inside_main; + +__attribute__ ((__noinline__)) +int +(sprintf) (char *buf, const char *fmt, ...) +{ + va_list ap; + int r; +#ifdef __OPTIMIZE__ + if (inside_main) + abort (); +#endif + va_start (ap, fmt); + r = vsprintf (buf, fmt, ap); + va_end (ap); + return r; +} + + diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/stpcpy.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/stpcpy.c new file mode 100644 index 000000000..2c7c8178b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/stpcpy.c @@ -0,0 +1,18 @@ +extern void abort (void); +extern int inside_main; + +__attribute__ ((__noinline__)) +char * +stpcpy (char *dst, const char *src) +{ +#ifdef __OPTIMIZE__ + if (inside_main) + abort (); +#endif + + while (*src != 0) + *dst++ = *src++; + + *dst = 0; + return dst; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcat.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcat.c new file mode 100644 index 000000000..d592087a9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcat.c @@ -0,0 +1,20 @@ +extern int inside_main; +extern void abort(void); + +__attribute__ ((__noinline__)) +char * +strcat (char *dst, const char *src) +{ + char *p = dst; + +#ifdef __OPTIMIZE__ + if (inside_main) + abort (); +#endif + + while (*p) + p++; + while ((*p++ = *src++)) + ; + return dst; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strchr.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strchr.c new file mode 100644 index 000000000..bee3d3203 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strchr.c @@ -0,0 +1,28 @@ +extern void abort (void); +extern int inside_main; + +__attribute__ ((__noinline__)) +char * +strchr (const char *s, int c) +{ +#ifdef __OPTIMIZE__ + if (inside_main) + abort (); +#endif + + for (;;) + { + if (*s == c) + return (char *) s; + if (*s == 0) + return 0; + s++; + } +} + +__attribute__ ((__noinline__)) +char * +index (const char *s, int c) +{ + return strchr (s, c); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcmp.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcmp.c new file mode 100644 index 000000000..82284546f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcmp.c @@ -0,0 +1,19 @@ +extern void abort (void); +extern int inside_main; + +__attribute__ ((__noinline__)) +int +strcmp (const char *s1, const char *s2) +{ +#ifdef __OPTIMIZE__ + if (inside_main) + abort (); +#endif + + while (*s1 != 0 && *s1 == *s2) + s1++, s2++; + + if (*s1 == 0 || *s2 == 0) + return (unsigned char) *s1 - (unsigned char) *s2; + return *s1 - *s2; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcpy.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcpy.c new file mode 100644 index 000000000..916446623 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcpy.c @@ -0,0 +1,15 @@ +extern void abort (void); +extern int inside_main; + +__attribute__ ((__noinline__)) +char * +strcpy (char *d, const char *s) +{ + char *r = d; +#if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ + if (inside_main) + abort (); +#endif + while ((*d++ = *s++)); + return r; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcspn.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcspn.c new file mode 100644 index 000000000..827099637 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcspn.c @@ -0,0 +1,22 @@ +extern void abort (void); +extern int inside_main; + +__attribute__ ((__noinline__)) +__SIZE_TYPE__ +strcspn (const char *s1, const char *s2) +{ + const char *p, *q; + +#ifdef __OPTIMIZE__ + if (inside_main) + abort(); +#endif + + for (p = s1; *p; p++) + for (q = s2; *q; q++) + if (*p == *q) + goto found; + + found: + return p - s1; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strlen.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strlen.c new file mode 100644 index 000000000..7f81c115b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strlen.c @@ -0,0 +1,20 @@ +extern void abort (void); +extern int inside_main; + +__attribute__ ((__noinline__)) +__SIZE_TYPE__ +strlen (const char *s) +{ + __SIZE_TYPE__ i; + +#ifdef __OPTIMIZE__ + if (inside_main) + abort (); +#endif + + i = 0; + while (s[i] != 0) + i++; + + return i; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncat.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncat.c new file mode 100644 index 000000000..7fd334cb4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncat.c @@ -0,0 +1,29 @@ +extern void abort(void); +extern int inside_main; + +typedef __SIZE_TYPE__ size_t; + +__attribute__ ((__noinline__)) +char * +strncat (char *s1, const char *s2, size_t n) +{ + char *dest = s1; + char c = '\0'; +#ifdef __OPTIMIZE__ + if (inside_main) + abort(); +#endif + while (*s1) s1++; + c = '\0'; + while (n > 0) + { + c = *s2++; + *s1++ = c; + if (c == '\0') + return dest; + n--; + } + if (c != '\0') + *s1 = '\0'; + return dest; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncmp.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncmp.c new file mode 100644 index 000000000..7a8eb6fd2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncmp.c @@ -0,0 +1,27 @@ +extern void abort (void); +extern int inside_main; + +typedef __SIZE_TYPE__ size_t; + +__attribute__ ((__noinline__)) +int +strncmp(const char *s1, const char *s2, size_t n) +{ + const unsigned char *u1 = (const unsigned char *)s1; + const unsigned char *u2 = (const unsigned char *)s2; + unsigned char c1, c2; + +#ifdef __OPTIMIZE__ + if (inside_main) + abort(); +#endif + + while (n > 0) + { + c1 = *u1++, c2 = *u2++; + if (c1 == '\0' || c1 != c2) + return c1 - c2; + n--; + } + return c1 - c2; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncpy.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncpy.c new file mode 100644 index 000000000..a6ec98b05 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncpy.c @@ -0,0 +1,21 @@ +extern void abort(void); +extern int inside_main; + +typedef __SIZE_TYPE__ size_t; + +__attribute__ ((__noinline__)) +char * +strncpy(char *s1, const char *s2, size_t n) +{ + char *dest = s1; +#ifdef __OPTIMIZE__ + if (inside_main) + abort(); +#endif + for (; *s2 && n; n--) + *s1++ = *s2++; + while (n--) + *s1++ = 0; + return dest; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strpbrk.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strpbrk.c new file mode 100644 index 000000000..0c049272c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strpbrk.c @@ -0,0 +1,21 @@ +extern void abort (void); +extern int inside_main; + +__attribute__ ((__noinline__)) +char * +strpbrk(const char *s1, const char *s2) +{ + const char *p; +#ifdef __OPTIMIZE__ + if (inside_main) + abort (); +#endif + while (*s1) + { + for (p = s2; *p; p++) + if (*s1 == *p) + return (char *)s1; + s1++; + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strrchr.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strrchr.c new file mode 100644 index 000000000..9a45af3c8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strrchr.c @@ -0,0 +1,32 @@ +extern void abort (void); +extern int inside_main; + +__attribute__ ((__noinline__)) +char * +strrchr (const char *s, int c) +{ + __SIZE_TYPE__ i; + +#ifdef __OPTIMIZE__ + if (inside_main) + abort (); +#endif + + i = 0; + while (s[i] != 0) + i++; + + do + if (s[i] == c) + return (char *) s + i; + while (i-- != 0); + + return 0; +} + +__attribute__ ((__noinline__)) +char * +rindex (const char *s, int c) +{ + return strrchr (s, c); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strspn.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strspn.c new file mode 100644 index 000000000..622aac6ab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strspn.c @@ -0,0 +1,25 @@ +extern void abort (void); +extern int inside_main; + +__attribute__ ((__noinline__)) +__SIZE_TYPE__ +strcspn (const char *s1, const char *s2) +{ + const char *p, *q; + +#ifdef __OPTIMIZE__ + if (inside_main) + abort(); +#endif + + for (p = s1; *p; p++) + { + for (q = s2; *q; q++) + if (*p == *q) + goto proceed; + break; + + proceed:; + } + return p - s1; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strstr.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strstr.c new file mode 100644 index 000000000..7d3544506 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strstr.c @@ -0,0 +1,29 @@ +extern void abort (void); +extern int inside_main; + +__attribute__ ((__noinline__)) +char * +strstr(const char *s1, const char *s2) +{ + const char *p, *q; + +#ifdef __OPTIMIZE__ + if (inside_main) + abort (); +#endif + + /* deliberately dumb algorithm */ + for (; *s1; s1++) + { + p = s1, q = s2; + while (*q && *p) + { + if (*q != *p) + break; + p++, q++; + } + if (*q == 0) + return (char *)s1; + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memchr-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memchr-lib.c new file mode 100644 index 000000000..ccea6ba7d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memchr-lib.c @@ -0,0 +1 @@ +#include "lib/memchr.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memchr.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memchr.c new file mode 100644 index 000000000..88e731128 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memchr.c @@ -0,0 +1,38 @@ +/* Copyright (C) 2007 Free Software Foundation. + + Ensure all expected transformations of builtin memchr occur + and perform correctly. + + Written by Paolo Carlini, 10/5/2007. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern void *memchr (const void *, int, size_t); + +void +main_test (void) +{ + const char* const foo1 = "hello world"; + + if (memchr (foo1, 'x', 11)) + abort (); + if (memchr (foo1, 'o', 11) != foo1 + 4) + abort (); + if (memchr (foo1, 'w', 2)) + abort (); + if (memchr (foo1 + 5, 'o', 6) != foo1 + 7) + abort (); + if (memchr (foo1, 'd', 11) != foo1 + 10) + abort (); + if (memchr (foo1, 'd', 10)) + abort (); + if (memchr (foo1, '\0', 11)) + abort (); + if (memchr (foo1, '\0', 12) != foo1 + 11) + abort (); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + if (__builtin_memchr (foo1, 'r', 11) != foo1 + 8) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memcmp-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memcmp-lib.c new file mode 100644 index 000000000..029a92e77 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memcmp-lib.c @@ -0,0 +1 @@ +#include "lib/memcmp.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memcmp.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memcmp.c new file mode 100644 index 000000000..5489048f5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memcmp.c @@ -0,0 +1,41 @@ +/* Copyright (C) 2001 Free Software Foundation. + + Ensure that short builtin memcmp are optimized and perform correctly. + On architectures with a cmpstrsi instruction, this test doesn't determine + which optimization is being performed, but it does check for correctness. + + Written by Roger Sayle, 12/02/2001. + Additional tests by Roger Sayle after PR 3508, 12/26/2001. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern int memcmp (const void *, const void *, size_t); +extern char *strcpy (char *, const char *); +extern void link_error (void); + +void +main_test (void) +{ + char str[8]; + + strcpy (str, "3141"); + + if ( memcmp (str, str+2, 0) != 0 ) + abort (); + if ( memcmp (str+1, str+3, 0) != 0 ) + abort (); + + if ( memcmp (str+1, str+3, 1) != 0 ) + abort (); + if ( memcmp (str, str+2, 1) >= 0 ) + abort (); + if ( memcmp (str+2, str, 1) <= 0 ) + abort (); + + if (memcmp ("abcd", "efgh", 4) >= 0) + link_error (); + if (memcmp ("abcd", "abcd", 4) != 0) + link_error (); + if (memcmp ("efgh", "abcd", 4) <= 0) + link_error (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memcpy-chk-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memcpy-chk-lib.c new file mode 100644 index 000000000..9daf13e82 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memcpy-chk-lib.c @@ -0,0 +1 @@ +#include "lib/chk.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memcpy-chk.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memcpy-chk.c new file mode 100644 index 000000000..5b245e58e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memcpy-chk.c @@ -0,0 +1,479 @@ +/* Copyright (C) 2004, 2005 Free Software Foundation. + + Ensure builtin __memcpy_chk performs correctly. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern size_t strlen(const char *); +extern void *memcpy (void *, const void *, size_t); +extern int memcmp (const void *, const void *, size_t); + +#include "chk.h" + +const char s1[] = "123"; +char p[32] = ""; +volatile char *s2 = "defg"; /* prevent constant propagation to happen when whole program assumptions are made. */ +volatile char *s3 = "FGH"; /* prevent constant propagation to happen when whole program assumptions are made. */ +volatile size_t l1 = 1; /* prevent constant propagation to happen when whole program assumptions are made. */ + +void +__attribute__((noinline)) +test1 (void) +{ + int i; + +#if defined __i386__ || defined __x86_64__ + /* The functions below might not be optimized into direct stores on all + arches. It depends on how many instructions would be generated and + what limits the architecture chooses in STORE_BY_PIECES_P. */ + memcpy_disallowed = 1; +#endif + + /* All the memcpy calls in this routine except last have fixed length, so + object size checking should be done at compile time if optimizing. */ + chk_calls = 0; + + if (memcpy (p, "ABCDE", 6) != p || memcmp (p, "ABCDE", 6)) + abort (); + if (memcpy (p + 16, "VWX" + 1, 2) != p + 16 + || memcmp (p + 16, "WX\0\0", 5)) + abort (); + if (memcpy (p + 1, "", 1) != p + 1 || memcmp (p, "A\0CDE", 6)) + abort (); + if (memcpy (p + 3, "FGHI", 4) != p + 3 || memcmp (p, "A\0CFGHI", 8)) + abort (); + + i = 8; + memcpy (p + 20, "qrstu", 6); + memcpy (p + 25, "QRSTU", 6); + if (memcpy (p + 25 + 1, s1, 3) != p + 25 + 1 + || memcmp (p + 25, "Q123U", 6)) + abort (); + + if (memcpy (memcpy (p, "abcdEFG", 4) + 4, "efg", 4) != p + 4 + || memcmp (p, "abcdefg", 8)) + abort(); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + if (__builtin_memcpy (p, "ABCDE", 6) != p || memcmp (p, "ABCDE", 6)) + abort (); + + memcpy (p + 5, s3, 1); + if (memcmp (p, "ABCDEFg", 8)) + abort (); + + memcpy_disallowed = 0; + if (chk_calls) + abort (); + chk_calls = 0; + + memcpy (p + 6, s1 + 1, l1); + if (memcmp (p, "ABCDEF2", 8)) + abort (); + + /* The above memcpy copies into an object with known size, but + unknown length, so it should be a __memcpy_chk call. */ + if (chk_calls != 1) + abort (); +} + +long buf1[64]; +char *buf2 = (char *) (buf1 + 32); +long buf5[20]; +char buf7[20]; + +void +__attribute__((noinline)) +test2_sub (long *buf3, char *buf4, char *buf6, int n) +{ + int i = 0; + + /* All the memcpy/__builtin_memcpy/__builtin___memcpy_chk + calls in this routine are either fixed length, or have + side-effects in __builtin_object_size arguments, or + dst doesn't point into a known object. */ + chk_calls = 0; + + /* These should probably be handled by store_by_pieces on most arches. */ + if (memcpy (buf1, "ABCDEFGHI", 9) != (char *) buf1 + || memcmp (buf1, "ABCDEFGHI\0", 11)) + abort (); + + if (memcpy (buf1, "abcdefghijklmnopq", 17) != (char *) buf1 + || memcmp (buf1, "abcdefghijklmnopq\0", 19)) + abort (); + + if (__builtin_memcpy (buf3, "ABCDEF", 6) != (char *) buf1 + || memcmp (buf1, "ABCDEFghijklmnopq\0", 19)) + abort (); + + if (__builtin_memcpy (buf3, "a", 1) != (char *) buf1 + || memcmp (buf1, "aBCDEFghijklmnopq\0", 19)) + abort (); + + if (memcpy ((char *) buf3 + 2, "bcd" + ++i, 2) != (char *) buf1 + 2 + || memcmp (buf1, "aBcdEFghijklmnopq\0", 19) + || i != 1) + abort (); + + /* These should probably be handled by move_by_pieces on most arches. */ + if (memcpy ((char *) buf3 + 4, buf5, 6) != (char *) buf1 + 4 + || memcmp (buf1, "aBcdRSTUVWklmnopq\0", 19)) + abort (); + + if (__builtin_memcpy ((char *) buf1 + ++i + 8, (char *) buf5 + 1, 1) + != (char *) buf1 + 10 + || memcmp (buf1, "aBcdRSTUVWSlmnopq\0", 19) + || i != 2) + abort (); + + if (memcpy ((char *) buf3 + 14, buf6, 2) != (char *) buf1 + 14 + || memcmp (buf1, "aBcdRSTUVWSlmnrsq\0", 19)) + abort (); + + if (memcpy (buf3, buf5, 8) != (char *) buf1 + || memcmp (buf1, "RSTUVWXYVWSlmnrsq\0", 19)) + abort (); + + if (memcpy (buf3, buf5, 17) != (char *) buf1 + || memcmp (buf1, "RSTUVWXYZ01234567\0", 19)) + abort (); + + __builtin_memcpy (buf3, "aBcdEFghijklmnopq\0", 19); + + /* These should be handled either by movmemendM or memcpy + call. */ + + /* buf3 points to an unknown object, so __memcpy_chk should not be done. */ + if (memcpy ((char *) buf3 + 4, buf5, n + 6) != (char *) buf1 + 4 + || memcmp (buf1, "aBcdRSTUVWklmnopq\0", 19)) + abort (); + + /* This call has side-effects in dst, therefore no checking. */ + if (__builtin___memcpy_chk ((char *) buf1 + ++i + 8, (char *) buf5 + 1, + n + 1, os ((char *) buf1 + ++i + 8)) + != (char *) buf1 + 11 + || memcmp (buf1, "aBcdRSTUVWkSmnopq\0", 19) + || i != 3) + abort (); + + if (memcpy ((char *) buf3 + 14, buf6, n + 2) != (char *) buf1 + 14 + || memcmp (buf1, "aBcdRSTUVWkSmnrsq\0", 19)) + abort (); + + i = 1; + + /* These might be handled by store_by_pieces. */ + if (memcpy (buf2, "ABCDEFGHI", 9) != buf2 + || memcmp (buf2, "ABCDEFGHI\0", 11)) + abort (); + + if (memcpy (buf2, "abcdefghijklmnopq", 17) != buf2 + || memcmp (buf2, "abcdefghijklmnopq\0", 19)) + abort (); + + if (__builtin_memcpy (buf4, "ABCDEF", 6) != buf2 + || memcmp (buf2, "ABCDEFghijklmnopq\0", 19)) + abort (); + + if (__builtin_memcpy (buf4, "a", 1) != buf2 + || memcmp (buf2, "aBCDEFghijklmnopq\0", 19)) + abort (); + + if (memcpy (buf4 + 2, "bcd" + i++, 2) != buf2 + 2 + || memcmp (buf2, "aBcdEFghijklmnopq\0", 19) + || i != 2) + abort (); + + /* These might be handled by move_by_pieces. */ + if (memcpy (buf4 + 4, buf7, 6) != buf2 + 4 + || memcmp (buf2, "aBcdRSTUVWklmnopq\0", 19)) + abort (); + + /* Side effect. */ + if (__builtin___memcpy_chk (buf2 + i++ + 8, buf7 + 1, 1, + os (buf2 + i++ + 8)) + != buf2 + 10 + || memcmp (buf2, "aBcdRSTUVWSlmnopq\0", 19) + || i != 3) + abort (); + + if (memcpy (buf4 + 14, buf6, 2) != buf2 + 14 + || memcmp (buf2, "aBcdRSTUVWSlmnrsq\0", 19)) + abort (); + + __builtin_memcpy (buf4, "aBcdEFghijklmnopq\0", 19); + + /* These should be handled either by movmemendM or memcpy + call. */ + if (memcpy (buf4 + 4, buf7, n + 6) != buf2 + 4 + || memcmp (buf2, "aBcdRSTUVWklmnopq\0", 19)) + abort (); + + /* Side effect. */ + if (__builtin___memcpy_chk (buf2 + i++ + 8, buf7 + 1, n + 1, + os (buf2 + i++ + 8)) + != buf2 + 11 + || memcmp (buf2, "aBcdRSTUVWkSmnopq\0", 19) + || i != 4) + abort (); + + if (memcpy (buf4 + 14, buf6, n + 2) != buf2 + 14 + || memcmp (buf2, "aBcdRSTUVWkSmnrsq\0", 19)) + abort (); + + if (chk_calls) + abort (); +} + +void +__attribute__((noinline)) +test2 (void) +{ + long *x; + char *y; + int z; + __builtin_memcpy (buf5, "RSTUVWXYZ0123456789", 20); + __builtin_memcpy (buf7, "RSTUVWXYZ0123456789", 20); + __asm ("" : "=r" (x) : "0" (buf1)); + __asm ("" : "=r" (y) : "0" (buf2)); + __asm ("" : "=r" (z) : "0" (0)); + test2_sub (x, y, "rstuvwxyz", z); +} + +/* Test whether compile time checking is done where it should + and so is runtime object size checking. */ +void +__attribute__((noinline)) +test3 (void) +{ + struct A { char buf1[10]; char buf2[10]; } a; + char *r = l1 == 1 ? &a.buf1[5] : &a.buf2[4]; + char buf3[20]; + int i; + size_t l; + + /* The following calls should do runtime checking + - length is not known, but destination is. */ + chk_calls = 0; + memcpy (a.buf1 + 2, s3, l1); + memcpy (r, s3, l1 + 1); + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + memcpy (r, s2, l1 + 2); + memcpy (r + 2, s3, l1); + r = buf3; + for (i = 0; i < 4; ++i) + { + if (i == l1 - 1) + r = &a.buf1[1]; + else if (i == l1) + r = &a.buf2[7]; + else if (i == l1 + 1) + r = &buf3[5]; + else if (i == l1 + 2) + r = &a.buf1[9]; + } + memcpy (r, s2, l1); + if (chk_calls != 5) + abort (); + + /* Following have known destination and known length, + so if optimizing certainly shouldn't result in the checking + variants. */ + chk_calls = 0; + memcpy (a.buf1 + 2, s3, 1); + memcpy (r, s3, 2); + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + memcpy (r, s2, 3); + r = buf3; + l = 4; + for (i = 0; i < 4; ++i) + { + if (i == l1 - 1) + r = &a.buf1[1], l = 2; + else if (i == l1) + r = &a.buf2[7], l = 3; + else if (i == l1 + 1) + r = &buf3[5], l = 4; + else if (i == l1 + 2) + r = &a.buf1[9], l = 1; + } + memcpy (r, s2, 1); + /* Here, l is known to be at most 4 and __builtin_object_size (&buf3[16], 0) + is 4, so this doesn't need runtime checking. */ + memcpy (&buf3[16], s2, l); + if (chk_calls) + abort (); + chk_calls = 0; +} + +/* Test whether runtime and/or compile time checking catches + buffer overflows. */ +void +__attribute__((noinline)) +test4 (void) +{ + struct A { char buf1[10]; char buf2[10]; } a; + char buf3[20]; + + chk_fail_allowed = 1; + /* Runtime checks. */ + if (__builtin_setjmp (chk_fail_buf) == 0) + { + memcpy (&a.buf2[9], s2, l1 + 1); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + memcpy (&a.buf2[7], s3, strlen (s3) + 1); + abort (); + } + /* This should be detectable at compile time already. */ + if (__builtin_setjmp (chk_fail_buf) == 0) + { + memcpy (&buf3[19], "ab", 2); + abort (); + } + chk_fail_allowed = 0; +} + +#ifndef MAX_OFFSET +#define MAX_OFFSET (sizeof (long long)) +#endif + +#ifndef MAX_COPY +#define MAX_COPY (10 * sizeof (long long)) +#endif + +#ifndef MAX_EXTRA +#define MAX_EXTRA (sizeof (long long)) +#endif + +#define MAX_LENGTH (MAX_OFFSET + MAX_COPY + MAX_EXTRA) + +/* Use a sequence length that is not divisible by two, to make it more + likely to detect when words are mixed up. */ +#define SEQUENCE_LENGTH 31 + +static union { + char buf[MAX_LENGTH]; + long long align_int; + long double align_fp; +} u1, u2; + +void +__attribute__((noinline)) +test5 (void) +{ + int off1, off2, len, i; + char *p, *q, c; + + for (off1 = 0; off1 < MAX_OFFSET; off1++) + for (off2 = 0; off2 < MAX_OFFSET; off2++) + for (len = 1; len < MAX_COPY; len++) + { + for (i = 0, c = 'A'; i < MAX_LENGTH; i++, c++) + { + u1.buf[i] = 'a'; + if (c >= 'A' + SEQUENCE_LENGTH) + c = 'A'; + u2.buf[i] = c; + } + + p = memcpy (u1.buf + off1, u2.buf + off2, len); + if (p != u1.buf + off1) + abort (); + + q = u1.buf; + for (i = 0; i < off1; i++, q++) + if (*q != 'a') + abort (); + + for (i = 0, c = 'A' + off2; i < len; i++, q++, c++) + { + if (c >= 'A' + SEQUENCE_LENGTH) + c = 'A'; + if (*q != c) + abort (); + } + + for (i = 0; i < MAX_EXTRA; i++, q++) + if (*q != 'a') + abort (); + } +} + +#define TESTSIZE 80 + +char srcb[TESTSIZE] __attribute__ ((aligned)); +char dstb[TESTSIZE] __attribute__ ((aligned)); + +void +__attribute__((noinline)) +check (char *test, char *match, int n) +{ + if (memcmp (test, match, n)) + abort (); +} + +#define TN(n) \ +{ memset (dstb, 0, n); memcpy (dstb, srcb, n); check (dstb, srcb, n); } +#define T(n) \ +TN (n) \ +TN ((n) + 1) \ +TN ((n) + 2) \ +TN ((n) + 3) + +void +__attribute__((noinline)) +test6 (void) +{ + int i; + + chk_calls = 0; + + for (i = 0; i < sizeof (srcb); ++i) + srcb[i] = 'a' + i % 26; + + T (0); + T (4); + T (8); + T (12); + T (16); + T (20); + T (24); + T (28); + T (32); + T (36); + T (40); + T (44); + T (48); + T (52); + T (56); + T (60); + T (64); + T (68); + T (72); + T (76); + + /* All memcpy calls in this routine have constant arguments. */ + if (chk_calls) + abort (); +} + +void +main_test (void) +{ +#ifndef __OPTIMIZE__ + /* Object size checking is only intended for -O[s123]. */ + return; +#endif + __asm ("" : "=r" (l1) : "0" (l1)); + test1 (); + test2 (); + test3 (); + test4 (); + test5 (); + test6 (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memmove-2-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memmove-2-lib.c new file mode 100644 index 000000000..e2293ffc0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memmove-2-lib.c @@ -0,0 +1,7 @@ +#include "lib/memmove.c" +#ifdef __vxworks +/* The RTP C library uses bzero and bfill, both of which are defined + in the same file as bcopy. */ +#include "lib/bzero.c" +#include "lib/bfill.c" +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memmove-2.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memmove-2.c new file mode 100644 index 000000000..3afe34313 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memmove-2.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2004 Free Software Foundation. + + Check builtin memmove and bcopy optimization when length is 1. + + Written by Jakub Jelinek, 9/14/2004. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern void *memmove (void *, const void *, size_t); +extern void bcopy (const void *, void *, size_t); +extern int memcmp (const void *, const void *, size_t); + +char p[32] = "abcdefg"; +char *q = p + 4; + +void +main_test (void) +{ + /* memmove with length 1 can be optimized into memcpy if it can be + expanded inline. */ + if (memmove (p + 2, p + 3, 1) != p + 2 || memcmp (p, "abddefg", 8)) + abort (); + if (memmove (p + 1, p + 1, 1) != p + 1 || memcmp (p, "abddefg", 8)) + abort (); + if (memmove (q, p + 4, 1) != p + 4 || memcmp (p, "abddefg", 8)) + abort (); + bcopy (p + 5, p + 6, 1); + if (memcmp (p, "abddeff", 8)) + abort (); + bcopy (p + 1, p + 1, 1); + if (memcmp (p, "abddeff", 8)) + abort (); + bcopy (q, p + 4, 1); + if (memcmp (p, "abddeff", 8)) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memmove-chk-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memmove-chk-lib.c new file mode 100644 index 000000000..9daf13e82 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memmove-chk-lib.c @@ -0,0 +1 @@ +#include "lib/chk.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memmove-chk.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memmove-chk.c new file mode 100644 index 000000000..73b35883e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memmove-chk.c @@ -0,0 +1,579 @@ +/* Copyright (C) 2004, 2005 Free Software Foundation. + + Ensure builtin __memcpy_chk performs correctly. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern size_t strlen(const char *); +extern void *memcpy (void *, const void *, size_t); +extern void *memmove (void *, const void *, size_t); +extern int memcmp (const void *, const void *, size_t); + +#include "chk.h" + +const char s1[] = "123"; +char p[32] = ""; +volatile char *s2 = "defg"; /* prevent constant propagation to happen when whole program assumptions are made. */ +volatile char *s3 = "FGH"; /* prevent constant propagation to happen when whole program assumptions are made. */ +volatile size_t l1 = 1; /* prevent constant propagation to happen when whole program assumptions are made. */ + +void +__attribute__((noinline)) +test1 (void) +{ + int i; + +#if defined __i386__ || defined __x86_64__ + /* The functions below might not be optimized into direct stores on all + arches. It depends on how many instructions would be generated and + what limits the architecture chooses in STORE_BY_PIECES_P. */ + memmove_disallowed = 1; + memcpy_disallowed = 1; +#endif + + /* All the memmove calls in this routine except last have fixed length, so + object size checking should be done at compile time if optimizing. */ + chk_calls = 0; + + if (memmove (p, "ABCDE", 6) != p || memcmp (p, "ABCDE", 6)) + abort (); + if (memmove (p + 16, "VWX" + 1, 2) != p + 16 + || memcmp (p + 16, "WX\0\0", 5)) + abort (); + if (memmove (p + 1, "", 1) != p + 1 || memcmp (p, "A\0CDE", 6)) + abort (); + if (memmove (p + 3, "FGHI", 4) != p + 3 || memcmp (p, "A\0CFGHI", 8)) + abort (); + + i = 8; + memmove (p + 20, "qrstu", 6); + memmove (p + 25, "QRSTU", 6); + if (memmove (p + 25 + 1, s1, 3) != p + 25 + 1 + || memcmp (p + 25, "Q123U", 6)) + abort (); + + if (memmove (memmove (p, "abcdEFG", 4) + 4, "efg", 4) != p + 4 + || memcmp (p, "abcdefg", 8)) + abort(); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + if (__builtin_memmove (p, "ABCDE", 6) != p || memcmp (p, "ABCDE", 6)) + abort (); + + memmove (p + 5, s3, 1); + if (memcmp (p, "ABCDEFg", 8)) + abort (); + + memmove_disallowed = 0; + memcpy_disallowed = 0; + if (chk_calls) + abort (); + chk_calls = 0; + + memmove (p + 6, s1 + 1, l1); + if (memcmp (p, "ABCDEF2", 8)) + abort (); + + /* The above memmove copies into an object with known size, but + unknown length, so it should be a __memmove_chk call. */ + if (chk_calls != 1) + abort (); +} + +long buf1[64]; +char *buf2 = (char *) (buf1 + 32); +long buf5[20]; +char buf7[20]; + +void +__attribute__((noinline)) +test2_sub (long *buf3, char *buf4, char *buf6, int n) +{ + int i = 0; + + /* All the memmove/__builtin_memmove/__builtin___memmove_chk + calls in this routine are either fixed length, or have + side-effects in __builtin_object_size arguments, or + dst doesn't point into a known object. */ + chk_calls = 0; + + /* These should probably be handled by store_by_pieces on most arches. */ + if (memmove (buf1, "ABCDEFGHI", 9) != (char *) buf1 + || memcmp (buf1, "ABCDEFGHI\0", 11)) + abort (); + + if (memmove (buf1, "abcdefghijklmnopq", 17) != (char *) buf1 + || memcmp (buf1, "abcdefghijklmnopq\0", 19)) + abort (); + + if (__builtin_memmove (buf3, "ABCDEF", 6) != (char *) buf1 + || memcmp (buf1, "ABCDEFghijklmnopq\0", 19)) + abort (); + + if (__builtin_memmove (buf3, "a", 1) != (char *) buf1 + || memcmp (buf1, "aBCDEFghijklmnopq\0", 19)) + abort (); + + if (memmove ((char *) buf3 + 2, "bcd" + ++i, 2) != (char *) buf1 + 2 + || memcmp (buf1, "aBcdEFghijklmnopq\0", 19) + || i != 1) + abort (); + + /* These should probably be handled by move_by_pieces on most arches. */ + if (memmove ((char *) buf3 + 4, buf5, 6) != (char *) buf1 + 4 + || memcmp (buf1, "aBcdRSTUVWklmnopq\0", 19)) + abort (); + + if (__builtin_memmove ((char *) buf1 + ++i + 8, (char *) buf5 + 1, 1) + != (char *) buf1 + 10 + || memcmp (buf1, "aBcdRSTUVWSlmnopq\0", 19) + || i != 2) + abort (); + + if (memmove ((char *) buf3 + 14, buf6, 2) != (char *) buf1 + 14 + || memcmp (buf1, "aBcdRSTUVWSlmnrsq\0", 19)) + abort (); + + if (memmove (buf3, buf5, 8) != (char *) buf1 + || memcmp (buf1, "RSTUVWXYVWSlmnrsq\0", 19)) + abort (); + + if (memmove (buf3, buf5, 17) != (char *) buf1 + || memcmp (buf1, "RSTUVWXYZ01234567\0", 19)) + abort (); + + __builtin_memmove (buf3, "aBcdEFghijklmnopq\0", 19); + + /* These should be handled either by movmemendM or memmove + call. */ + + /* buf3 points to an unknown object, so __memmove_chk should not be done. */ + if (memmove ((char *) buf3 + 4, buf5, n + 6) != (char *) buf1 + 4 + || memcmp (buf1, "aBcdRSTUVWklmnopq\0", 19)) + abort (); + + /* This call has side-effects in dst, therefore no checking. */ + if (__builtin___memmove_chk ((char *) buf1 + ++i + 8, (char *) buf5 + 1, + n + 1, os ((char *) buf1 + ++i + 8)) + != (char *) buf1 + 11 + || memcmp (buf1, "aBcdRSTUVWkSmnopq\0", 19) + || i != 3) + abort (); + + if (memmove ((char *) buf3 + 14, buf6, n + 2) != (char *) buf1 + 14 + || memcmp (buf1, "aBcdRSTUVWkSmnrsq\0", 19)) + abort (); + + i = 1; + + /* These might be handled by store_by_pieces. */ + if (memmove (buf2, "ABCDEFGHI", 9) != buf2 + || memcmp (buf2, "ABCDEFGHI\0", 11)) + abort (); + + if (memmove (buf2, "abcdefghijklmnopq", 17) != buf2 + || memcmp (buf2, "abcdefghijklmnopq\0", 19)) + abort (); + + if (__builtin_memmove (buf4, "ABCDEF", 6) != buf2 + || memcmp (buf2, "ABCDEFghijklmnopq\0", 19)) + abort (); + + if (__builtin_memmove (buf4, "a", 1) != buf2 + || memcmp (buf2, "aBCDEFghijklmnopq\0", 19)) + abort (); + + if (memmove (buf4 + 2, "bcd" + i++, 2) != buf2 + 2 + || memcmp (buf2, "aBcdEFghijklmnopq\0", 19) + || i != 2) + abort (); + + /* These might be handled by move_by_pieces. */ + if (memmove (buf4 + 4, buf7, 6) != buf2 + 4 + || memcmp (buf2, "aBcdRSTUVWklmnopq\0", 19)) + abort (); + + /* Side effect. */ + if (__builtin___memmove_chk (buf2 + i++ + 8, buf7 + 1, 1, + os (buf2 + i++ + 8)) + != buf2 + 10 + || memcmp (buf2, "aBcdRSTUVWSlmnopq\0", 19) + || i != 3) + abort (); + + if (memmove (buf4 + 14, buf6, 2) != buf2 + 14 + || memcmp (buf2, "aBcdRSTUVWSlmnrsq\0", 19)) + abort (); + + __builtin_memmove (buf4, "aBcdEFghijklmnopq\0", 19); + + /* These should be handled either by movmemendM or memmove + call. */ + if (memmove (buf4 + 4, buf7, n + 6) != buf2 + 4 + || memcmp (buf2, "aBcdRSTUVWklmnopq\0", 19)) + abort (); + + /* Side effect. */ + if (__builtin___memmove_chk (buf2 + i++ + 8, buf7 + 1, n + 1, + os (buf2 + i++ + 8)) + != buf2 + 11 + || memcmp (buf2, "aBcdRSTUVWkSmnopq\0", 19) + || i != 4) + abort (); + + if (memmove (buf4 + 14, buf6, n + 2) != buf2 + 14 + || memcmp (buf2, "aBcdRSTUVWkSmnrsq\0", 19)) + abort (); + + if (chk_calls) + abort (); +} + +void +__attribute__((noinline)) +test2 (void) +{ + long *x; + char *y; + int z; + __builtin_memmove (buf5, "RSTUVWXYZ0123456789", 20); + __builtin_memmove (buf7, "RSTUVWXYZ0123456789", 20); + __asm ("" : "=r" (x) : "0" (buf1)); + __asm ("" : "=r" (y) : "0" (buf2)); + __asm ("" : "=r" (z) : "0" (0)); + test2_sub (x, y, "rstuvwxyz", z); +} + +static const struct foo +{ + char *s; + double d; + long l; +} foo[] = +{ + { "hello world1", 3.14159, 101L }, + { "hello world2", 3.14159, 102L }, + { "hello world3", 3.14159, 103L }, + { "hello world4", 3.14159, 104L }, + { "hello world5", 3.14159, 105L }, + { "hello world6", 3.14159, 106L } +}; + +static const struct bar +{ + char *s; + const struct foo f[3]; +} bar[] = +{ + { + "hello world10", + { + { "hello1", 3.14159, 201L }, + { "hello2", 3.14159, 202L }, + { "hello3", 3.14159, 203L }, + } + }, + { + "hello world11", + { + { "hello4", 3.14159, 204L }, + { "hello5", 3.14159, 205L }, + { "hello6", 3.14159, 206L }, + } + } +}; + +static const int baz[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }; + +void +__attribute__((noinline)) +test3 (void) +{ + const char *s; + struct foo f1[sizeof foo/sizeof*foo]; + struct bar b1[sizeof bar/sizeof*bar]; + int bz[sizeof baz/sizeof*baz]; + + /* All the memmove/__builtin_memmove calls in this routine have fixed + length. */ + chk_calls = 0; + + /* All the *memmove calls below have src in read-only memory, so all + of them should be optimized into memcpy. */ + memmove_disallowed = 1; + if (memmove (f1, foo, sizeof (foo)) != f1 || memcmp (f1, foo, sizeof (foo))) + abort (); + if (memmove (b1, bar, sizeof (bar)) != b1 || memcmp (b1, bar, sizeof (bar))) + abort (); + memmove (bz, baz, sizeof (baz)); + if (memcmp (bz, baz, sizeof (baz))) + abort (); + + if (memmove (p, "abcde", 6) != p || memcmp (p, "abcde", 6)) + abort (); + s = s1; + if (memmove (p + 2, ++s, 0) != p + 2 || memcmp (p, "abcde", 6) || s != s1 + 1) + abort (); + if (__builtin_memmove (p + 3, "", 1) != p + 3 || memcmp (p, "abc\0e", 6)) + abort (); + memmove (p + 2, "fghijk", 4); + if (memcmp (p, "abfghi", 7)) + abort (); + s = s1 + 1; + memmove (p + 1, s++, 0); + if (memcmp (p, "abfghi", 7) || s != s1 + 2) + abort (); + __builtin_memmove (p + 4, "ABCDE", 1); + if (memcmp (p, "abfgAi", 7)) + abort (); + + /* memmove with length 1 can be optimized into memcpy if it can be + expanded inline. */ + if (memmove (p + 2, p + 3, 1) != p + 2) + abort (); + if (memcmp (p, "abggAi", 7)) + abort (); + + if (chk_calls) + abort (); + memmove_disallowed = 0; +} + +/* Test whether compile time checking is done where it should + and so is runtime object size checking. */ +void +__attribute__((noinline)) +test4 (void) +{ + struct A { char buf1[10]; char buf2[10]; } a; + char *r = l1 == 1 ? &a.buf1[5] : &a.buf2[4]; + char buf3[20]; + int i; + size_t l; + + /* The following calls should do runtime checking + - length is not known, but destination is. */ + chk_calls = 0; + memmove (a.buf1 + 2, s3, l1); + memmove (r, s3, l1 + 1); + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + memmove (r, s2, l1 + 2); + memmove (r + 2, s3, l1); + r = buf3; + for (i = 0; i < 4; ++i) + { + if (i == l1 - 1) + r = &a.buf1[1]; + else if (i == l1) + r = &a.buf2[7]; + else if (i == l1 + 1) + r = &buf3[5]; + else if (i == l1 + 2) + r = &a.buf1[9]; + } + memmove (r, s2, l1); + if (chk_calls != 5) + abort (); + + /* Following have known destination and known length, + so if optimizing certainly shouldn't result in the checking + variants. */ + chk_calls = 0; + memmove (a.buf1 + 2, s3, 1); + memmove (r, s3, 2); + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + memmove (r, s2, 3); + r = buf3; + l = 4; + for (i = 0; i < 4; ++i) + { + if (i == l1 - 1) + r = &a.buf1[1], l = 2; + else if (i == l1) + r = &a.buf2[7], l = 3; + else if (i == l1 + 1) + r = &buf3[5], l = 4; + else if (i == l1 + 2) + r = &a.buf1[9], l = 1; + } + memmove (r, s2, 1); + /* Here, l is known to be at most 4 and __builtin_object_size (&buf3[16], 0) + is 4, so this doesn't need runtime checking. */ + memmove (&buf3[16], s2, l); + if (chk_calls) + abort (); + chk_calls = 0; +} + +/* Test whether runtime and/or compile time checking catches + buffer overflows. */ +void +__attribute__((noinline)) +test5 (void) +{ + struct A { char buf1[10]; char buf2[10]; } a; + char buf3[20]; + + chk_fail_allowed = 1; + /* Runtime checks. */ + if (__builtin_setjmp (chk_fail_buf) == 0) + { + memmove (&a.buf2[9], s2, l1 + 1); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + memmove (&a.buf2[7], s3, strlen (s3) + 1); + abort (); + } + /* This should be detectable at compile time already. */ + if (__builtin_setjmp (chk_fail_buf) == 0) + { + memmove (&buf3[19], "ab", 2); + abort (); + } + chk_fail_allowed = 0; +} + +#ifndef MAX_OFFSET +#define MAX_OFFSET (sizeof (long long)) +#endif + +#ifndef MAX_COPY +#define MAX_COPY (10 * sizeof (long long)) +#endif + +#ifndef MAX_EXTRA +#define MAX_EXTRA (sizeof (long long)) +#endif + +#define MAX_LENGTH (MAX_OFFSET + MAX_COPY + MAX_EXTRA) + +/* Use a sequence length that is not divisible by two, to make it more + likely to detect when words are mixed up. */ +#define SEQUENCE_LENGTH 31 + +static union { + char buf[MAX_LENGTH]; + long long align_int; + long double align_fp; +} u1, u2; + +void +__attribute__((noinline)) +test6 (void) +{ + int off1, off2, len, i; + char *p, *q, c; + + for (off1 = 0; off1 < MAX_OFFSET; off1++) + for (off2 = 0; off2 < MAX_OFFSET; off2++) + for (len = 1; len < MAX_COPY; len++) + { + for (i = 0, c = 'A'; i < MAX_LENGTH; i++, c++) + { + u1.buf[i] = 'a'; + if (c >= 'A' + SEQUENCE_LENGTH) + c = 'A'; + u2.buf[i] = c; + } + + p = memmove (u1.buf + off1, u2.buf + off2, len); + if (p != u1.buf + off1) + abort (); + + q = u1.buf; + for (i = 0; i < off1; i++, q++) + if (*q != 'a') + abort (); + + for (i = 0, c = 'A' + off2; i < len; i++, q++, c++) + { + if (c >= 'A' + SEQUENCE_LENGTH) + c = 'A'; + if (*q != c) + abort (); + } + + for (i = 0; i < MAX_EXTRA; i++, q++) + if (*q != 'a') + abort (); + } +} + +#define TESTSIZE 80 + +char srcb[TESTSIZE] __attribute__ ((aligned)); +char dstb[TESTSIZE] __attribute__ ((aligned)); + +void +__attribute__((noinline)) +check (char *test, char *match, int n) +{ + if (memcmp (test, match, n)) + abort (); +} + +#define TN(n) \ +{ memset (dstb, 0, n); memmove (dstb, srcb, n); check (dstb, srcb, n); } +#define T(n) \ +TN (n) \ +TN ((n) + 1) \ +TN ((n) + 2) \ +TN ((n) + 3) + +void +__attribute__((noinline)) +test7 (void) +{ + int i; + + chk_calls = 0; + + for (i = 0; i < sizeof (srcb); ++i) + srcb[i] = 'a' + i % 26; + + T (0); + T (4); + T (8); + T (12); + T (16); + T (20); + T (24); + T (28); + T (32); + T (36); + T (40); + T (44); + T (48); + T (52); + T (56); + T (60); + T (64); + T (68); + T (72); + T (76); + + /* All memmove calls in this routine have constant arguments. */ + if (chk_calls) + abort (); +} + +void +main_test (void) +{ +#ifndef __OPTIMIZE__ + /* Object size checking is only intended for -O[s123]. */ + return; +#endif + __asm ("" : "=r" (l1) : "0" (l1)); + test1 (); + test2 (); + __builtin_memset (p, '\0', sizeof (p)); + test3 (); + test4 (); + test5 (); + test6 (); + test7 (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memmove-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memmove-lib.c new file mode 100644 index 000000000..e2293ffc0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memmove-lib.c @@ -0,0 +1,7 @@ +#include "lib/memmove.c" +#ifdef __vxworks +/* The RTP C library uses bzero and bfill, both of which are defined + in the same file as bcopy. */ +#include "lib/bzero.c" +#include "lib/bfill.c" +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memmove.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memmove.c new file mode 100644 index 000000000..f52332c6c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memmove.c @@ -0,0 +1,90 @@ +/* Copyright (C) 2003, 2004 Free Software Foundation. + + Ensure builtin memmove and bcopy perform correctly. + + Written by Jakub Jelinek, 4/26/2003. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern void *memmove (void *, const void *, size_t); +extern void bcopy (const void *, void *, size_t); +extern int memcmp (const void *, const void *, size_t); + +const char s1[] = "123"; +char p[32] = ""; + +static const struct foo +{ + char *s; + double d; + long l; +} foo[] = +{ + { "hello world1", 3.14159, 101L }, + { "hello world2", 3.14159, 102L }, + { "hello world3", 3.14159, 103L }, + { "hello world4", 3.14159, 104L }, + { "hello world5", 3.14159, 105L }, + { "hello world6", 3.14159, 106L } +}; + +static const struct bar +{ + char *s; + const struct foo f[3]; +} bar[] = +{ + { + "hello world10", + { + { "hello1", 3.14159, 201L }, + { "hello2", 3.14159, 202L }, + { "hello3", 3.14159, 203L }, + } + }, + { + "hello world11", + { + { "hello4", 3.14159, 204L }, + { "hello5", 3.14159, 205L }, + { "hello6", 3.14159, 206L }, + } + } +}; + +static const int baz[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }; + +void +main_test (void) +{ + const char *s; + struct foo f1[sizeof foo/sizeof*foo]; + struct bar b1[sizeof bar/sizeof*bar]; + int bz[sizeof baz/sizeof*baz]; + + if (memmove (f1, foo, sizeof (foo)) != f1 || memcmp (f1, foo, sizeof (foo))) + abort (); + if (memmove (b1, bar, sizeof (bar)) != b1 || memcmp (b1, bar, sizeof (bar))) + abort (); + bcopy (baz, bz, sizeof (baz)); + if (memcmp (bz, baz, sizeof (baz))) + abort (); + + if (memmove (p, "abcde", 6) != p || memcmp (p, "abcde", 6)) + abort (); + s = s1; + if (memmove (p + 2, ++s, 0) != p + 2 || memcmp (p, "abcde", 6) || s != s1 + 1) + abort (); + if (__builtin_memmove (p + 3, "", 1) != p + 3 || memcmp (p, "abc\0e", 6)) + abort (); + bcopy ("fghijk", p + 2, 4); + if (memcmp (p, "abfghi", 7)) + abort (); + s = s1 + 1; + bcopy (s++, p + 1, 0); + if (memcmp (p, "abfghi", 7) || s != s1 + 2) + abort (); + __builtin_bcopy ("ABCDE", p + 4, 1); + if (memcmp (p, "abfgAi", 7)) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm-lib.c new file mode 100644 index 000000000..00005298d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm-lib.c @@ -0,0 +1,97 @@ +extern void abort (void); +extern int inside_main; +typedef __SIZE_TYPE__ size_t; + +#define TEST_ABORT if (inside_main) abort() + +/* LTO code is at the present to able to track that asm alias my_bcopy on builtin + actually refers to this function. See PR47181. */ +__attribute__ ((used)) +void * +my_memcpy (void *d, const void *s, size_t n) +{ + char *dst = (char *) d; + const char *src = (const char *) s; + while (n--) + *dst++ = *src++; + return (char *) d; +} + +/* LTO code is at the present to able to track that asm alias my_bcopy on builtin + actually refers to this function. See PR47181. */ +__attribute__ ((used)) +void +my_bcopy (const void *s, void *d, size_t n) +{ + char *dst = (char *) d; + const char *src = (const char *) s; + if (src >= dst) + while (n--) + *dst++ = *src++; + else + { + dst += n; + src += n; + while (n--) + *--dst = *--src; + } +} + +/* LTO code is at the present to able to track that asm alias my_bcopy on builtin + actually refers to this function. See PR47181. */ +__attribute__ ((used)) +void * +my_memset (void *d, int c, size_t n) +{ + char *dst = (char *) d; + while (n--) + *dst++ = c; + return (char *) d; +} + +/* LTO code is at the present to able to track that asm alias my_bcopy on builtin + actually refers to this function. See PR47181. */ +__attribute__ ((used)) +void +my_bzero (void *d, size_t n) +{ + char *dst = (char *) d; + while (n--) + *dst++ = '\0'; +} + +void * +memcpy (void *d, const void *s, size_t n) +{ + void *result = my_memcpy (d, s, n); + TEST_ABORT; + return result; +} + +void +bcopy (const void *s, void *d, size_t n) +{ + my_bcopy (s, d, n); + TEST_ABORT; +} + +void * +memset (void *d, int c, size_t n) +{ + void *result = my_memset (d, c, n); + TEST_ABORT; + return result; +} + +void +bzero (void *d, size_t n) +{ + my_bzero (d, n); + TEST_ABORT; +} + +#ifdef __vxworks +/* The RTP C library uses bfill, which is defined in the same file as + bzero and bcopy. */ +#include "lib/bfill.c" +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm.c new file mode 100644 index 000000000..ed2b06cf0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm.c @@ -0,0 +1,51 @@ +/* Copyright (C) 2003 Free Software Foundation. + + Test memcpy and memset in presence of redirect. */ + +#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname) +#define ASMNAME2(prefix, cname) STRING (prefix) cname +#define STRING(x) #x + +typedef __SIZE_TYPE__ size_t; +extern void abort (void); +extern void *memcpy (void *, const void *, size_t) + __asm (ASMNAME ("my_memcpy")); +extern void bcopy (const void *, void *, size_t) + __asm (ASMNAME ("my_bcopy")); +extern void *memset (void *, int, size_t) + __asm (ASMNAME ("my_memset")); +extern void bzero (void *, size_t) + __asm (ASMNAME ("my_bzero")); +extern int memcmp (const void *, const void *, size_t); + +struct A { char c[32]; } a = { "foobar" }; +char x[64] = "foobar", y[64]; +int i = 39, j = 6, k = 4; + +extern int inside_main; + +void +main_test (void) +{ + struct A b = a; + struct A c = { { 'x' } }; + + inside_main = 1; + + if (memcmp (b.c, x, 32) || c.c[0] != 'x' || memcmp (c.c + 1, x + 32, 31)) + abort (); + if (__builtin_memcpy (y, x, i) != y || memcmp (x, y, 64)) + abort (); + if (memcpy (y + 6, x, j) != y + 6 + || memcmp (x, y, 6) || memcmp (x, y + 6, 58)) + abort (); + if (__builtin_memset (y + 2, 'X', k) != y + 2 + || memcmp (y, "foXXXXfoobar", 13)) + abort (); + bcopy (y + 1, y + 2, 6); + if (memcmp (y, "fooXXXXfobar", 13)) + abort (); + __builtin_bzero (y + 4, 2); + if (memcmp (y, "fooX\0\0Xfobar", 13)) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-2-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-2-lib.c new file mode 100644 index 000000000..cf3178c83 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-2-lib.c @@ -0,0 +1 @@ +#include "lib/mempcpy.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-2.c b/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-2.c new file mode 100644 index 000000000..3b7767acb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-2.c @@ -0,0 +1,153 @@ +/* Copyright (C) 2003 Free Software Foundation. + + Ensure that builtin mempcpy and stpcpy perform correctly. + + Written by Jakub Jelinek, 21/05/2003. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern void *mempcpy (void *, const void *, size_t); +extern int memcmp (const void *, const void *, size_t); +extern int inside_main; + +long buf1[64]; +char *buf2 = (char *) (buf1 + 32); +long buf5[20]; +char buf7[20]; + +void +__attribute__((noinline)) +test (long *buf3, char *buf4, char *buf6, int n) +{ + int i = 0; + + /* These should probably be handled by store_by_pieces on most arches. */ + if (mempcpy (buf1, "ABCDEFGHI", 9) != (char *) buf1 + 9 + || memcmp (buf1, "ABCDEFGHI\0", 11)) + abort (); + + if (mempcpy (buf1, "abcdefghijklmnopq", 17) != (char *) buf1 + 17 + || memcmp (buf1, "abcdefghijklmnopq\0", 19)) + abort (); + + if (__builtin_mempcpy (buf3, "ABCDEF", 6) != (char *) buf1 + 6 + || memcmp (buf1, "ABCDEFghijklmnopq\0", 19)) + abort (); + + if (__builtin_mempcpy (buf3, "a", 1) != (char *) buf1 + 1 + || memcmp (buf1, "aBCDEFghijklmnopq\0", 19)) + abort (); + + if (mempcpy ((char *) buf3 + 2, "bcd" + ++i, 2) != (char *) buf1 + 4 + || memcmp (buf1, "aBcdEFghijklmnopq\0", 19) + || i != 1) + abort (); + + /* These should probably be handled by move_by_pieces on most arches. */ + if (mempcpy ((char *) buf3 + 4, buf5, 6) != (char *) buf1 + 10 + || memcmp (buf1, "aBcdRSTUVWklmnopq\0", 19)) + abort (); + + if (__builtin_mempcpy ((char *) buf1 + ++i + 8, (char *) buf5 + 1, 1) + != (char *) buf1 + 11 + || memcmp (buf1, "aBcdRSTUVWSlmnopq\0", 19) + || i != 2) + abort (); + + if (mempcpy ((char *) buf3 + 14, buf6, 2) != (char *) buf1 + 16 + || memcmp (buf1, "aBcdRSTUVWSlmnrsq\0", 19)) + abort (); + + if (mempcpy (buf3, buf5, 8) != (char *) buf1 + 8 + || memcmp (buf1, "RSTUVWXYVWSlmnrsq\0", 19)) + abort (); + + if (mempcpy (buf3, buf5, 17) != (char *) buf1 + 17 + || memcmp (buf1, "RSTUVWXYZ01234567\0", 19)) + abort (); + + __builtin_memcpy (buf3, "aBcdEFghijklmnopq\0", 19); + + /* These should be handled either by movmemendM or mempcpy + call. */ + if (mempcpy ((char *) buf3 + 4, buf5, n + 6) != (char *) buf1 + 10 + || memcmp (buf1, "aBcdRSTUVWklmnopq\0", 19)) + abort (); + + if (__builtin_mempcpy ((char *) buf1 + ++i + 8, (char *) buf5 + 1, n + 1) + != (char *) buf1 + 12 + || memcmp (buf1, "aBcdRSTUVWkSmnopq\0", 19) + || i != 3) + abort (); + + if (mempcpy ((char *) buf3 + 14, buf6, n + 2) != (char *) buf1 + 16 + || memcmp (buf1, "aBcdRSTUVWkSmnrsq\0", 19)) + abort (); + + i = 1; + + /* These might be handled by store_by_pieces. */ + if (mempcpy (buf2, "ABCDEFGHI", 9) != buf2 + 9 + || memcmp (buf2, "ABCDEFGHI\0", 11)) + abort (); + + if (mempcpy (buf2, "abcdefghijklmnopq", 17) != buf2 + 17 + || memcmp (buf2, "abcdefghijklmnopq\0", 19)) + abort (); + + if (__builtin_mempcpy (buf4, "ABCDEF", 6) != buf2 + 6 + || memcmp (buf2, "ABCDEFghijklmnopq\0", 19)) + abort (); + + if (__builtin_mempcpy (buf4, "a", 1) != buf2 + 1 + || memcmp (buf2, "aBCDEFghijklmnopq\0", 19)) + abort (); + + if (mempcpy (buf4 + 2, "bcd" + i++, 2) != buf2 + 4 + || memcmp (buf2, "aBcdEFghijklmnopq\0", 19) + || i != 2) + abort (); + + /* These might be handled by move_by_pieces. */ + if (mempcpy (buf4 + 4, buf7, 6) != buf2 + 10 + || memcmp (buf2, "aBcdRSTUVWklmnopq\0", 19)) + abort (); + + if (__builtin_mempcpy (buf2 + i++ + 8, buf7 + 1, 1) + != buf2 + 11 + || memcmp (buf2, "aBcdRSTUVWSlmnopq\0", 19) + || i != 3) + abort (); + + if (mempcpy (buf4 + 14, buf6, 2) != buf2 + 16 + || memcmp (buf2, "aBcdRSTUVWSlmnrsq\0", 19)) + abort (); + + __builtin_memcpy (buf4, "aBcdEFghijklmnopq\0", 19); + + /* These should be handled either by movmemendM or mempcpy + call. */ + if (mempcpy (buf4 + 4, buf7, n + 6) != buf2 + 10 + || memcmp (buf2, "aBcdRSTUVWklmnopq\0", 19)) + abort (); + + if (__builtin_mempcpy (buf2 + i++ + 8, buf7 + 1, n + 1) + != buf2 + 12 + || memcmp (buf2, "aBcdRSTUVWkSmnopq\0", 19) + || i != 4) + abort (); + + if (mempcpy (buf4 + 14, buf6, n + 2) != buf2 + 16 + || memcmp (buf2, "aBcdRSTUVWkSmnrsq\0", 19)) + abort (); +} + +void +main_test (void) +{ + /* All these tests are allowed to call mempcpy/stpcpy. */ + inside_main = 0; + __builtin_memcpy (buf5, "RSTUVWXYZ0123456789", 20); + __builtin_memcpy (buf7, "RSTUVWXYZ0123456789", 20); + test (buf1, buf2, "rstuvwxyz", 0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-chk-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-chk-lib.c new file mode 100644 index 000000000..9daf13e82 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-chk-lib.c @@ -0,0 +1 @@ +#include "lib/chk.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-chk.c b/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-chk.c new file mode 100644 index 000000000..7a1737c4a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-chk.c @@ -0,0 +1,487 @@ +/* Copyright (C) 2004, 2005 Free Software Foundation. + + Ensure builtin __mempcpy_chk performs correctly. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern size_t strlen(const char *); +extern void *memcpy (void *, const void *, size_t); +extern void *mempcpy (void *, const void *, size_t); +extern int memcmp (const void *, const void *, size_t); + +#include "chk.h" + +const char s1[] = "123"; +char p[32] = ""; +volatile char *s2 = "defg"; /* prevent constant propagation to happen when whole program assumptions are made. */ +volatile char *s3 = "FGH"; /* prevent constant propagation to happen when whole program assumptions are made. */ +volatile size_t l1 = 1; /* prevent constant propagation to happen when whole program assumptions are made. */ + +void +__attribute__((noinline)) +test1 (void) +{ + int i; + +#if defined __i386__ || defined __x86_64__ + /* The functions below might not be optimized into direct stores on all + arches. It depends on how many instructions would be generated and + what limits the architecture chooses in STORE_BY_PIECES_P. */ + mempcpy_disallowed = 1; +#endif + + /* All the mempcpy calls in this routine except last have fixed length, so + object size checking should be done at compile time if optimizing. */ + chk_calls = 0; + + if (mempcpy (p, "ABCDE", 6) != p + 6 || memcmp (p, "ABCDE", 6)) + abort (); + if (mempcpy (p + 16, "VWX" + 1, 2) != p + 16 + 2 + || memcmp (p + 16, "WX\0\0", 5)) + abort (); + if (mempcpy (p + 1, "", 1) != p + 1 + 1 || memcmp (p, "A\0CDE", 6)) + abort (); + if (mempcpy (p + 3, "FGHI", 4) != p + 3 + 4 || memcmp (p, "A\0CFGHI", 8)) + abort (); + + i = 8; + memcpy (p + 20, "qrstu", 6); + memcpy (p + 25, "QRSTU", 6); + if (mempcpy (p + 25 + 1, s1, 3) != (p + 25 + 1 + 3) + || memcmp (p + 25, "Q123U", 6)) + abort (); + + if (mempcpy (mempcpy (p, "abcdEFG", 4), "efg", 4) != p + 8 + || memcmp (p, "abcdefg", 8)) + abort(); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + if (__builtin_mempcpy (p, "ABCDE", 6) != p + 6 || memcmp (p, "ABCDE", 6)) + abort (); + + /* If the result of mempcpy is ignored, gcc should use memcpy. + This should be optimized always, so disallow mempcpy calls. */ + mempcpy_disallowed = 1; + mempcpy (p + 5, s3, 1); + if (memcmp (p, "ABCDEFg", 8)) + abort (); + + if (chk_calls) + abort (); + chk_calls = 0; + + mempcpy (p + 6, s1 + 1, l1); + if (memcmp (p, "ABCDEF2", 8)) + abort (); + + /* The above mempcpy copies into an object with known size, but + unknown length and with result ignored, so it should be a + __memcpy_chk call. */ + if (chk_calls != 1) + abort (); + + mempcpy_disallowed = 0; +} + +long buf1[64]; +char *buf2 = (char *) (buf1 + 32); +long buf5[20]; +char buf7[20]; + +void +__attribute__((noinline)) +test2_sub (long *buf3, char *buf4, char *buf6, int n) +{ + int i = 0; + + /* All the mempcpy/__builtin_mempcpy/__builtin___mempcpy_chk + calls in this routine are either fixed length, or have + side-effects in __builtin_object_size arguments, or + dst doesn't point into a known object. */ + chk_calls = 0; + + /* These should probably be handled by store_by_pieces on most arches. */ + if (mempcpy (buf1, "ABCDEFGHI", 9) != (char *) buf1 + 9 + || memcmp (buf1, "ABCDEFGHI\0", 11)) + abort (); + + if (mempcpy (buf1, "abcdefghijklmnopq", 17) != (char *) buf1 + 17 + || memcmp (buf1, "abcdefghijklmnopq\0", 19)) + abort (); + + if (__builtin_mempcpy (buf3, "ABCDEF", 6) != (char *) buf1 + 6 + || memcmp (buf1, "ABCDEFghijklmnopq\0", 19)) + abort (); + + if (__builtin_mempcpy (buf3, "a", 1) != (char *) buf1 + 1 + || memcmp (buf1, "aBCDEFghijklmnopq\0", 19)) + abort (); + + if (mempcpy ((char *) buf3 + 2, "bcd" + ++i, 2) != (char *) buf1 + 4 + || memcmp (buf1, "aBcdEFghijklmnopq\0", 19) + || i != 1) + abort (); + + /* These should probably be handled by move_by_pieces on most arches. */ + if (mempcpy ((char *) buf3 + 4, buf5, 6) != (char *) buf1 + 10 + || memcmp (buf1, "aBcdRSTUVWklmnopq\0", 19)) + abort (); + + if (__builtin_mempcpy ((char *) buf1 + ++i + 8, (char *) buf5 + 1, 1) + != (char *) buf1 + 11 + || memcmp (buf1, "aBcdRSTUVWSlmnopq\0", 19) + || i != 2) + abort (); + + if (mempcpy ((char *) buf3 + 14, buf6, 2) != (char *) buf1 + 16 + || memcmp (buf1, "aBcdRSTUVWSlmnrsq\0", 19)) + abort (); + + if (mempcpy (buf3, buf5, 8) != (char *) buf1 + 8 + || memcmp (buf1, "RSTUVWXYVWSlmnrsq\0", 19)) + abort (); + + if (mempcpy (buf3, buf5, 17) != (char *) buf1 + 17 + || memcmp (buf1, "RSTUVWXYZ01234567\0", 19)) + abort (); + + __builtin_memcpy (buf3, "aBcdEFghijklmnopq\0", 19); + + /* These should be handled either by movmemendM or mempcpy + call. */ + + /* buf3 points to an unknown object, so __mempcpy_chk should not be done. */ + if (mempcpy ((char *) buf3 + 4, buf5, n + 6) != (char *) buf1 + 10 + || memcmp (buf1, "aBcdRSTUVWklmnopq\0", 19)) + abort (); + + /* This call has side-effects in dst, therefore no checking. */ + if (__builtin___mempcpy_chk ((char *) buf1 + ++i + 8, (char *) buf5 + 1, + n + 1, os ((char *) buf1 + ++i + 8)) + != (char *) buf1 + 12 + || memcmp (buf1, "aBcdRSTUVWkSmnopq\0", 19) + || i != 3) + abort (); + + if (mempcpy ((char *) buf3 + 14, buf6, n + 2) != (char *) buf1 + 16 + || memcmp (buf1, "aBcdRSTUVWkSmnrsq\0", 19)) + abort (); + + i = 1; + + /* These might be handled by store_by_pieces. */ + if (mempcpy (buf2, "ABCDEFGHI", 9) != buf2 + 9 + || memcmp (buf2, "ABCDEFGHI\0", 11)) + abort (); + + if (mempcpy (buf2, "abcdefghijklmnopq", 17) != buf2 + 17 + || memcmp (buf2, "abcdefghijklmnopq\0", 19)) + abort (); + + if (__builtin_mempcpy (buf4, "ABCDEF", 6) != buf2 + 6 + || memcmp (buf2, "ABCDEFghijklmnopq\0", 19)) + abort (); + + if (__builtin_mempcpy (buf4, "a", 1) != buf2 + 1 + || memcmp (buf2, "aBCDEFghijklmnopq\0", 19)) + abort (); + + if (mempcpy (buf4 + 2, "bcd" + i++, 2) != buf2 + 4 + || memcmp (buf2, "aBcdEFghijklmnopq\0", 19) + || i != 2) + abort (); + + /* These might be handled by move_by_pieces. */ + if (mempcpy (buf4 + 4, buf7, 6) != buf2 + 10 + || memcmp (buf2, "aBcdRSTUVWklmnopq\0", 19)) + abort (); + + /* Side effect. */ + if (__builtin___mempcpy_chk (buf2 + i++ + 8, buf7 + 1, 1, + os (buf2 + i++ + 8)) + != buf2 + 11 + || memcmp (buf2, "aBcdRSTUVWSlmnopq\0", 19) + || i != 3) + abort (); + + if (mempcpy (buf4 + 14, buf6, 2) != buf2 + 16 + || memcmp (buf2, "aBcdRSTUVWSlmnrsq\0", 19)) + abort (); + + __builtin_memcpy (buf4, "aBcdEFghijklmnopq\0", 19); + + /* These should be handled either by movmemendM or mempcpy + call. */ + if (mempcpy (buf4 + 4, buf7, n + 6) != buf2 + 10 + || memcmp (buf2, "aBcdRSTUVWklmnopq\0", 19)) + abort (); + + /* Side effect. */ + if (__builtin___mempcpy_chk (buf2 + i++ + 8, buf7 + 1, + n + 1, os (buf2 + i++ + 8)) + != buf2 + 12 + || memcmp (buf2, "aBcdRSTUVWkSmnopq\0", 19) + || i != 4) + abort (); + + if (mempcpy (buf4 + 14, buf6, n + 2) != buf2 + 16 + || memcmp (buf2, "aBcdRSTUVWkSmnrsq\0", 19)) + abort (); + + if (chk_calls) + abort (); +} + +void +__attribute__((noinline)) +test2 (void) +{ + long *x; + char *y; + int z; + __builtin_memcpy (buf5, "RSTUVWXYZ0123456789", 20); + __builtin_memcpy (buf7, "RSTUVWXYZ0123456789", 20); + __asm ("" : "=r" (x) : "0" (buf1)); + __asm ("" : "=r" (y) : "0" (buf2)); + __asm ("" : "=r" (z) : "0" (0)); + test2_sub (x, y, "rstuvwxyz", z); +} + +volatile void *vx; + +/* Test whether compile time checking is done where it should + and so is runtime object size checking. */ +void +__attribute__((noinline)) +test3 (void) +{ + struct A { char buf1[10]; char buf2[10]; } a; + char *r = l1 == 1 ? &a.buf1[5] : &a.buf2[4]; + char buf3[20]; + int i; + size_t l; + + /* The following calls should do runtime checking + - length is not known, but destination is. */ + chk_calls = 0; + vx = mempcpy (a.buf1 + 2, s3, l1); + vx = mempcpy (r, s3, l1 + 1); + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + vx = mempcpy (r, s2, l1 + 2); + vx = mempcpy (r + 2, s3, l1); + r = buf3; + for (i = 0; i < 4; ++i) + { + if (i == l1 - 1) + r = &a.buf1[1]; + else if (i == l1) + r = &a.buf2[7]; + else if (i == l1 + 1) + r = &buf3[5]; + else if (i == l1 + 2) + r = &a.buf1[9]; + } + vx = mempcpy (r, s2, l1); + if (chk_calls != 5) + abort (); + + /* Following have known destination and known length, + so if optimizing certainly shouldn't result in the checking + variants. */ + chk_calls = 0; + vx = mempcpy (a.buf1 + 2, s3, 1); + vx = mempcpy (r, s3, 2); + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + vx = mempcpy (r, s2, 3); + r = buf3; + l = 4; + for (i = 0; i < 4; ++i) + { + if (i == l1 - 1) + r = &a.buf1[1], l = 2; + else if (i == l1) + r = &a.buf2[7], l = 3; + else if (i == l1 + 1) + r = &buf3[5], l = 4; + else if (i == l1 + 2) + r = &a.buf1[9], l = 1; + } + vx = mempcpy (r, s2, 1); + /* Here, l is known to be at most 4 and __builtin_object_size (&buf3[16], 0) + is 4, so this doesn't need runtime checking. */ + vx = mempcpy (&buf3[16], s2, l); + if (chk_calls) + abort (); + chk_calls = 0; +} + +/* Test whether runtime and/or compile time checking catches + buffer overflows. */ +void +__attribute__((noinline)) +test4 (void) +{ + struct A { char buf1[10]; char buf2[10]; } a; + char buf3[20]; + + chk_fail_allowed = 1; + /* Runtime checks. */ + if (__builtin_setjmp (chk_fail_buf) == 0) + { + vx = mempcpy (&a.buf2[9], s2, l1 + 1); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + vx = mempcpy (&a.buf2[7], s3, strlen (s3) + 1); + abort (); + } + /* This should be detectable at compile time already. */ + if (__builtin_setjmp (chk_fail_buf) == 0) + { + vx = mempcpy (&buf3[19], "ab", 2); + abort (); + } + chk_fail_allowed = 0; +} + +#ifndef MAX_OFFSET +#define MAX_OFFSET (sizeof (long long)) +#endif + +#ifndef MAX_COPY +#define MAX_COPY (10 * sizeof (long long)) +#endif + +#ifndef MAX_EXTRA +#define MAX_EXTRA (sizeof (long long)) +#endif + +#define MAX_LENGTH (MAX_OFFSET + MAX_COPY + MAX_EXTRA) + +/* Use a sequence length that is not divisible by two, to make it more + likely to detect when words are mixed up. */ +#define SEQUENCE_LENGTH 31 + +static union { + char buf[MAX_LENGTH]; + long long align_int; + long double align_fp; +} u1, u2; + +void +__attribute__((noinline)) +test5 (void) +{ + int off1, off2, len, i; + char *p, *q, c; + + for (off1 = 0; off1 < MAX_OFFSET; off1++) + for (off2 = 0; off2 < MAX_OFFSET; off2++) + for (len = 1; len < MAX_COPY; len++) + { + for (i = 0, c = 'A'; i < MAX_LENGTH; i++, c++) + { + u1.buf[i] = 'a'; + if (c >= 'A' + SEQUENCE_LENGTH) + c = 'A'; + u2.buf[i] = c; + } + + p = mempcpy (u1.buf + off1, u2.buf + off2, len); + if (p != u1.buf + off1 + len) + abort (); + + q = u1.buf; + for (i = 0; i < off1; i++, q++) + if (*q != 'a') + abort (); + + for (i = 0, c = 'A' + off2; i < len; i++, q++, c++) + { + if (c >= 'A' + SEQUENCE_LENGTH) + c = 'A'; + if (*q != c) + abort (); + } + + for (i = 0; i < MAX_EXTRA; i++, q++) + if (*q != 'a') + abort (); + } +} + +#define TESTSIZE 80 + +char srcb[TESTSIZE] __attribute__ ((aligned)); +char dstb[TESTSIZE] __attribute__ ((aligned)); + +void +__attribute__((noinline)) +check (char *test, char *match, int n) +{ + if (memcmp (test, match, n)) + abort (); +} + +#define TN(n) \ +{ memset (dstb, 0, n); vx = mempcpy (dstb, srcb, n); check (dstb, srcb, n); } +#define T(n) \ +TN (n) \ +TN ((n) + 1) \ +TN ((n) + 2) \ +TN ((n) + 3) + +void +__attribute__((noinline)) +test6 (void) +{ + int i; + + chk_calls = 0; + + for (i = 0; i < sizeof (srcb); ++i) + srcb[i] = 'a' + i % 26; + + T (0); + T (4); + T (8); + T (12); + T (16); + T (20); + T (24); + T (28); + T (32); + T (36); + T (40); + T (44); + T (48); + T (52); + T (56); + T (60); + T (64); + T (68); + T (72); + T (76); + + /* All mempcpy calls in this routine have constant arguments. */ + if (chk_calls) + abort (); +} + +void +main_test (void) +{ +#ifndef __OPTIMIZE__ + /* Object size checking is only intended for -O[s123]. */ + return; +#endif + __asm ("" : "=r" (l1) : "0" (l1)); + test1 (); + test2 (); + test3 (); + test4 (); + test5 (); + test6 (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-lib.c new file mode 100644 index 000000000..cf3178c83 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-lib.c @@ -0,0 +1 @@ +#include "lib/mempcpy.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy.c b/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy.c new file mode 100644 index 000000000..d82e2232d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy.c @@ -0,0 +1,68 @@ +/* Copyright (C) 2003 Free Software Foundation. + + Ensure builtin mempcpy performs correctly. + + Written by Kaveh Ghazi, 4/11/2003. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern size_t strlen(const char *); +extern void *memcpy (void *, const void *, size_t); +extern void *mempcpy (void *, const void *, size_t); +extern int memcmp (const void *, const void *, size_t); +extern int inside_main; + +const char s1[] = "123"; +char p[32] = ""; +char *s2 = "defg"; +char *s3 = "FGH"; +size_t l1 = 1; + +void +main_test (void) +{ + int i; + +#if !defined __i386__ && !defined __x86_64__ + /* The functions below might not be optimized into direct stores on all + arches. It depends on how many instructions would be generated and + what limits the architecture chooses in STORE_BY_PIECES_P. */ + inside_main = 0; +#endif + + if (mempcpy (p, "ABCDE", 6) != p + 6 || memcmp (p, "ABCDE", 6)) + abort (); + if (mempcpy (p + 16, "VWX" + 1, 2) != p + 16 + 2 + || memcmp (p + 16, "WX\0\0", 5)) + abort (); + if (mempcpy (p + 1, "", 1) != p + 1 + 1 || memcmp (p, "A\0CDE", 6)) + abort (); + if (mempcpy (p + 3, "FGHI", 4) != p + 3 + 4 || memcmp (p, "A\0CFGHI", 8)) + abort (); + + i = 8; + memcpy (p + 20, "qrstu", 6); + memcpy (p + 25, "QRSTU", 6); + if (mempcpy (p + 25 + 1, s1, 3) != (p + 25 + 1 + 3) + || memcmp (p + 25, "Q123U", 6)) + abort (); + + if (mempcpy (mempcpy (p, "abcdEFG", 4), "efg", 4) != p + 8 + || memcmp (p, "abcdefg", 8)) + abort(); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + if (__builtin_mempcpy (p, "ABCDE", 6) != p + 6 || memcmp (p, "ABCDE", 6)) + abort (); + + /* If the result of mempcpy is ignored, gcc should use memcpy. + This should be optimized always, so set inside_main again. */ + inside_main = 1; + mempcpy (p + 5, s3, 1); + if (memcmp (p, "ABCDEFg", 8)) + abort (); + mempcpy (p + 6, s1 + 1, l1); + if (memcmp (p, "ABCDEF2", 8)) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memset-chk-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memset-chk-lib.c new file mode 100644 index 000000000..9daf13e82 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memset-chk-lib.c @@ -0,0 +1 @@ +#include "lib/chk.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memset-chk.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memset-chk.c new file mode 100644 index 000000000..902a88503 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memset-chk.c @@ -0,0 +1,721 @@ +/* Copyright (C) 2004, 2005 Free Software Foundation. + + Ensure builtin __memset_chk performs correctly. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern size_t strlen(const char *); +extern void *memcpy (void *, const void *, size_t); +extern void *memset (void *, int, size_t); +extern int memcmp (const void *, const void *, size_t); + +#include "chk.h" + +char buffer[32]; +int argc = 1; +volatile size_t l1 = 1; /* prevent constant propagation to happen when whole program assumptions are made. */ +volatile char *s3 = "FGH"; /* prevent constant propagation to happen when whole program assumptions are made. */ +char *s4; + +void +__attribute__((noinline)) +test1 (void) +{ + memset_disallowed = 1; + chk_calls = 0; + memset (buffer, argc, 0); + memset (buffer, argc, 1); + memset (buffer, argc, 2); + memset (buffer, argc, 3); + memset (buffer, argc, 4); + memset (buffer, argc, 5); + memset (buffer, argc, 6); + memset (buffer, argc, 7); + memset (buffer, argc, 8); + memset (buffer, argc, 9); + memset (buffer, argc, 10); + memset (buffer, argc, 11); + memset (buffer, argc, 12); + memset (buffer, argc, 13); + memset (buffer, argc, 14); + memset (buffer, argc, 15); + memset (buffer, argc, 16); + memset (buffer, argc, 17); + memset_disallowed = 0; + if (chk_calls) + abort (); +} + +/* Test whether compile time checking is done where it should + and so is runtime object size checking. */ +void +__attribute__((noinline)) +test2 (void) +{ + struct A { char buf1[10]; char buf2[10]; } a; + char *r = l1 == 1 ? &a.buf1[5] : &a.buf2[4]; + char buf3[20]; + int i; + size_t l; + + /* The following calls should do runtime checking + - length is not known, but destination is. */ + chk_calls = 0; + memset (a.buf1 + 2, 'a', l1); + memset (r, '\0', l1 + 1); + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + memset (r, argc, l1 + 2); + memset (r + 2, 'Q', l1); + r = buf3; + for (i = 0; i < 4; ++i) + { + if (i == l1 - 1) + r = &a.buf1[1]; + else if (i == l1) + r = &a.buf2[7]; + else if (i == l1 + 1) + r = &buf3[5]; + else if (i == l1 + 2) + r = &a.buf1[9]; + } + memset (r, '\0', l1); + if (chk_calls != 5) + abort (); + + /* Following have known destination and known length, + so if optimizing certainly shouldn't result in the checking + variants. */ + chk_calls = 0; + memset (a.buf1 + 2, '\0', 1); + memset (r, argc, 2); + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + memset (r, 'N', 3); + r = buf3; + l = 4; + for (i = 0; i < 4; ++i) + { + if (i == l1 - 1) + r = &a.buf1[1], l = 2; + else if (i == l1) + r = &a.buf2[7], l = 3; + else if (i == l1 + 1) + r = &buf3[5], l = 4; + else if (i == l1 + 2) + r = &a.buf1[9], l = 1; + } + memset (r, 'H', 1); + /* Here, l is known to be at most 4 and __builtin_object_size (&buf3[16], 0) + is 4, so this doesn't need runtime checking. */ + memset (&buf3[16], 'd', l); + /* Neither length nor destination known. Doesn't need runtime checking. */ + memset (s4, 'a', l1); + memset (s4 + 2, '\0', l1 + 2); + /* Destination unknown. */ + memset (s4 + 4, 'b', 2); + memset (s4 + 6, '\0', 4); + if (chk_calls) + abort (); + chk_calls = 0; +} + +/* Test whether runtime and/or compile time checking catches + buffer overflows. */ +void +__attribute__((noinline)) +test3 (void) +{ + struct A { char buf1[10]; char buf2[10]; } a; + char buf3[20]; + + chk_fail_allowed = 1; + /* Runtime checks. */ + if (__builtin_setjmp (chk_fail_buf) == 0) + { + memset (&a.buf2[9], '\0', l1 + 1); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + memset (&a.buf2[7], 'T', strlen (s3) + 1); + abort (); + } + /* This should be detectable at compile time already. */ + if (__builtin_setjmp (chk_fail_buf) == 0) + { + memset (&buf3[19], 'b', 2); + abort (); + } + chk_fail_allowed = 0; +} + +#ifndef MAX_OFFSET +#define MAX_OFFSET (sizeof (long long)) +#endif + +#ifndef MAX_COPY +#define MAX_COPY (10 * sizeof (long long)) +#define MAX_COPY2 15 +#else +#define MAX_COPY2 MAX_COPY +#endif + +#ifndef MAX_EXTRA +#define MAX_EXTRA (sizeof (long long)) +#endif + +#define MAX_LENGTH (MAX_OFFSET + MAX_COPY + MAX_EXTRA) +#define MAX_LENGTH2 (MAX_OFFSET + MAX_COPY2 + MAX_EXTRA) + +static union { + char buf[MAX_LENGTH]; + long long align_int; + long double align_fp; +} u; + +char A = 'A'; + +void +__attribute__((noinline)) +test4 (void) +{ + int off, len, i; + char *p, *q; + + for (off = 0; off < MAX_OFFSET; off++) + for (len = 1; len < MAX_COPY; len++) + { + for (i = 0; i < MAX_LENGTH; i++) + u.buf[i] = 'a'; + + p = memset (u.buf + off, '\0', len); + if (p != u.buf + off) + abort (); + + q = u.buf; + for (i = 0; i < off; i++, q++) + if (*q != 'a') + abort (); + + for (i = 0; i < len; i++, q++) + if (*q != '\0') + abort (); + + for (i = 0; i < MAX_EXTRA; i++, q++) + if (*q != 'a') + abort (); + + p = memset (u.buf + off, A, len); + if (p != u.buf + off) + abort (); + + q = u.buf; + for (i = 0; i < off; i++, q++) + if (*q != 'a') + abort (); + + for (i = 0; i < len; i++, q++) + if (*q != 'A') + abort (); + + for (i = 0; i < MAX_EXTRA; i++, q++) + if (*q != 'a') + abort (); + + p = memset (u.buf + off, 'B', len); + if (p != u.buf + off) + abort (); + + q = u.buf; + for (i = 0; i < off; i++, q++) + if (*q != 'a') + abort (); + + for (i = 0; i < len; i++, q++) + if (*q != 'B') + abort (); + + for (i = 0; i < MAX_EXTRA; i++, q++) + if (*q != 'a') + abort (); + } +} + +static union { + char buf[MAX_LENGTH2]; + long long align_int; + long double align_fp; +} u2; + +void reset () +{ + int i; + + for (i = 0; i < MAX_LENGTH2; i++) + u2.buf[i] = 'a'; +} + +void check (int off, int len, int ch) +{ + char *q; + int i; + + q = u2.buf; + for (i = 0; i < off; i++, q++) + if (*q != 'a') + abort (); + + for (i = 0; i < len; i++, q++) + if (*q != ch) + abort (); + + for (i = 0; i < MAX_EXTRA; i++, q++) + if (*q != 'a') + abort (); +} + +void +__attribute__((noinline)) +test5 (void) +{ + int off; + char *p; + + /* len == 1 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u2.buf + off, '\0', 1); + if (p != u2.buf + off) abort (); + check (off, 1, '\0'); + + p = memset (u2.buf + off, A, 1); + if (p != u2.buf + off) abort (); + check (off, 1, 'A'); + + p = memset (u2.buf + off, 'B', 1); + if (p != u2.buf + off) abort (); + check (off, 1, 'B'); + } + + /* len == 2 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u2.buf + off, '\0', 2); + if (p != u2.buf + off) abort (); + check (off, 2, '\0'); + + p = memset (u2.buf + off, A, 2); + if (p != u2.buf + off) abort (); + check (off, 2, 'A'); + + p = memset (u2.buf + off, 'B', 2); + if (p != u2.buf + off) abort (); + check (off, 2, 'B'); + } + + /* len == 3 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u2.buf + off, '\0', 3); + if (p != u2.buf + off) abort (); + check (off, 3, '\0'); + + p = memset (u2.buf + off, A, 3); + if (p != u2.buf + off) abort (); + check (off, 3, 'A'); + + p = memset (u2.buf + off, 'B', 3); + if (p != u2.buf + off) abort (); + check (off, 3, 'B'); + } + + /* len == 4 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u2.buf + off, '\0', 4); + if (p != u2.buf + off) abort (); + check (off, 4, '\0'); + + p = memset (u2.buf + off, A, 4); + if (p != u2.buf + off) abort (); + check (off, 4, 'A'); + + p = memset (u2.buf + off, 'B', 4); + if (p != u2.buf + off) abort (); + check (off, 4, 'B'); + } + + /* len == 5 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u2.buf + off, '\0', 5); + if (p != u2.buf + off) abort (); + check (off, 5, '\0'); + + p = memset (u2.buf + off, A, 5); + if (p != u2.buf + off) abort (); + check (off, 5, 'A'); + + p = memset (u2.buf + off, 'B', 5); + if (p != u2.buf + off) abort (); + check (off, 5, 'B'); + } + + /* len == 6 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u2.buf + off, '\0', 6); + if (p != u2.buf + off) abort (); + check (off, 6, '\0'); + + p = memset (u2.buf + off, A, 6); + if (p != u2.buf + off) abort (); + check (off, 6, 'A'); + + p = memset (u2.buf + off, 'B', 6); + if (p != u2.buf + off) abort (); + check (off, 6, 'B'); + } + + /* len == 7 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u2.buf + off, '\0', 7); + if (p != u2.buf + off) abort (); + check (off, 7, '\0'); + + p = memset (u2.buf + off, A, 7); + if (p != u2.buf + off) abort (); + check (off, 7, 'A'); + + p = memset (u2.buf + off, 'B', 7); + if (p != u2.buf + off) abort (); + check (off, 7, 'B'); + } + + /* len == 8 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u2.buf + off, '\0', 8); + if (p != u2.buf + off) abort (); + check (off, 8, '\0'); + + p = memset (u2.buf + off, A, 8); + if (p != u2.buf + off) abort (); + check (off, 8, 'A'); + + p = memset (u2.buf + off, 'B', 8); + if (p != u2.buf + off) abort (); + check (off, 8, 'B'); + } + + /* len == 9 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u2.buf + off, '\0', 9); + if (p != u2.buf + off) abort (); + check (off, 9, '\0'); + + p = memset (u2.buf + off, A, 9); + if (p != u2.buf + off) abort (); + check (off, 9, 'A'); + + p = memset (u2.buf + off, 'B', 9); + if (p != u2.buf + off) abort (); + check (off, 9, 'B'); + } + + /* len == 10 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u2.buf + off, '\0', 10); + if (p != u2.buf + off) abort (); + check (off, 10, '\0'); + + p = memset (u2.buf + off, A, 10); + if (p != u2.buf + off) abort (); + check (off, 10, 'A'); + + p = memset (u2.buf + off, 'B', 10); + if (p != u2.buf + off) abort (); + check (off, 10, 'B'); + } + + /* len == 11 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u2.buf + off, '\0', 11); + if (p != u2.buf + off) abort (); + check (off, 11, '\0'); + + p = memset (u2.buf + off, A, 11); + if (p != u2.buf + off) abort (); + check (off, 11, 'A'); + + p = memset (u2.buf + off, 'B', 11); + if (p != u2.buf + off) abort (); + check (off, 11, 'B'); + } + + /* len == 12 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u2.buf + off, '\0', 12); + if (p != u2.buf + off) abort (); + check (off, 12, '\0'); + + p = memset (u2.buf + off, A, 12); + if (p != u2.buf + off) abort (); + check (off, 12, 'A'); + + p = memset (u2.buf + off, 'B', 12); + if (p != u2.buf + off) abort (); + check (off, 12, 'B'); + } + + /* len == 13 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u2.buf + off, '\0', 13); + if (p != u2.buf + off) abort (); + check (off, 13, '\0'); + + p = memset (u2.buf + off, A, 13); + if (p != u2.buf + off) abort (); + check (off, 13, 'A'); + + p = memset (u2.buf + off, 'B', 13); + if (p != u2.buf + off) abort (); + check (off, 13, 'B'); + } + + /* len == 14 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u2.buf + off, '\0', 14); + if (p != u2.buf + off) abort (); + check (off, 14, '\0'); + + p = memset (u2.buf + off, A, 14); + if (p != u2.buf + off) abort (); + check (off, 14, 'A'); + + p = memset (u2.buf + off, 'B', 14); + if (p != u2.buf + off) abort (); + check (off, 14, 'B'); + } + + /* len == 15 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u2.buf + off, '\0', 15); + if (p != u2.buf + off) abort (); + check (off, 15, '\0'); + + p = memset (u2.buf + off, A, 15); + if (p != u2.buf + off) abort (); + check (off, 15, 'A'); + + p = memset (u2.buf + off, 'B', 15); + if (p != u2.buf + off) abort (); + check (off, 15, 'B'); + } +} + +void +__attribute__((noinline)) +test6 (void) +{ + int len; + char *p; + + /* off == 0 */ + for (len = 0; len < MAX_COPY2; len++) + { + reset (); + + p = memset (u2.buf, '\0', len); + if (p != u2.buf) abort (); + check (0, len, '\0'); + + p = memset (u2.buf, A, len); + if (p != u2.buf) abort (); + check (0, len, 'A'); + + p = memset (u2.buf, 'B', len); + if (p != u2.buf) abort (); + check (0, len, 'B'); + } + + /* off == 1 */ + for (len = 0; len < MAX_COPY2; len++) + { + reset (); + + p = memset (u2.buf+1, '\0', len); + if (p != u2.buf+1) abort (); + check (1, len, '\0'); + + p = memset (u2.buf+1, A, len); + if (p != u2.buf+1) abort (); + check (1, len, 'A'); + + p = memset (u2.buf+1, 'B', len); + if (p != u2.buf+1) abort (); + check (1, len, 'B'); + } + + /* off == 2 */ + for (len = 0; len < MAX_COPY2; len++) + { + reset (); + + p = memset (u2.buf+2, '\0', len); + if (p != u2.buf+2) abort (); + check (2, len, '\0'); + + p = memset (u2.buf+2, A, len); + if (p != u2.buf+2) abort (); + check (2, len, 'A'); + + p = memset (u2.buf+2, 'B', len); + if (p != u2.buf+2) abort (); + check (2, len, 'B'); + } + + /* off == 3 */ + for (len = 0; len < MAX_COPY2; len++) + { + reset (); + + p = memset (u2.buf+3, '\0', len); + if (p != u2.buf+3) abort (); + check (3, len, '\0'); + + p = memset (u2.buf+3, A, len); + if (p != u2.buf+3) abort (); + check (3, len, 'A'); + + p = memset (u2.buf+3, 'B', len); + if (p != u2.buf+3) abort (); + check (3, len, 'B'); + } + + /* off == 4 */ + for (len = 0; len < MAX_COPY2; len++) + { + reset (); + + p = memset (u2.buf+4, '\0', len); + if (p != u2.buf+4) abort (); + check (4, len, '\0'); + + p = memset (u2.buf+4, A, len); + if (p != u2.buf+4) abort (); + check (4, len, 'A'); + + p = memset (u2.buf+4, 'B', len); + if (p != u2.buf+4) abort (); + check (4, len, 'B'); + } + + /* off == 5 */ + for (len = 0; len < MAX_COPY2; len++) + { + reset (); + + p = memset (u2.buf+5, '\0', len); + if (p != u2.buf+5) abort (); + check (5, len, '\0'); + + p = memset (u2.buf+5, A, len); + if (p != u2.buf+5) abort (); + check (5, len, 'A'); + + p = memset (u2.buf+5, 'B', len); + if (p != u2.buf+5) abort (); + check (5, len, 'B'); + } + + /* off == 6 */ + for (len = 0; len < MAX_COPY2; len++) + { + reset (); + + p = memset (u2.buf+6, '\0', len); + if (p != u2.buf+6) abort (); + check (6, len, '\0'); + + p = memset (u2.buf+6, A, len); + if (p != u2.buf+6) abort (); + check (6, len, 'A'); + + p = memset (u2.buf+6, 'B', len); + if (p != u2.buf+6) abort (); + check (6, len, 'B'); + } + + /* off == 7 */ + for (len = 0; len < MAX_COPY2; len++) + { + reset (); + + p = memset (u2.buf+7, '\0', len); + if (p != u2.buf+7) abort (); + check (7, len, '\0'); + + p = memset (u2.buf+7, A, len); + if (p != u2.buf+7) abort (); + check (7, len, 'A'); + + p = memset (u2.buf+7, 'B', len); + if (p != u2.buf+7) abort (); + check (7, len, 'B'); + } +} + +void +main_test (void) +{ +#ifndef __OPTIMIZE__ + /* Object size checking is only intended for -O[s123]. */ + return; +#endif + __asm ("" : "=r" (l1) : "0" (l1)); + s4 = buffer; + test1 (); + test2 (); + test3 (); + test4 (); + test5 (); + test6 (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memset-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memset-lib.c new file mode 100644 index 000000000..2eeff38be --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memset-lib.c @@ -0,0 +1 @@ +#include "lib/memset.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memset.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memset.c new file mode 100644 index 000000000..cf7c1e303 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memset.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation. + + Ensure that builtin memset operations for constant length and + non-constant assigned value don't cause compiler problems. + + Written by Roger Sayle, 21 April 2002. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern void *memset (void *, int, size_t); + +char buffer[32]; +int argc = 1; + +void +main_test (void) +{ + memset (buffer, argc, 0); + memset (buffer, argc, 1); + memset (buffer, argc, 2); + memset (buffer, argc, 3); + memset (buffer, argc, 4); + memset (buffer, argc, 5); + memset (buffer, argc, 6); + memset (buffer, argc, 7); + memset (buffer, argc, 8); + memset (buffer, argc, 9); + memset (buffer, argc, 10); + memset (buffer, argc, 11); + memset (buffer, argc, 12); + memset (buffer, argc, 13); + memset (buffer, argc, 14); + memset (buffer, argc, 15); + memset (buffer, argc, 16); + memset (buffer, argc, 17); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/pr22237-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/pr22237-lib.c new file mode 100644 index 000000000..440323574 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/pr22237-lib.c @@ -0,0 +1,27 @@ +extern void abort (void); + +void * +memcpy (void *dst, const void *src, __SIZE_TYPE__ n) +{ + const char *srcp; + char *dstp; + + srcp = src; + dstp = dst; + + if (dst < src) + { + if (dst + n > src) + abort (); + } + else + { + if (src + n > dst) + abort (); + } + + while (n-- != 0) + *dstp++ = *srcp++; + + return dst; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/pr22237.c b/gcc/testsuite/gcc.c-torture/execute/builtins/pr22237.c new file mode 100644 index 000000000..957a47c0f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/pr22237.c @@ -0,0 +1,44 @@ +extern void abort (void); +extern void exit (int); +struct s { unsigned char a[256]; }; +union u { struct { struct s b; int c; } d; struct { int c; struct s b; } e; }; +static union u v; +static union u v0; +static struct s *p = &v.d.b; +static struct s *q = &v.e.b; + +static inline struct s rp (void) { return *p; } +static inline struct s rq (void) { return *q; } +static void pq (void) { *p = rq(); } +static void qp (void) { *q = rp(); } + +static void +init (struct s *sp) +{ + int i; + for (i = 0; i < 256; i++) + sp->a[i] = i; +} + +static void +check (struct s *sp) +{ + int i; + for (i = 0; i < 256; i++) + if (sp->a[i] != i) + abort (); +} + +void +main_test (void) +{ + v = v0; + init (p); + qp (); + check (q); + v = v0; + init (q); + pq (); + check (p); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/pr23484-chk-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/pr23484-chk-lib.c new file mode 100644 index 000000000..9daf13e82 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/pr23484-chk-lib.c @@ -0,0 +1 @@ +#include "lib/chk.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/pr23484-chk.c b/gcc/testsuite/gcc.c-torture/execute/builtins/pr23484-chk.c new file mode 100644 index 000000000..446fb6c2f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/pr23484-chk.c @@ -0,0 +1,67 @@ +/* PR middle-end/23484 */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern size_t strlen (const char *); +extern void *memcpy (void *, const void *, size_t); +extern void *mempcpy (void *, const void *, size_t); +extern void *memmove (void *, const void *, size_t); +extern int snprintf (char *, size_t, const char *, ...); +extern int memcmp (const void *, const void *, size_t); + +#include "chk.h" + +static char data[8] = "ABCDEFG"; + +int l1; + +void +__attribute__((noinline)) +test1 (void) +{ + char buf[8]; + + /* All the checking calls in this routine have a maximum length, so + object size checking should be done at compile time if optimizing. */ + chk_calls = 0; + + memset (buf, 'I', sizeof (buf)); + if (memcpy (buf, data, l1 ? sizeof (buf) : 4) != buf + || memcmp (buf, "ABCDIIII", 8)) + abort (); + + memset (buf, 'J', sizeof (buf)); + if (mempcpy (buf, data, l1 ? sizeof (buf) : 4) != buf + 4 + || memcmp (buf, "ABCDJJJJ", 8)) + abort (); + + memset (buf, 'K', sizeof (buf)); + if (memmove (buf, data, l1 ? sizeof (buf) : 4) != buf + || memcmp (buf, "ABCDKKKK", 8)) + abort (); + + memset (buf, 'L', sizeof (buf)); +#if(__SIZEOF_INT__ >= 4) + if (snprintf (buf, l1 ? sizeof (buf) : 4, "%d", l1 + 65536) != 5 + || memcmp (buf, "655\0LLLL", 8)) + abort (); +#else + if (snprintf (buf, l1 ? sizeof (buf) : 4, "%d", l1 + 32700) != 5 + || memcmp (buf, "327\0LLLL", 8)) + abort (); +#endif + + if (chk_calls) + abort (); +} + +void +main_test (void) +{ +#ifndef __OPTIMIZE__ + /* Object size checking is only intended for -O[s123]. */ + return; +#endif + __asm ("" : "=r" (l1) : "0" (l1)); + test1 (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/printf-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/printf-lib.c new file mode 100644 index 000000000..45ed7ec37 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/printf-lib.c @@ -0,0 +1 @@ +#include "lib/printf.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/printf.c b/gcc/testsuite/gcc.c-torture/execute/builtins/printf.c new file mode 100644 index 000000000..e493f90b7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/printf.c @@ -0,0 +1,52 @@ +/* Copyright (C) 2000 Free Software Foundation. + + Ensure all expected transformations of builtin printf occur and + that we honor side effects in the arguments. + + Written by Kaveh R. Ghazi, 12/4/2000. */ + +extern int printf (const char *, ...); +extern int printf_unlocked (const char *, ...); +extern void abort(void); + +void +main_test (void) +{ + const char *const s1 = "hello world"; + const char *const s2[] = { s1, 0 }, *const*s3; + + printf ("%s\n", "hello"); + printf ("%s\n", *s2); + s3 = s2; + printf ("%s\n", *s3++); + if (s3 != s2+1 || *s3 != 0) + abort(); + + printf ("%c", '\n'); + printf ("%c", **s2); + s3 = s2; + printf ("%c", **s3++); + if (s3 != s2+1 || *s3 != 0) + abort(); + + printf (""); + printf ("%s", ""); + printf ("\n"); + printf ("%s", "\n"); + printf ("hello world\n"); + printf ("%s", "hello world\n"); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + __builtin_printf ("%s\n", "hello"); + /* These builtin stubs are called by __builtin_printf, ensure their + prototypes are set correctly too. */ + __builtin_putchar ('\n'); + __builtin_puts ("hello"); + /* Check the unlocked style, these evaluate to nothing to avoid + problems on systems without the unlocked functions. */ + printf_unlocked (""); + __builtin_printf_unlocked (""); + printf_unlocked ("%s", ""); + __builtin_printf_unlocked ("%s", ""); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/snprintf-chk-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/snprintf-chk-lib.c new file mode 100644 index 000000000..9daf13e82 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/snprintf-chk-lib.c @@ -0,0 +1 @@ +#include "lib/chk.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/snprintf-chk.c b/gcc/testsuite/gcc.c-torture/execute/builtins/snprintf-chk.c new file mode 100644 index 000000000..b244f8925 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/snprintf-chk.c @@ -0,0 +1,220 @@ +/* Copyright (C) 2004, 2005 Free Software Foundation. + + Ensure builtin __snprintf_chk performs correctly. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern size_t strlen(const char *); +extern void *memcpy (void *, const void *, size_t); +extern char *strcpy (char *, const char *); +extern int memcmp (const void *, const void *, size_t); +extern void *memset (void *, int, size_t); +extern int sprintf (char *, const char *, ...); +extern int snprintf (char *, size_t, const char *, ...); + +#include "chk.h" + +const char s1[] = "123"; +char p[32] = ""; +char *s2 = "defg"; +char *s3 = "FGH"; +char *s4; +size_t l1 = 1; +static char buffer[32]; +char * volatile ptr = "barf"; /* prevent constant propagation to happen when whole program assumptions are made. */ + +void +__attribute__((noinline)) +test1 (void) +{ + chk_calls = 0; + /* snprintf_disallowed = 1; */ + + memset (buffer, 'A', 32); + snprintf (buffer, 4, "foo"); + if (memcmp (buffer, "foo", 4) || buffer[4] != 'A') + abort (); + + memset (buffer, 'A', 32); + if (snprintf (buffer, 4, "foo bar") != 7) + abort (); + if (memcmp (buffer, "foo", 4) || buffer[4] != 'A') + abort (); + + memset (buffer, 'A', 32); + snprintf (buffer, 32, "%s", "bar"); + if (memcmp (buffer, "bar", 4) || buffer[4] != 'A') + abort (); + + memset (buffer, 'A', 32); + if (snprintf (buffer, 21, "%s", "bar") != 3) + abort (); + if (memcmp (buffer, "bar", 4) || buffer[4] != 'A') + abort (); + + snprintf_disallowed = 0; + + memset (buffer, 'A', 32); + if (snprintf (buffer, 4, "%d%d%d", (int) l1, (int) l1 + 1, (int) l1 + 12) + != 4) + abort (); + if (memcmp (buffer, "121", 4) || buffer[4] != 'A') + abort (); + + memset (buffer, 'A', 32); + if (snprintf (buffer, 32, "%d%d%d", (int) l1, (int) l1 + 1, (int) l1 + 12) + != 4) + abort (); + if (memcmp (buffer, "1213", 5) || buffer[5] != 'A') + abort (); + + if (chk_calls) + abort (); + + memset (buffer, 'A', 32); + snprintf (buffer, strlen (ptr) + 1, "%s", ptr); + if (memcmp (buffer, "barf", 5) || buffer[5] != 'A') + abort (); + + memset (buffer, 'A', 32); + snprintf (buffer, l1 + 31, "%d - %c", (int) l1 + 27, *ptr); + if (memcmp (buffer, "28 - b\0AAAAA", 12)) + abort (); + + if (chk_calls != 2) + abort (); + chk_calls = 0; + + memset (s4, 'A', 32); + snprintf (s4, l1 + 6, "%d - %c", (int) l1 - 17, ptr[1]); + if (memcmp (s4, "-16 - \0AAA", 10)) + abort (); + if (chk_calls) + abort (); +} + +/* Test whether compile time checking is done where it should + and so is runtime object size checking. */ +void +__attribute__((noinline)) +test2 (void) +{ + struct A { char buf1[10]; char buf2[10]; } a; + char *r = l1 == 1 ? &a.buf1[5] : &a.buf2[4]; + char buf3[20]; + int i; + + /* The following calls should do runtime checking + - length is not known, but destination is. */ + chk_calls = 0; + snprintf (a.buf1 + 2, l1, "%s", s3 + 3); + snprintf (r, l1 + 4, "%s%c", s3 + 3, s3[3]); + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + snprintf (r, strlen (s2) - 2, "%c %s", s2[2], s2 + 4); + snprintf (r + 2, l1, s3 + 3); + r = buf3; + for (i = 0; i < 4; ++i) + { + if (i == l1 - 1) + r = &a.buf1[1]; + else if (i == l1) + r = &a.buf2[7]; + else if (i == l1 + 1) + r = &buf3[5]; + else if (i == l1 + 2) + r = &a.buf1[9]; + } + snprintf (r, l1, s2 + 4); + if (chk_calls != 5) + abort (); + + /* Following have known destination and known source length, + so if optimizing certainly shouldn't result in the checking + variants. */ + chk_calls = 0; + /* snprintf_disallowed = 1; */ + snprintf (a.buf1 + 2, 4, ""); + snprintf (r, 1, "a"); + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + snprintf (r, 3, "%s", s1 + 1); + r = buf3; + for (i = 0; i < 4; ++i) + { + if (i == l1 - 1) + r = &a.buf1[1]; + else if (i == l1) + r = &a.buf2[7]; + else if (i == l1 + 1) + r = &buf3[5]; + else if (i == l1 + 2) + r = &a.buf1[9]; + } + snprintf (r, 1, "%s", ""); + snprintf (r, 0, "%s", ""); + snprintf_disallowed = 0; + /* Unknown destination and source, no checking. */ + snprintf (s4, l1 + 31, "%s %d", s3, 0); + if (chk_calls) + abort (); +} + +/* Test whether runtime and/or compile time checking catches + buffer overflows. */ +void +__attribute__((noinline)) +test3 (void) +{ + struct A { char buf1[10]; char buf2[10]; } a; + char buf3[20]; + + chk_fail_allowed = 1; + /* Runtime checks. */ + if (__builtin_setjmp (chk_fail_buf) == 0) + { + snprintf (&a.buf2[9], l1 + 1, "%c%s", s2[3], s2 + 4); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + snprintf (&a.buf2[7], l1 + 30, "%s%c", s3 + strlen (s3) - 2, *s3); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + snprintf (&a.buf2[7], l1 + 3, "%d", (int) l1 + 9999); + abort (); + } + /* This should be detectable at compile time already. */ + if (__builtin_setjmp (chk_fail_buf) == 0) + { + snprintf (&buf3[19], 2, "a"); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + snprintf (&buf3[17], 4, "a"); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + snprintf (&buf3[17], 4, "%s", "abc"); + abort (); + } + chk_fail_allowed = 0; +} + +void +main_test (void) +{ +#ifndef __OPTIMIZE__ + /* Object size checking is only intended for -O[s123]. */ + return; +#endif + __asm ("" : "=r" (s2) : "0" (s2)); + __asm ("" : "=r" (s3) : "0" (s3)); + __asm ("" : "=r" (l1) : "0" (l1)); + s4 = p; + test1 (); + test2 (); + test3 (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/sprintf-chk-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/sprintf-chk-lib.c new file mode 100644 index 000000000..9daf13e82 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/sprintf-chk-lib.c @@ -0,0 +1 @@ +#include "lib/chk.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/sprintf-chk.c b/gcc/testsuite/gcc.c-torture/execute/builtins/sprintf-chk.c new file mode 100644 index 000000000..8a283626d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/sprintf-chk.c @@ -0,0 +1,197 @@ +/* Copyright (C) 2004, 2005 Free Software Foundation. + + Ensure builtin __sprintf_chk performs correctly. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern size_t strlen(const char *); +extern void *memcpy (void *, const void *, size_t); +extern char *strcpy (char *, const char *); +extern int memcmp (const void *, const void *, size_t); +extern void *memset (void *, int, size_t); +extern int sprintf (char *, const char *, ...); + +#include "chk.h" + +LOCAL const char s1[] = "123"; +char p[32] = ""; +char *s2 = "defg"; +char *s3 = "FGH"; +char *s4; +size_t l1 = 1; +static char buffer[32]; +char * volatile ptr = "barf"; /* prevent constant propagation to happen when whole program assumptions are made. */ + +void +__attribute__((noinline)) +test1 (void) +{ + chk_calls = 0; + sprintf_disallowed = 1; + + memset (buffer, 'A', 32); + sprintf (buffer, "foo"); + if (memcmp (buffer, "foo", 4) || buffer[4] != 'A') + abort (); + + memset (buffer, 'A', 32); + if (sprintf (buffer, "foo") != 3) + abort (); + if (memcmp (buffer, "foo", 4) || buffer[4] != 'A') + abort (); + + memset (buffer, 'A', 32); + sprintf (buffer, "%s", "bar"); + if (memcmp (buffer, "bar", 4) || buffer[4] != 'A') + abort (); + + memset (buffer, 'A', 32); + if (sprintf (buffer, "%s", "bar") != 3) + abort (); + if (memcmp (buffer, "bar", 4) || buffer[4] != 'A') + abort (); + + if (chk_calls) + abort (); + sprintf_disallowed = 0; + + memset (buffer, 'A', 32); + sprintf (buffer, "%s", ptr); + if (memcmp (buffer, "barf", 5) || buffer[5] != 'A') + abort (); + + memset (buffer, 'A', 32); + sprintf (buffer, "%d - %c", (int) l1 + 27, *ptr); + if (memcmp (buffer, "28 - b\0AAAAA", 12)) + abort (); + + if (chk_calls != 2) + abort (); + chk_calls = 0; + + sprintf (s4, "%d - %c", (int) l1 - 17, ptr[1]); + if (memcmp (s4, "-16 - a", 8)) + abort (); + if (chk_calls) + abort (); +} + +/* Test whether compile time checking is done where it should + and so is runtime object size checking. */ +void +__attribute__((noinline)) +test2 (void) +{ + struct A { char buf1[10]; char buf2[10]; } a; + char *r = l1 == 1 ? &a.buf1[5] : &a.buf2[4]; + char buf3[20]; + int i; + + /* The following calls should do runtime checking + - source length is not known, but destination is. */ + chk_calls = 0; + sprintf (a.buf1 + 2, "%s", s3 + 3); + sprintf (r, "%s%c", s3 + 3, s3[3]); + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + sprintf (r, "%c %s", s2[2], s2 + 4); + sprintf (r + 2, s3 + 3); + r = buf3; + for (i = 0; i < 4; ++i) + { + if (i == l1 - 1) + r = &a.buf1[1]; + else if (i == l1) + r = &a.buf2[7]; + else if (i == l1 + 1) + r = &buf3[5]; + else if (i == l1 + 2) + r = &a.buf1[9]; + } + sprintf (r, s2 + 4); + if (chk_calls != 5) + abort (); + + /* Following have known destination and known source length, + so if optimizing certainly shouldn't result in the checking + variants. */ + chk_calls = 0; + sprintf_disallowed = 1; + sprintf (a.buf1 + 2, ""); + sprintf (r, "a"); + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + sprintf (r, "%s", s1 + 1); + r = buf3; + for (i = 0; i < 4; ++i) + { + if (i == l1 - 1) + r = &a.buf1[1]; + else if (i == l1) + r = &a.buf2[7]; + else if (i == l1 + 1) + r = &buf3[5]; + else if (i == l1 + 2) + r = &a.buf1[9]; + } + sprintf (r, "%s", ""); + sprintf_disallowed = 0; + /* Unknown destination and source, no checking. */ + sprintf (s4, "%s %d", s3, 0); + if (chk_calls) + abort (); +} + +/* Test whether runtime and/or compile time checking catches + buffer overflows. */ +void +__attribute__((noinline)) +test3 (void) +{ + struct A { char buf1[10]; char buf2[10]; } a; + char buf3[20]; + + chk_fail_allowed = 1; + /* Runtime checks. */ + if (__builtin_setjmp (chk_fail_buf) == 0) + { + sprintf (&a.buf2[9], "%c%s", s2[3], s2 + 4); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + sprintf (&a.buf2[7], "%s%c", s3 + strlen (s3) - 2, *s3); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + sprintf (&a.buf2[7], "%d", (int) l1 + 9999); + abort (); + } + /* This should be detectable at compile time already. */ + if (__builtin_setjmp (chk_fail_buf) == 0) + { + sprintf (&buf3[19], "a"); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + sprintf (&buf3[17], "%s", "abc"); + abort (); + } + chk_fail_allowed = 0; +} + +void +main_test (void) +{ +#ifndef __OPTIMIZE__ + /* Object size checking is only intended for -O[s123]. */ + return; +#endif + __asm ("" : "=r" (s2) : "0" (s2)); + __asm ("" : "=r" (s3) : "0" (s3)); + __asm ("" : "=r" (l1) : "0" (l1)); + s4 = p; + test1 (); + test2 (); + test3 (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/sprintf-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/sprintf-lib.c new file mode 100644 index 000000000..3a4fe34c0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/sprintf-lib.c @@ -0,0 +1 @@ +#include "lib/sprintf.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/sprintf.c b/gcc/testsuite/gcc.c-torture/execute/builtins/sprintf.c new file mode 100644 index 000000000..b45926469 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/sprintf.c @@ -0,0 +1,71 @@ +/* Copyright (C) 2003 Free Software Foundation. + + Test sprintf optimizations don't break anything and return the + correct results. + + Written by Roger Sayle, June 22, 2003. */ + +static char buffer[32]; + +extern void abort (); +typedef __SIZE_TYPE__ size_t; +extern int sprintf(char*, const char*, ...); +extern void *memset(void*, int, size_t); +extern int memcmp(const void*, const void*, size_t); + +void test1() +{ + sprintf(buffer,"foo"); +} + +int test2() +{ + return sprintf(buffer,"foo"); +} + +void test3() +{ + sprintf(buffer,"%s","bar"); +} + +int test4() +{ + return sprintf(buffer,"%s","bar"); +} + +void test5(char *ptr) +{ + sprintf(buffer,"%s",ptr); +} + + +void +main_test (void) +{ + memset (buffer, 'A', 32); + test1 (); + if (memcmp(buffer, "foo", 4) || buffer[4] != 'A') + abort (); + + memset (buffer, 'A', 32); + if (test2 () != 3) + abort (); + if (memcmp(buffer, "foo", 4) || buffer[4] != 'A') + abort (); + + memset (buffer, 'A', 32); + test3 (); + if (memcmp(buffer, "bar", 4) || buffer[4] != 'A') + abort (); + + memset (buffer, 'A', 32); + if (test4 () != 3) + abort (); + if (memcmp(buffer, "bar", 4) || buffer[4] != 'A') + abort (); + + memset (buffer, 'A', 32); + test5 ("barf"); + if (memcmp(buffer, "barf", 5) || buffer[5] != 'A') + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/stpcpy-chk-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/stpcpy-chk-lib.c new file mode 100644 index 000000000..9daf13e82 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/stpcpy-chk-lib.c @@ -0,0 +1 @@ +#include "lib/chk.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/stpcpy-chk.c b/gcc/testsuite/gcc.c-torture/execute/builtins/stpcpy-chk.c new file mode 100644 index 000000000..6091f1293 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/stpcpy-chk.c @@ -0,0 +1,265 @@ +/* Copyright (C) 2004, 2005 Free Software Foundation. + + Ensure builtin __stpcpy_chk performs correctly. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern size_t strlen(const char *); +extern void *memcpy (void *, const void *, size_t); +extern char *stpcpy (char *, const char *); +extern int memcmp (const void *, const void *, size_t); + +#include "chk.h" + +LOCAL const char s1[] = "123"; +char p[32] = ""; +char *s2 = "defg"; +char *s3 = "FGH"; +char *s4; +size_t l1 = 1; + +void +__attribute__((noinline)) +test1 (void) +{ + int i = 8; + +#if defined __i386__ || defined __x86_64__ + /* The functions below might not be optimized into direct stores on all + arches. It depends on how many instructions would be generated and + what limits the architecture chooses in STORE_BY_PIECES_P. */ + stpcpy_disallowed = 1; +#endif + if (stpcpy (p, "abcde") != p + 5 || memcmp (p, "abcde", 6)) + abort (); + if (stpcpy (p + 16, "vwxyz" + 1) != p + 16 + 4 || memcmp (p + 16, "wxyz", 5)) + abort (); + if (stpcpy (p + 1, "") != p + 1 + 0 || memcmp (p, "a\0cde", 6)) + abort (); + if (stpcpy (p + 3, "fghij") != p + 3 + 5 || memcmp (p, "a\0cfghij", 9)) + abort (); + + if (stpcpy ((i++, p + 20 + 1), "23") != (p + 20 + 1 + 2) + || i != 9 || memcmp (p + 19, "z\0""23\0", 5)) + abort (); + + if (stpcpy (stpcpy (p, "ABCD"), "EFG") != p + 7 || memcmp (p, "ABCDEFG", 8)) + abort(); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + if (__builtin_stpcpy (p, "abcde") != p + 5 || memcmp (p, "abcde", 6)) + abort (); + + /* If return value of stpcpy is ignored, it should be optimized into + strcpy call. */ + stpcpy_disallowed = 1; + stpcpy (p + 1, "abcd"); + stpcpy_disallowed = 0; + if (memcmp (p, "aabcd", 6)) + abort (); + + if (chk_calls) + abort (); + + chk_calls = 0; + strcpy_disallowed = 1; + if (stpcpy (p, s2) != p + 4 || memcmp (p, "defg\0", 6)) + abort (); + strcpy_disallowed = 0; + stpcpy_disallowed = 1; + stpcpy (p + 2, s3); + stpcpy_disallowed = 0; + if (memcmp (p, "deFGH", 6)) + abort (); + if (chk_calls != 2) + abort (); +} + +#ifndef MAX_OFFSET +#define MAX_OFFSET (sizeof (long long)) +#endif + +#ifndef MAX_COPY +#define MAX_COPY (10 * sizeof (long long)) +#endif + +#ifndef MAX_EXTRA +#define MAX_EXTRA (sizeof (long long)) +#endif + +#define MAX_LENGTH (MAX_OFFSET + MAX_COPY + 1 + MAX_EXTRA) + +/* Use a sequence length that is not divisible by two, to make it more + likely to detect when words are mixed up. */ +#define SEQUENCE_LENGTH 31 + +static union { + char buf[MAX_LENGTH]; + long long align_int; + long double align_fp; +} u1, u2; + +volatile char *vx; + +void +__attribute__((noinline)) +test2 (void) +{ + int off1, off2, len, i; + char *p, *q, c; + + for (off1 = 0; off1 < MAX_OFFSET; off1++) + for (off2 = 0; off2 < MAX_OFFSET; off2++) + for (len = 1; len < MAX_COPY; len++) + { + for (i = 0, c = 'A'; i < MAX_LENGTH; i++, c++) + { + u1.buf[i] = 'a'; + if (c >= 'A' + SEQUENCE_LENGTH) + c = 'A'; + u2.buf[i] = c; + } + u2.buf[off2 + len] = '\0'; + + p = stpcpy (u1.buf + off1, u2.buf + off2); + if (p != u1.buf + off1 + len) + abort (); + + q = u1.buf; + for (i = 0; i < off1; i++, q++) + if (*q != 'a') + abort (); + + for (i = 0, c = 'A' + off2; i < len; i++, q++, c++) + { + if (c >= 'A' + SEQUENCE_LENGTH) + c = 'A'; + if (*q != c) + abort (); + } + + if (*q++ != '\0') + abort (); + for (i = 0; i < MAX_EXTRA; i++, q++) + if (*q != 'a') + abort (); + } +} + +/* Test whether compile time checking is done where it should + and so is runtime object size checking. */ +void +__attribute__((noinline)) +test3 (void) +{ + struct A { char buf1[10]; char buf2[10]; } a; + char *r = l1 == 1 ? &a.buf1[5] : &a.buf2[4]; + char buf3[20]; + int i; + const char *l; + + /* The following calls should do runtime checking + - source length is not known, but destination is. */ + chk_calls = 0; + vx = stpcpy (a.buf1 + 2, s3 + 3); + vx = stpcpy (r, s3 + 2); + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + vx = stpcpy (r, s2 + 2); + vx = stpcpy (r + 2, s3 + 3); + r = buf3; + for (i = 0; i < 4; ++i) + { + if (i == l1 - 1) + r = &a.buf1[1]; + else if (i == l1) + r = &a.buf2[7]; + else if (i == l1 + 1) + r = &buf3[5]; + else if (i == l1 + 2) + r = &a.buf1[9]; + } + vx = stpcpy (r, s2 + 4); + if (chk_calls != 5) + abort (); + + /* Following have known destination and known source length, + so if optimizing certainly shouldn't result in the checking + variants. */ + chk_calls = 0; + vx = stpcpy (a.buf1 + 2, ""); + vx = stpcpy (r, "a"); + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + vx = stpcpy (r, s1 + 1); + r = buf3; + l = "abc"; + for (i = 0; i < 4; ++i) + { + if (i == l1 - 1) + r = &a.buf1[1], l = "e"; + else if (i == l1) + r = &a.buf2[7], l = "gh"; + else if (i == l1 + 1) + r = &buf3[5], l = "jkl"; + else if (i == l1 + 2) + r = &a.buf1[9], l = ""; + } + vx = stpcpy (r, ""); + /* Here, strlen (l) + 1 is known to be at most 4 and + __builtin_object_size (&buf3[16], 0) is 4, so this doesn't need + runtime checking. */ + vx = stpcpy (&buf3[16], l); + /* Unknown destination and source, no checking. */ + vx = stpcpy (s4, s3); + stpcpy (s4 + 4, s3); + if (chk_calls) + abort (); + chk_calls = 0; +} + +/* Test whether runtime and/or compile time checking catches + buffer overflows. */ +void +__attribute__((noinline)) +test4 (void) +{ + struct A { char buf1[10]; char buf2[10]; } a; + char buf3[20]; + + chk_fail_allowed = 1; + /* Runtime checks. */ + if (__builtin_setjmp (chk_fail_buf) == 0) + { + vx = stpcpy (&a.buf2[9], s2 + 3); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + vx = stpcpy (&a.buf2[7], s3 + strlen (s3) - 3); + abort (); + } + /* This should be detectable at compile time already. */ + if (__builtin_setjmp (chk_fail_buf) == 0) + { + vx = stpcpy (&buf3[19], "a"); + abort (); + } + chk_fail_allowed = 0; +} + +void +main_test (void) +{ +#ifndef __OPTIMIZE__ + /* Object size checking is only intended for -O[s123]. */ + return; +#endif + __asm ("" : "=r" (s2) : "0" (s2)); + __asm ("" : "=r" (s3) : "0" (s3)); + __asm ("" : "=r" (l1) : "0" (l1)); + test1 (); + s4 = p; + test2 (); + test3 (); + test4 (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strcat-chk-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strcat-chk-lib.c new file mode 100644 index 000000000..9daf13e82 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strcat-chk-lib.c @@ -0,0 +1 @@ +#include "lib/chk.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strcat-chk.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strcat-chk.c new file mode 100644 index 000000000..fea3184e8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strcat-chk.c @@ -0,0 +1,204 @@ +/* Copyright (C) 2004, 2005 Free Software Foundation. + + Ensure builtin __strcat_chk performs correctly. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern size_t strlen(const char *); +extern void *memcpy (void *, const void *, size_t); +extern char *strcat (char *, const char *); +extern int memcmp (const void *, const void *, size_t); +extern char *strcpy (char *, const char *); +extern int strcmp (const char *, const char *); +extern void *memset (void *, int, size_t); +#define RESET_DST_WITH(FILLER) \ + do { memset (dst, 'X', sizeof (dst)); strcpy (dst, (FILLER)); } while (0) + +#include "chk.h" + +const char s1[] = "123"; +char p[32] = ""; +char *s2 = "defg"; +char *s3 = "FGH"; +char *s4; +size_t l1 = 1; +char *s5; + +void +__attribute__((noinline)) +test1 (void) +{ + const char *const x1 = "hello world"; + const char *const x2 = ""; + char dst[64], *d2; + + chk_calls = 0; + strcat_disallowed = 1; + /* Following strcat calls should be optimized out at compile time. */ + RESET_DST_WITH (x1); + if (strcat (dst, "") != dst || strcmp (dst, x1)) + abort (); + RESET_DST_WITH (x1); + if (strcat (dst, x2) != dst || strcmp (dst, x1)) + abort (); + RESET_DST_WITH (x1); d2 = dst; + if (strcat (++d2, x2) != dst+1 || d2 != dst+1 || strcmp (dst, x1)) + abort (); + RESET_DST_WITH (x1); d2 = dst; + if (strcat (++d2+5, x2) != dst+6 || d2 != dst+1 || strcmp (dst, x1)) + abort (); + RESET_DST_WITH (x1); d2 = dst; + if (strcat (++d2+5, x1+11) != dst+6 || d2 != dst+1 || strcmp (dst, x1)) + abort (); + if (chk_calls) + abort (); + strcat_disallowed = 0; + + RESET_DST_WITH (x1); + if (strcat (dst, " 1111") != dst + || memcmp (dst, "hello world 1111\0XXX", 20)) + abort (); + + RESET_DST_WITH (x1); + if (strcat (dst+5, " 2222") != dst+5 + || memcmp (dst, "hello world 2222\0XXX", 20)) + abort (); + + RESET_DST_WITH (x1); d2 = dst; + if (strcat (++d2+5, " 3333") != dst+6 || d2 != dst+1 + || memcmp (dst, "hello world 3333\0XXX", 20)) + abort (); + + RESET_DST_WITH (x1); + strcat (strcat (strcat (strcat (strcat (strcat (dst, ": this "), ""), + "is "), "a "), "test"), "."); + if (memcmp (dst, "hello world: this is a test.\0X", 30)) + abort (); + + chk_calls = 0; + strcat_disallowed = 1; + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + RESET_DST_WITH (x1); + if (__builtin_strcat (dst, "") != dst || strcmp (dst, x1)) + abort (); + if (chk_calls) + abort (); + strcat_disallowed = 0; +} + + +/* Test whether compile time checking is done where it should + and so is runtime object size checking. */ +void +__attribute__((noinline)) +test2 (void) +{ + struct A { char buf1[10]; char buf2[10]; } a; + char *r = l1 == 1 ? &a.buf1[5] : &a.buf2[4]; + char buf3[20]; + int i; + + /* The following calls should do runtime checking + - source length is not known, but destination is. */ + memset (&a, '\0', sizeof (a)); + s5 = (char *) &a; + __asm __volatile ("" : : "r" (s5) : "memory"); + chk_calls = 0; + strcat (a.buf1 + 2, s3 + 3); + strcat (r, s3 + 2); + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + memset (r, '\0', 3); + __asm __volatile ("" : : "r" (r) : "memory"); + strcat (r, s2 + 2); + strcat (r + 2, s3 + 3); + r = buf3; + for (i = 0; i < 4; ++i) + { + if (i == l1 - 1) + r = &a.buf1[1]; + else if (i == l1) + r = &a.buf2[7]; + else if (i == l1 + 1) + r = &buf3[5]; + else if (i == l1 + 2) + r = &a.buf1[9]; + } + strcat (r, s2 + 4); + if (chk_calls != 5) + abort (); + + /* Following have known destination and known source length, + but we don't know the length of dest string, so runtime checking + is needed too. */ + memset (&a, '\0', sizeof (a)); + chk_calls = 0; + s5 = (char *) &a; + __asm __volatile ("" : : "r" (s5) : "memory"); + strcat (a.buf1 + 2, "a"); + strcat (r, ""); + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + memset (r, '\0', 3); + __asm __volatile ("" : : "r" (r) : "memory"); + strcat (r, s1 + 1); + if (chk_calls != 2) + abort (); + chk_calls = 0; + /* Unknown destination and source, no checking. */ + strcat (s4, s3); + if (chk_calls) + abort (); + chk_calls = 0; +} + +/* Test whether runtime and/or compile time checking catches + buffer overflows. */ +void +__attribute__((noinline)) +test3 (void) +{ + struct A { char buf1[10]; char buf2[10]; } a; + char buf3[20]; + + memset (&a, '\0', sizeof (a)); + memset (buf3, '\0', sizeof (buf3)); + s5 = (char *) &a; + __asm __volatile ("" : : "r" (s5) : "memory"); + s5 = buf3; + __asm __volatile ("" : : "r" (s5) : "memory"); + chk_fail_allowed = 1; + /* Runtime checks. */ + if (__builtin_setjmp (chk_fail_buf) == 0) + { + strcat (&a.buf2[9], s2 + 3); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + strcat (&a.buf2[7], s3 + strlen (s3) - 3); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + strcat (&buf3[19], "a"); + abort (); + } + chk_fail_allowed = 0; +} + +void +main_test (void) +{ +#ifndef __OPTIMIZE__ + /* Object size checking is only intended for -O[s123]. */ + return; +#endif + __asm ("" : "=r" (s2) : "0" (s2)); + __asm ("" : "=r" (s3) : "0" (s3)); + __asm ("" : "=r" (l1) : "0" (l1)); + s4 = p; + test1 (); + memset (p, '\0', sizeof (p)); + test2 (); + test3 (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strcat-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strcat-lib.c new file mode 100644 index 000000000..0a0bbb886 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strcat-lib.c @@ -0,0 +1 @@ +#include "lib/strcat.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strcat.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strcat.c new file mode 100644 index 000000000..0fb1ba1c4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strcat.c @@ -0,0 +1,81 @@ +/* Copyright (C) 2000, 2003 Free Software Foundation. + + Ensure all expected transformations of builtin strcat occur and + perform correctly. + + Written by Kaveh R. Ghazi, 11/27/2000. */ + +extern int inside_main; +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern char *strcat (char *, const char *); +extern char *strcpy (char *, const char *); +extern void *memset (void *, int, size_t); +extern int memcmp (const void *, const void *, size_t); +#define RESET_DST_WITH(FILLER) \ + do { memset (dst, 'X', sizeof (dst)); strcpy (dst, (FILLER)); } while (0) + +void main_test (void) +{ + const char *const s1 = "hello world"; + const char *const s2 = ""; + char dst[64], *d2; + + RESET_DST_WITH (s1); + if (strcat (dst, "") != dst || memcmp (dst, "hello world\0XXX", 15)) + abort(); + RESET_DST_WITH (s1); + if (strcat (dst, s2) != dst || memcmp (dst, "hello world\0XXX", 15)) + abort(); + RESET_DST_WITH (s1); d2 = dst; + if (strcat (++d2, s2) != dst+1 || d2 != dst+1 + || memcmp (dst, "hello world\0XXX", 15)) + abort(); + RESET_DST_WITH (s1); d2 = dst; + if (strcat (++d2+5, s2) != dst+6 || d2 != dst+1 + || memcmp (dst, "hello world\0XXX", 15)) + abort(); + RESET_DST_WITH (s1); d2 = dst; + if (strcat (++d2+5, s1+11) != dst+6 || d2 != dst+1 + || memcmp (dst, "hello world\0XXX", 15)) + abort(); + +#ifndef __OPTIMIZE_SIZE__ +# if !defined __i386__ && !defined __x86_64__ + /* The functions below might not be optimized into direct stores on all + arches. It depends on how many instructions would be generated and + what limits the architecture chooses in STORE_BY_PIECES_P. */ + inside_main = 0; +# endif + + RESET_DST_WITH (s1); + if (strcat (dst, " 1111") != dst + || memcmp (dst, "hello world 1111\0XXX", 20)) + abort(); + + RESET_DST_WITH (s1); + if (strcat (dst+5, " 2222") != dst+5 + || memcmp (dst, "hello world 2222\0XXX", 20)) + abort(); + + RESET_DST_WITH (s1); d2 = dst; + if (strcat (++d2+5, " 3333") != dst+6 || d2 != dst+1 + || memcmp (dst, "hello world 3333\0XXX", 20)) + abort(); + + RESET_DST_WITH (s1); + strcat (strcat (strcat (strcat (strcat (strcat (dst, ": this "), ""), + "is "), "a "), "test"), "."); + if (memcmp (dst, "hello world: this is a test.\0X", 30)) + abort(); + + /* Set inside_main again. */ + inside_main = 1; +#endif + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + RESET_DST_WITH (s1); + if (__builtin_strcat (dst, "") != dst || memcmp (dst, "hello world\0XXX", 15)) + abort(); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strchr-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strchr-lib.c new file mode 100644 index 000000000..b3f0bd237 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strchr-lib.c @@ -0,0 +1,8 @@ +#include "lib/strchr.c" +#ifdef __vxworks +/* The RTP C library uses bzero, bfill and bcopy, all of which are defined + in the same file as index. */ +#include "lib/bzero.c" +#include "lib/bfill.c" +#include "lib/memmove.c" +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strchr.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strchr.c new file mode 100644 index 000000000..08e87c63d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strchr.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2000, 2003 Free Software Foundation. + + Ensure all expected transformations of builtin strchr and index + occur and perform correctly. + + Written by Jakub Jelinek, 11/7/2000. */ + +extern void abort (void); +extern char *strchr (const char *, int); +extern char *index (const char *, int); + +void +main_test (void) +{ + const char *const foo = "hello world"; + + if (strchr (foo, 'x')) + abort (); + if (strchr (foo, 'o') != foo + 4) + abort (); + if (strchr (foo + 5, 'o') != foo + 7) + abort (); + if (strchr (foo, '\0') != foo + 11) + abort (); + /* Test only one instance of index since the code path is the same + as that of strchr. */ + if (index ("hello", 'z') != 0) + abort (); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + if (__builtin_strchr (foo, 'o') != foo + 4) + abort (); + if (__builtin_index (foo, 'o') != foo + 4) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strcmp-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strcmp-lib.c new file mode 100644 index 000000000..99c421486 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strcmp-lib.c @@ -0,0 +1 @@ +#include "lib/strcmp.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strcmp.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strcmp.c new file mode 100644 index 000000000..08a7658ea --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strcmp.c @@ -0,0 +1,48 @@ +/* Copyright (C) 2000, 2003, 2004 Free Software Foundation. + + Ensure all expected transformations of builtin strcmp + occur and perform correctly. + + Written by Jakub Jelinek, 11/7/2000. */ + +extern void abort (void); +extern int strcmp (const char *, const char *); + +int x = 7; +char *bar = "hi world"; + +void +main_test (void) +{ + const char *const foo = "hello world"; + + if (strcmp (foo, "hello") <= 0) + abort (); + if (strcmp (foo + 2, "llo") <= 0) + abort (); + if (strcmp (foo, foo) != 0) + abort (); + if (strcmp (foo, "hello world ") >= 0) + abort (); + if (strcmp (foo + 10, "dx") >= 0) + abort (); + if (strcmp (10 + foo, "dx") >= 0) + abort (); + if (strcmp (bar, "") <= 0) + abort (); + if (strcmp ("", bar) >= 0) + abort (); + if (strcmp (bar+8, "") != 0) + abort (); + if (strcmp ("", bar+8) != 0) + abort (); + if (strcmp (bar+(--x), "") <= 0 || x != 6) + abort (); + if (strcmp ("", bar+(++x)) >= 0 || x != 7) + abort (); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + if (__builtin_strcmp (foo, "hello") <= 0) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-2-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-2-lib.c new file mode 100644 index 000000000..b10dfcb0d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-2-lib.c @@ -0,0 +1 @@ +#include "lib/strcpy.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-2.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-2.c new file mode 100644 index 000000000..c3cb6d0e5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-2.c @@ -0,0 +1,47 @@ +/* Copyright (C) 2004 Free Software Foundation. + + Ensure builtin strcpy is optimized into memcpy + even when there is more than one possible string literal + passed to it, but all string literals passed to it + have equal length. + + Written by Jakub Jelinek, 9/15/2004. */ + +extern void abort (void); +extern char *strcpy (char *, const char *); +typedef __SIZE_TYPE__ size_t; +extern void *memcpy (void *, const void *, size_t); +extern int memcmp (const void *, const void *, size_t); + +char buf[32], *p; +int i; + +char * +__attribute__((noinline)) +test (void) +{ + int j; + const char *q = "abcdefg"; + for (j = 0; j < 3; ++j) + { + if (j == i) + q = "bcdefgh"; + else if (j == i + 1) + q = "cdefghi"; + else if (j == i + 2) + q = "defghij"; + } + p = strcpy (buf, q); + return strcpy (buf + 16, q); +} + +void +main_test (void) +{ +#ifndef __OPTIMIZE_SIZE__ + /* For -Os, strcpy above is not replaced with + memcpy (buf, q, 8);, as that is larger. */ + if (test () != buf + 16 || p != buf) + abort (); +#endif +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-chk-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-chk-lib.c new file mode 100644 index 000000000..9daf13e82 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-chk-lib.c @@ -0,0 +1 @@ +#include "lib/chk.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-chk.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-chk.c new file mode 100644 index 000000000..b3c1a3899 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-chk.c @@ -0,0 +1,234 @@ +/* Copyright (C) 2004, 2005 Free Software Foundation. + + Ensure builtin __strcpy_chk performs correctly. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern size_t strlen(const char *); +extern void *memcpy (void *, const void *, size_t); +extern char *strcpy (char *, const char *); +extern int memcmp (const void *, const void *, size_t); + +#include "chk.h" + +LOCAL const char s1[] = "123"; +char p[32] = ""; +char *s2 = "defg"; +char *s3 = "FGH"; +char *s4; +size_t l1 = 1; + +void +__attribute__((noinline)) +test1 (void) +{ + chk_calls = 0; +#ifndef __OPTIMIZE_SIZE__ + strcpy_disallowed = 1; +#else + strcpy_disallowed = 0; +#endif + + if (strcpy (p, "abcde") != p || memcmp (p, "abcde", 6)) + abort (); + if (strcpy (p + 16, "vwxyz" + 1) != p + 16 || memcmp (p + 16, "wxyz", 5)) + abort (); + if (strcpy (p + 1, "") != p + 1 || memcmp (p, "a\0cde", 6)) + abort (); + if (strcpy (p + 3, "fghij") != p + 3 || memcmp (p, "a\0cfghij", 9)) + abort (); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + if (__builtin_strcpy (p, "abcde") != p || memcmp (p, "abcde", 6)) + abort (); + + strcpy_disallowed = 0; + if (chk_calls) + abort (); +} + +#ifndef MAX_OFFSET +#define MAX_OFFSET (sizeof (long long)) +#endif + +#ifndef MAX_COPY +#define MAX_COPY (10 * sizeof (long long)) +#endif + +#ifndef MAX_EXTRA +#define MAX_EXTRA (sizeof (long long)) +#endif + +#define MAX_LENGTH (MAX_OFFSET + MAX_COPY + 1 + MAX_EXTRA) + +/* Use a sequence length that is not divisible by two, to make it more + likely to detect when words are mixed up. */ +#define SEQUENCE_LENGTH 31 + +static union { + char buf[MAX_LENGTH]; + long long align_int; + long double align_fp; +} u1, u2; + +void +__attribute__((noinline)) +test2 (void) +{ + int off1, off2, len, i; + char *p, *q, c; + + for (off1 = 0; off1 < MAX_OFFSET; off1++) + for (off2 = 0; off2 < MAX_OFFSET; off2++) + for (len = 1; len < MAX_COPY; len++) + { + for (i = 0, c = 'A'; i < MAX_LENGTH; i++, c++) + { + u1.buf[i] = 'a'; + if (c >= 'A' + SEQUENCE_LENGTH) + c = 'A'; + u2.buf[i] = c; + } + u2.buf[off2 + len] = '\0'; + + p = strcpy (u1.buf + off1, u2.buf + off2); + if (p != u1.buf + off1) + abort (); + + q = u1.buf; + for (i = 0; i < off1; i++, q++) + if (*q != 'a') + abort (); + + for (i = 0, c = 'A' + off2; i < len; i++, q++, c++) + { + if (c >= 'A' + SEQUENCE_LENGTH) + c = 'A'; + if (*q != c) + abort (); + } + + if (*q++ != '\0') + abort (); + for (i = 0; i < MAX_EXTRA; i++, q++) + if (*q != 'a') + abort (); + } +} + +/* Test whether compile time checking is done where it should + and so is runtime object size checking. */ +void +__attribute__((noinline)) +test3 (void) +{ + struct A { char buf1[10]; char buf2[10]; } a; + char *r = l1 == 1 ? &a.buf1[5] : &a.buf2[4]; + char buf3[20]; + int i; + const char *l; + + /* The following calls should do runtime checking + - source length is not known, but destination is. */ + chk_calls = 0; + strcpy (a.buf1 + 2, s3 + 3); + strcpy (r, s3 + 2); + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + strcpy (r, s2 + 2); + strcpy (r + 2, s3 + 3); + r = buf3; + for (i = 0; i < 4; ++i) + { + if (i == l1 - 1) + r = &a.buf1[1]; + else if (i == l1) + r = &a.buf2[7]; + else if (i == l1 + 1) + r = &buf3[5]; + else if (i == l1 + 2) + r = &a.buf1[9]; + } + strcpy (r, s2 + 4); + if (chk_calls != 5) + abort (); + + /* Following have known destination and known source length, + so if optimizing certainly shouldn't result in the checking + variants. */ + chk_calls = 0; + strcpy (a.buf1 + 2, ""); + strcpy (r, "a"); + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + strcpy (r, s1 + 1); + r = buf3; + l = "abc"; + for (i = 0; i < 4; ++i) + { + if (i == l1 - 1) + r = &a.buf1[1], l = "e"; + else if (i == l1) + r = &a.buf2[7], l = "gh"; + else if (i == l1 + 1) + r = &buf3[5], l = "jkl"; + else if (i == l1 + 2) + r = &a.buf1[9], l = ""; + } + strcpy (r, ""); + /* Here, strlen (l) + 1 is known to be at most 4 and + __builtin_object_size (&buf3[16], 0) is 4, so this doesn't need + runtime checking. */ + strcpy (&buf3[16], l); + /* Unknown destination and source, no checking. */ + strcpy (s4, s3); + if (chk_calls) + abort (); + chk_calls = 0; +} + +/* Test whether runtime and/or compile time checking catches + buffer overflows. */ +void +__attribute__((noinline)) +test4 (void) +{ + struct A { char buf1[10]; char buf2[10]; } a; + char buf3[20]; + + chk_fail_allowed = 1; + /* Runtime checks. */ + if (__builtin_setjmp (chk_fail_buf) == 0) + { + strcpy (&a.buf2[9], s2 + 3); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + strcpy (&a.buf2[7], s3 + strlen (s3) - 3); + abort (); + } + /* This should be detectable at compile time already. */ + if (__builtin_setjmp (chk_fail_buf) == 0) + { + strcpy (&buf3[19], "a"); + abort (); + } + chk_fail_allowed = 0; +} + +void +main_test (void) +{ +#ifndef __OPTIMIZE__ + /* Object size checking is only intended for -O[s123]. */ + return; +#endif + __asm ("" : "=r" (s2) : "0" (s2)); + __asm ("" : "=r" (s3) : "0" (s3)); + __asm ("" : "=r" (l1) : "0" (l1)); + test1 (); + test2 (); + s4 = p; + test3 (); + test4 (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-lib.c new file mode 100644 index 000000000..b10dfcb0d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-lib.c @@ -0,0 +1 @@ +#include "lib/strcpy.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy.c new file mode 100644 index 000000000..0ca62b3a2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy.c @@ -0,0 +1,41 @@ +/* Copyright (C) 2000 Free Software Foundation. + + Ensure builtin memcpy and strcpy perform correctly. + + Written by Jakub Jelinek, 11/24/2000. */ + +extern void abort (void); +extern char *strcpy (char *, const char *); +typedef __SIZE_TYPE__ size_t; +extern void *memcpy (void *, const void *, size_t); +extern int memcmp (const void *, const void *, size_t); + +char p[32] = ""; + +void +main_test (void) +{ + if (strcpy (p, "abcde") != p || memcmp (p, "abcde", 6)) + abort (); + if (strcpy (p + 16, "vwxyz" + 1) != p + 16 || memcmp (p + 16, "wxyz", 5)) + abort (); + if (strcpy (p + 1, "") != p + 1 || memcmp (p, "a\0cde", 6)) + abort (); + if (strcpy (p + 3, "fghij") != p + 3 || memcmp (p, "a\0cfghij", 9)) + abort (); + if (memcpy (p, "ABCDE", 6) != p || memcmp (p, "ABCDE", 6)) + abort (); + if (memcpy (p + 16, "VWX" + 1, 2) != p + 16 || memcmp (p + 16, "WXyz", 5)) + abort (); + if (memcpy (p + 1, "", 1) != p + 1 || memcmp (p, "A\0CDE", 6)) + abort (); + if (memcpy (p + 3, "FGHI", 4) != p + 3 || memcmp (p, "A\0CFGHIj", 9)) + abort (); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + if (__builtin_strcpy (p, "abcde") != p || memcmp (p, "abcde", 6)) + abort (); + if (__builtin_memcpy (p, "ABCDE", 6) != p || memcmp (p, "ABCDE", 6)) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strcspn-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strcspn-lib.c new file mode 100644 index 000000000..8b1cfea01 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strcspn-lib.c @@ -0,0 +1 @@ +#include "lib/strcspn.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strcspn.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strcspn.c new file mode 100644 index 000000000..be392546a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strcspn.c @@ -0,0 +1,54 @@ +/* Copyright (C) 2000, 2004 Free Software Foundation. + + Ensure all expected transformations of builtin strcspn occur and + perform correctly. + + Written by Kaveh R. Ghazi, 11/27/2000. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern size_t strcspn (const char *, const char *); +extern char *strcpy (char *, const char *); + +void +main_test (void) +{ + const char *const s1 = "hello world"; + char dst[64], *d2; + + if (strcspn (s1, "hello") != 0) + abort(); + if (strcspn (s1, "z") != 11) + abort(); + if (strcspn (s1+4, "z") != 7) + abort(); + if (strcspn (s1, "hello world") != 0) + abort(); + if (strcspn (s1, "") != 11) + abort(); + strcpy (dst, s1); + if (strcspn (dst, "") != 11) + abort(); + strcpy (dst, s1); d2 = dst; + if (strcspn (++d2, "") != 10 || d2 != dst+1) + abort(); + strcpy (dst, s1); d2 = dst; + if (strcspn (++d2+5, "") != 5 || d2 != dst+1) + abort(); + if (strcspn ("", s1) != 0) + abort(); + strcpy (dst, s1); + if (strcspn ("", dst) != 0) + abort(); + strcpy (dst, s1); d2 = dst; + if (strcspn ("", ++d2) != 0 || d2 != dst+1) + abort(); + strcpy (dst, s1); d2 = dst; + if (strcspn ("", ++d2+5) != 0 || d2 != dst+1) + abort(); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + if (__builtin_strcspn (s1, "z") != 11) + abort(); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strlen-2-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strlen-2-lib.c new file mode 100644 index 000000000..9753c2498 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strlen-2-lib.c @@ -0,0 +1 @@ +#include "lib/strlen.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strlen-2.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strlen-2.c new file mode 100644 index 000000000..e15ad6636 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strlen-2.c @@ -0,0 +1,41 @@ +/* Copyright (C) 2003 Free Software Foundation. + + Test strlen optimizations on conditional expressions. + + Written by Jakub Jelinek, June 23, 2003. */ + +typedef __SIZE_TYPE__ size_t; +extern size_t strlen (const char *); +extern char *strcpy (char *, const char *); +extern int memcmp (const void *, const void *, size_t); +extern void abort (void); +extern int inside_main; + +size_t g, h, i, j, k, l; + +size_t +foo (void) +{ + if (l) + abort (); + return ++l; +} + +void +main_test (void) +{ + if (strlen (i ? "foo" + 1 : j ? "bar" + 1 : "baz" + 1) != 2) + abort (); + if (strlen (g++ ? "foo" : "bar") != 3 || g != 1) + abort (); + if (strlen (h++ ? "xfoo" + 1 : "bar") != 3 || h != 1) + abort (); + if (strlen ((i++, "baz")) != 3 || i != 1) + abort (); + /* The following calls might not optimize strlen call away. */ + inside_main = 0; + if (strlen (j ? "foo" + k++ : "bar" + k++) != 3 || k != 1) + abort (); + if (strlen (foo () ? "foo" : "bar") != 3 || l != 1) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strlen-3-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strlen-3-lib.c new file mode 100644 index 000000000..9753c2498 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strlen-3-lib.c @@ -0,0 +1 @@ +#include "lib/strlen.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strlen-3.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strlen-3.c new file mode 100644 index 000000000..666ca21b9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strlen-3.c @@ -0,0 +1,70 @@ +/* Copyright (C) 2004 Free Software Foundation. + + Test strlen on const variables initialized to string literals. + + Written by Jakub Jelinek, 9/14/2004. */ + +extern void abort (void); +extern __SIZE_TYPE__ strlen (const char *); +extern char *strcpy (char *, const char *); +static const char bar[] = "Hello, World!"; +static const char baz[] = "hello, world?"; +static const char larger[20] = "short string"; +extern int inside_main; + +int l1 = 1; +int x = 6; + +void +main_test(void) +{ +#ifdef __OPTIMIZE__ + const char *foo; + int i; +#endif + + if (strlen (bar) != 13) + abort (); + + if (strlen (bar + 3) != 10) + abort (); + + if (strlen (&bar[6]) != 7) + abort (); + + if (strlen (bar + (x++ & 7)) != 7) + abort (); + if (x != 7) + abort (); + +#ifdef __OPTIMIZE__ + foo = bar; + for (i = 0; i < 4; ++i) + { + if (i == l1 - 1) + foo = "HELLO, WORLD!"; + else if (i == l1) + foo = bar; + else if (i == l1 + 1) + foo = "hello, world!"; + else + foo = baz; + } + if (strlen (foo) != 13) + abort (); +#endif + + if (strlen (larger) != 12) + abort (); + if (strlen (&larger[10]) != 2) + abort (); + + inside_main = 0; + /* This will result in strlen call, because larger + array is bigger than its initializer. */ + if (strlen (larger + (x++ & 7)) != 5) + abort (); + if (x != 8) + abort (); + inside_main = 1; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strlen-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strlen-lib.c new file mode 100644 index 000000000..9753c2498 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strlen-lib.c @@ -0,0 +1 @@ +#include "lib/strlen.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strlen.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strlen.c new file mode 100644 index 000000000..0a9681770 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strlen.c @@ -0,0 +1,71 @@ +/* Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation. + + Ensure all expected transformations of builtin strlen + occur and perform correctly. + + Written by Jakub Jelinek, 11/7/2000. + + Additional tests written by Roger Sayle, 11/02/2001: + Ensure all builtin strlen comparisons against zero are optimized + and perform correctly. The multiple calls to strcpy are to prevent + the potentially "pure" strlen calls from being removed by CSE. + + Modified by Ben Elliston, 2006-10-25: + The multiple calls to strcpy that Roger mentions above are + problematic on systems where strcpy is implemented using strlen + (which this test overrides to call abort). So, rather than use + strcpy, we perform the identical operations using array indexing + and char assignments. */ + +extern void abort (void); +extern __SIZE_TYPE__ strlen (const char *); +extern char *strcpy (char *, const char *); + +int x = 6; + +void +main_test(void) +{ + const char *const foo = "hello world"; + char str[8]; + char *ptr; + + if (strlen (foo) != 11) + abort (); + if (strlen (foo + 4) != 7) + abort (); + if (strlen (foo + (x++ & 7)) != 5) + abort (); + if (x != 7) + abort (); + + ptr = str; + ptr[0] = 'n'; ptr[1] = 't'; ptr[2] = 's'; ptr[3] = '\0'; + if (strlen (ptr) == 0) + abort (); + + ptr[0] = 'n'; ptr[1] = 't'; ptr[2] = 's'; ptr[3] = '\0'; + if (strlen (ptr) < 1) + abort (); + + ptr[0] = 'n'; ptr[1] = 't'; ptr[2] = 's'; ptr[3] = '\0'; + if (strlen (ptr) <= 0) + abort (); + + ptr[0] = 'n'; ptr[1] = 't'; ptr[2] = 's'; ptr[3] = '\0'; + if (strlen (ptr+3) != 0) + abort (); + + ptr[0] = 'n'; ptr[1] = 't'; ptr[2] = 's'; ptr[3] = '\0'; + if (strlen (ptr+3) > 0) + abort (); + + ptr[0] = 'n'; ptr[1] = 't'; ptr[2] = 's'; ptr[3] = '\0'; + if (strlen (str+3) >= 1) + abort (); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + if (__builtin_strlen (foo) != 11) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strncat-chk-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strncat-chk-lib.c new file mode 100644 index 000000000..9daf13e82 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strncat-chk-lib.c @@ -0,0 +1 @@ +#include "lib/chk.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strncat-chk.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strncat-chk.c new file mode 100644 index 000000000..8904df14a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strncat-chk.c @@ -0,0 +1,229 @@ +/* Copyright (C) 2004, 2005 Free Software Foundation. + + Ensure builtin __strncat_chk performs correctly. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern size_t strlen (const char *); +extern void *memcpy (void *, const void *, size_t); +extern char *strcat (char *, const char *); +extern char *strncat (char *, const char *, size_t); +extern int memcmp (const void *, const void *, size_t); +extern char *strcpy (char *, const char *); +extern int strcmp (const char *, const char *); +extern void *memset (void *, int, size_t); + +#include "chk.h" + +const char s1[] = "123"; +char p[32] = ""; +char *s2 = "defg"; +char *s3 = "FGH"; +char *s4; +size_t l1 = 1; +char *s5; +int x = 123; + +void +__attribute__((noinline)) +test1 (void) +{ + const char *const s1 = "hello world"; + const char *const s2 = ""; + const char *s3; + char dst[64], *d2; + + /* Following strncat calls should be all optimized out. */ + chk_calls = 0; + strncat_disallowed = 1; + strcat_disallowed = 1; + strcpy (dst, s1); + if (strncat (dst, "", 100) != dst || strcmp (dst, s1)) + abort (); + strcpy (dst, s1); + if (strncat (dst, s2, 100) != dst || strcmp (dst, s1)) + abort (); + strcpy (dst, s1); d2 = dst; + if (strncat (++d2, s2, 100) != dst+1 || d2 != dst+1 || strcmp (dst, s1)) + abort (); + strcpy (dst, s1); d2 = dst; + if (strncat (++d2+5, s2, 100) != dst+6 || d2 != dst+1 || strcmp (dst, s1)) + abort (); + strcpy (dst, s1); d2 = dst; + if (strncat (++d2+5, s1+11, 100) != dst+6 || d2 != dst+1 || strcmp (dst, s1)) + abort (); + strcpy (dst, s1); d2 = dst; + if (strncat (++d2+5, s1, 0) != dst+6 || d2 != dst+1 || strcmp (dst, s1)) + abort (); + strcpy (dst, s1); d2 = dst; s3 = s1; + if (strncat (++d2+5, ++s3, 0) != dst+6 || d2 != dst+1 || strcmp (dst, s1) + || s3 != s1 + 1) + abort (); + strcpy (dst, s1); d2 = dst; + if (strncat (++d2+5, "", ++x) != dst+6 || d2 != dst+1 || x != 124 + || strcmp (dst, s1)) + abort (); + if (chk_calls) + abort (); + strcat_disallowed = 0; + + /* These __strncat_chk calls should be optimized into __strcat_chk, + as strlen (src) <= len. */ + strcpy (dst, s1); + if (strncat (dst, "foo", 3) != dst || strcmp (dst, "hello worldfoo")) + abort (); + strcpy (dst, s1); + if (strncat (dst, "foo", 100) != dst || strcmp (dst, "hello worldfoo")) + abort (); + strcpy (dst, s1); + if (strncat (dst, s1, 100) != dst || strcmp (dst, "hello worldhello world")) + abort (); + if (chk_calls != 3) + abort (); + + chk_calls = 0; + /* The following calls have side-effects in dest, so are not checked. */ + strcpy (dst, s1); d2 = dst; + if (__builtin___strncat_chk (++d2, s1, 100, os (++d2)) != dst+1 + || d2 != dst+1 || strcmp (dst, "hello worldhello world")) + abort (); + strcpy (dst, s1); d2 = dst; + if (__builtin___strncat_chk (++d2+5, s1, 100, os (++d2+5)) != dst+6 + || d2 != dst+1 || strcmp (dst, "hello worldhello world")) + abort (); + strcpy (dst, s1); d2 = dst; + if (__builtin___strncat_chk (++d2+5, s1+5, 100, os (++d2+5)) != dst+6 + || d2 != dst+1 || strcmp (dst, "hello world world")) + abort (); + if (chk_calls) + abort (); + + chk_calls = 0; + strcat_disallowed = 1; + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + strcpy (dst, s1); + if (__builtin_strncat (dst, "", 100) != dst || strcmp (dst, s1)) + abort (); + + if (chk_calls) + abort (); + strncat_disallowed = 0; + strcat_disallowed = 0; +} + +/* Test whether compile time checking is done where it should + and so is runtime object size checking. */ +void +__attribute__((noinline)) +test2 (void) +{ + struct A { char buf1[10]; char buf2[10]; } a; + char *r = l1 == 1 ? &a.buf1[5] : &a.buf2[4]; + char buf3[20]; + int i; + + /* The following calls should do runtime checking. */ + memset (&a, '\0', sizeof (a)); + s5 = (char *) &a; + __asm __volatile ("" : : "r" (s5) : "memory"); + chk_calls = 0; + strncat (a.buf1 + 2, s3 + 3, l1 - 1); + strncat (r, s3 + 2, l1); + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + memset (r, '\0', 3); + __asm __volatile ("" : : "r" (r) : "memory"); + strncat (r, s2 + 2, l1 + 1); + strncat (r + 2, s3 + 3, l1 - 1); + r = buf3; + for (i = 0; i < 4; ++i) + { + if (i == l1 - 1) + r = &a.buf1[1]; + else if (i == l1) + r = &a.buf2[7]; + else if (i == l1 + 1) + r = &buf3[5]; + else if (i == l1 + 2) + r = &a.buf1[9]; + } + strncat (r, s2 + 4, l1); + if (chk_calls != 5) + abort (); + + /* Following have known destination and known source length, + but we don't know the length of dest string, so runtime checking + is needed too. */ + memset (&a, '\0', sizeof (a)); + chk_calls = 0; + s5 = (char *) &a; + __asm __volatile ("" : : "r" (s5) : "memory"); + strncat (a.buf1 + 2, "a", 5); + strncat (r, "def", 0); + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + memset (r, '\0', 3); + __asm __volatile ("" : : "r" (r) : "memory"); + strncat (r, s1 + 1, 2); + if (chk_calls != 2) + abort (); + chk_calls = 0; + strcat_disallowed = 1; + /* Unknown destination and source, no checking. */ + strncat (s4, s3, l1 + 1); + strcat_disallowed = 0; + if (chk_calls) + abort (); +} + +/* Test whether runtime and/or compile time checking catches + buffer overflows. */ +void +__attribute__((noinline)) +test3 (void) +{ + struct A { char buf1[10]; char buf2[10]; } a; + char buf3[20]; + + memset (&a, '\0', sizeof (a)); + memset (buf3, '\0', sizeof (buf3)); + s5 = (char *) &a; + __asm __volatile ("" : : "r" (s5) : "memory"); + s5 = buf3; + __asm __volatile ("" : : "r" (s5) : "memory"); + chk_fail_allowed = 1; + /* Runtime checks. */ + if (__builtin_setjmp (chk_fail_buf) == 0) + { + strncat (&a.buf2[9], s2 + 3, 4); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + strncat (&a.buf2[7], s3 + strlen (s3) - 3, 3); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + strncat (&buf3[19], "abcde", 1); + abort (); + } + chk_fail_allowed = 0; +} + +void +main_test (void) +{ +#ifndef __OPTIMIZE__ + /* Object size checking is only intended for -O[s123]. */ + return; +#endif + __asm ("" : "=r" (s2) : "0" (s2)); + __asm ("" : "=r" (s3) : "0" (s3)); + __asm ("" : "=r" (l1) : "0" (l1)); + s4 = p; + test1 (); + memset (p, '\0', sizeof (p)); + test2 (); + test3 (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strncat-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strncat-lib.c new file mode 100644 index 000000000..1405a48f4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strncat-lib.c @@ -0,0 +1 @@ +#include "lib/strncat.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strncat.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strncat.c new file mode 100644 index 000000000..1a093baf7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strncat.c @@ -0,0 +1,82 @@ +/* Copyright (C) 2000, 2003 Free Software Foundation. + + Ensure all expected transformations of builtin strncat occur and + perform correctly. + + Written by Kaveh R. Ghazi, 11/27/2000. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern char *strncat (char *, const char *, size_t); +extern char *strcpy (char *, const char *); +extern void *memset (void *, int, size_t); +extern int memcmp (const void *, const void *, size_t); +int x = 123; + +/* Reset the destination buffer to a known state. */ +#define RESET_DST_WITH(FILLER) \ + do { memset (dst, 'X', sizeof (dst)); strcpy (dst, (FILLER)); } while (0) + +void +main_test (void) +{ + const char *const s1 = "hello world"; + const char *const s2 = ""; + char dst[64], *d2; + + RESET_DST_WITH (s1); + if (strncat (dst, "", 100) != dst || memcmp (dst, "hello world\0XXX", 15)) + abort(); + RESET_DST_WITH (s1); + if (strncat (dst, s2, 100) != dst || memcmp (dst, "hello world\0XXX", 15)) + abort(); + RESET_DST_WITH (s1); d2 = dst; + if (strncat (++d2, s2, 100) != dst+1 || d2 != dst+1 + || memcmp (dst, "hello world\0XXX", 15)) + abort(); + RESET_DST_WITH (s1); d2 = dst; + if (strncat (++d2+5, s2, 100) != dst+6 || d2 != dst+1 + || memcmp (dst, "hello world\0XXX", 15)) + abort(); + RESET_DST_WITH (s1); d2 = dst; + if (strncat (++d2+5, s1+11, 100) != dst+6 || d2 != dst+1 + || memcmp (dst, "hello world\0XXX", 15)) + abort(); + RESET_DST_WITH (s1); d2 = dst; + if (strncat (++d2+5, s1, 0) != dst+6 || d2 != dst+1 + || memcmp (dst, "hello world\0XXX", 15)) + abort(); + RESET_DST_WITH (s1); d2 = dst; + if (strncat (++d2+5, "", ++x) != dst+6 || d2 != dst+1 || x != 124 + || memcmp (dst, "hello world\0XXX", 15)) + abort(); + + RESET_DST_WITH (s1); + if (strncat (dst, "foo", 3) != dst || memcmp (dst, "hello worldfoo\0XXX", 18)) + abort(); + RESET_DST_WITH (s1); + if (strncat (dst, "foo", 100) != dst || memcmp (dst, "hello worldfoo\0XXX", 18)) + abort(); + RESET_DST_WITH (s1); + if (strncat (dst, s1, 100) != dst || memcmp (dst, "hello worldhello world\0XXX", 26)) + abort(); + RESET_DST_WITH (s1); d2 = dst; + if (strncat (++d2, s1, 100) != dst+1 || d2 != dst+1 + || memcmp (dst, "hello worldhello world\0XXX", 26)) + abort(); + RESET_DST_WITH (s1); d2 = dst; + if (strncat (++d2+5, s1, 100) != dst+6 || d2 != dst+1 + || memcmp (dst, "hello worldhello world\0XXX", 26)) + abort(); + RESET_DST_WITH (s1); d2 = dst; + if (strncat (++d2+5, s1+5, 100) != dst+6 || d2 != dst+1 + || memcmp (dst, "hello world world\0XXX", 21)) + abort(); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + RESET_DST_WITH (s1); + if (__builtin_strncat (dst, "", 100) != dst + || memcmp (dst, "hello world\0XXX", 15)) + abort(); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strncmp-2-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strncmp-2-lib.c new file mode 100644 index 000000000..266c4a49b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strncmp-2-lib.c @@ -0,0 +1 @@ +#include "lib/strncmp.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strncmp-2.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strncmp-2.c new file mode 100644 index 000000000..fe3462724 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strncmp-2.c @@ -0,0 +1,173 @@ +/* Copyright (C) 2000, 2001, 2003, 2005 Free Software Foundation. + + Ensure all expected transformations of builtin strncmp occur and + perform correctly. + + Written by Kaveh R. Ghazi, 11/26/2000. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern int strncmp (const char *, const char *, size_t); + +void +main_test (void) +{ +#if !defined(__OPTIMIZE__) || ((defined(__i386__) || defined (__x86_64__)) && !defined(__OPTIMIZE_SIZE__)) + /* These tests work on platforms which support cmpstrsi. We test it + at -O0 on all platforms to ensure the strncmp logic is correct. */ + const char *const s1 = "hello world"; + const char *s2; + int n = 6, x; + + s2 = s1; + if (strncmp (++s2, "ello", 3) != 0 || s2 != s1+1) + abort(); + s2 = s1; + if (strncmp ("ello", ++s2, 3) != 0 || s2 != s1+1) + abort(); + s2 = s1; + if (strncmp (++s2, "ello", 4) != 0 || s2 != s1+1) + abort(); + s2 = s1; + if (strncmp ("ello", ++s2, 4) != 0 || s2 != s1+1) + abort(); + s2 = s1; + if (strncmp (++s2, "ello", 5) <= 0 || s2 != s1+1) + abort(); + s2 = s1; + if (strncmp ("ello", ++s2, 5) >= 0 || s2 != s1+1) + abort(); + s2 = s1; + if (strncmp (++s2, "ello", 6) <= 0 || s2 != s1+1) + abort(); + s2 = s1; + if (strncmp ("ello", ++s2, 6) >= 0 || s2 != s1+1) + abort(); + + s2 = s1; + if (strncmp (++s2, "zllo", 3) >= 0 || s2 != s1+1) + abort(); + s2 = s1; + if (strncmp ("zllo", ++s2, 3) <= 0 || s2 != s1+1) + abort(); + s2 = s1; + if (strncmp (++s2, "zllo", 4) >= 0 || s2 != s1+1) + abort(); + s2 = s1; + if (strncmp ("zllo", ++s2, 4) <= 0 || s2 != s1+1) + abort(); + s2 = s1; + if (strncmp (++s2, "zllo", 5) >= 0 || s2 != s1+1) + abort(); + s2 = s1; + if (strncmp ("zllo", ++s2, 5) <= 0 || s2 != s1+1) + abort(); + s2 = s1; + if (strncmp (++s2, "zllo", 6) >= 0 || s2 != s1+1) + abort(); + s2 = s1; + if (strncmp ("zllo", ++s2, 6) <= 0 || s2 != s1+1) + abort(); + + s2 = s1; + if (strncmp (++s2, "allo", 3) <= 0 || s2 != s1+1) + abort(); + s2 = s1; + if (strncmp ("allo", ++s2, 3) >= 0 || s2 != s1+1) + abort(); + s2 = s1; + if (strncmp (++s2, "allo", 4) <= 0 || s2 != s1+1) + abort(); + s2 = s1; + if (strncmp ("allo", ++s2, 4) >= 0 || s2 != s1+1) + abort(); + s2 = s1; + if (strncmp (++s2, "allo", 5) <= 0 || s2 != s1+1) + abort(); + s2 = s1; + if (strncmp ("allo", ++s2, 5) >= 0 || s2 != s1+1) + abort(); + s2 = s1; + if (strncmp (++s2, "allo", 6) <= 0 || s2 != s1+1) + abort(); + s2 = s1; + if (strncmp ("allo", ++s2, 6) >= 0 || s2 != s1+1) + abort(); + + s2 = s1; n = 2; x = 1; + if (strncmp (++s2, s1+(x&3), ++n) != 0 || s2 != s1+1 || n != 3) + abort(); + s2 = s1; n = 2; x = 1; + if (strncmp (s1+(x&3), ++s2, ++n) != 0 || s2 != s1+1 || n != 3) + abort(); + s2 = s1; n = 3; x = 1; + if (strncmp (++s2, s1+(x&3), ++n) != 0 || s2 != s1+1 || n != 4) + abort(); + s2 = s1; n = 3; x = 1; + if (strncmp (s1+(x&3), ++s2, ++n) != 0 || s2 != s1+1 || n != 4) + abort(); + s2 = s1; n = 4; x = 1; + if (strncmp (++s2, s1+(x&3), ++n) != 0 || s2 != s1+1 || n != 5) + abort(); + s2 = s1; n = 4; x = 1; + if (strncmp (s1+(x&3), ++s2, ++n) != 0 || s2 != s1+1 || n != 5) + abort(); + s2 = s1; n = 5; x = 1; + if (strncmp (++s2, s1+(x&3), ++n) != 0 || s2 != s1+1 || n != 6) + abort(); + s2 = s1; n = 5; x = 1; + if (strncmp (s1+(x&3), ++s2, ++n) != 0 || s2 != s1+1 || n != 6) + abort(); + + s2 = s1; n = 2; + if (strncmp (++s2, "zllo", ++n) >= 0 || s2 != s1+1 || n != 3) + abort(); + s2 = s1; n = 2; x = 1; + if (strncmp ("zllo", ++s2, ++n) <= 0 || s2 != s1+1 || n != 3) + abort(); + s2 = s1; n = 3; x = 1; + if (strncmp (++s2, "zllo", ++n) >= 0 || s2 != s1+1 || n != 4) + abort(); + s2 = s1; n = 3; x = 1; + if (strncmp ("zllo", ++s2, ++n) <= 0 || s2 != s1+1 || n != 4) + abort(); + s2 = s1; n = 4; x = 1; + if (strncmp (++s2, "zllo", ++n) >= 0 || s2 != s1+1 || n != 5) + abort(); + s2 = s1; n = 4; x = 1; + if (strncmp ("zllo", ++s2, ++n) <= 0 || s2 != s1+1 || n != 5) + abort(); + s2 = s1; n = 5; x = 1; + if (strncmp (++s2, "zllo", ++n) >= 0 || s2 != s1+1 || n != 6) + abort(); + s2 = s1; n = 5; x = 1; + if (strncmp ("zllo", ++s2, ++n) <= 0 || s2 != s1+1 || n != 6) + abort(); + + s2 = s1; n = 2; + if (strncmp (++s2, "allo", ++n) <= 0 || s2 != s1+1 || n != 3) + abort(); + s2 = s1; n = 2; x = 1; + if (strncmp ("allo", ++s2, ++n) >= 0 || s2 != s1+1 || n != 3) + abort(); + s2 = s1; n = 3; x = 1; + if (strncmp (++s2, "allo", ++n) <= 0 || s2 != s1+1 || n != 4) + abort(); + s2 = s1; n = 3; x = 1; + if (strncmp ("allo", ++s2, ++n) >= 0 || s2 != s1+1 || n != 4) + abort(); + s2 = s1; n = 4; x = 1; + if (strncmp (++s2, "allo", ++n) <= 0 || s2 != s1+1 || n != 5) + abort(); + s2 = s1; n = 4; x = 1; + if (strncmp ("allo", ++s2, ++n) >= 0 || s2 != s1+1 || n != 5) + abort(); + s2 = s1; n = 5; x = 1; + if (strncmp (++s2, "allo", ++n) <= 0 || s2 != s1+1 || n != 6) + abort(); + s2 = s1; n = 5; x = 1; + if (strncmp ("allo", ++s2, ++n) >= 0 || s2 != s1+1 || n != 6) + abort(); + +#endif +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strncmp-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strncmp-lib.c new file mode 100644 index 000000000..266c4a49b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strncmp-lib.c @@ -0,0 +1 @@ +#include "lib/strncmp.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strncmp.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strncmp.c new file mode 100644 index 000000000..2c22b7d01 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strncmp.c @@ -0,0 +1,73 @@ +/* Copyright (C) 2000, 2001, 2003 Free Software Foundation. + + Ensure all expected transformations of builtin strncmp occur and + perform correctly. + + Written by Kaveh R. Ghazi, 11/26/2000. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern int strncmp (const char *, const char *, size_t); + +void +main_test (void) +{ + const char *const s1 = "hello world"; + const char *s2, *s3; + + if (strncmp (s1, "hello world", 12) != 0) + abort(); + if (strncmp ("hello world", s1, 12) != 0) + abort(); + if (strncmp ("hello", "hello", 6) != 0) + abort(); + if (strncmp ("hello", "hello", 2) != 0) + abort(); + if (strncmp ("hello", "hello", 100) != 0) + abort(); + if (strncmp (s1+10, "d", 100) != 0) + abort(); + if (strncmp (10+s1, "d", 100) != 0) + abort(); + if (strncmp ("d", s1+10, 1) != 0) + abort(); + if (strncmp ("d", 10+s1, 1) != 0) + abort(); + if (strncmp ("hello", "aaaaa", 100) <= 0) + abort(); + if (strncmp ("aaaaa", "hello", 100) >= 0) + abort(); + if (strncmp ("hello", "aaaaa", 1) <= 0) + abort(); + if (strncmp ("aaaaa", "hello", 1) >= 0) + abort(); + + s2 = s1; s3 = s1+4; + if (strncmp (++s2, ++s3, 0) != 0 || s2 != s1+1 || s3 != s1+5) + abort(); + s2 = s1; + if (strncmp (++s2, "", 1) <= 0 || s2 != s1+1) + abort(); + if (strncmp ("", ++s2, 1) >= 0 || s2 != s1+2) + abort(); + if (strncmp (++s2, "", 100) <= 0 || s2 != s1+3) + abort(); + if (strncmp ("", ++s2, 100) >= 0 || s2 != s1+4) + abort(); + if (strncmp (++s2+6, "", 100) != 0 || s2 != s1+5) + abort(); + if (strncmp ("", ++s2+5, 100) != 0 || s2 != s1+6) + abort(); + if (strncmp ("ozz", ++s2, 1) != 0 || s2 != s1+7) + abort(); + if (strncmp (++s2, "rzz", 1) != 0 || s2 != s1+8) + abort(); + s2 = s1; s3 = s1+4; + if (strncmp (++s2, ++s3+2, 1) >= 0 || s2 != s1+1 || s3 != s1+5) + abort(); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + if (__builtin_strncmp ("hello", "a", 100) <= 0) + abort(); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strncpy-chk-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strncpy-chk-lib.c new file mode 100644 index 000000000..9daf13e82 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strncpy-chk-lib.c @@ -0,0 +1 @@ +#include "lib/chk.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strncpy-chk.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strncpy-chk.c new file mode 100644 index 000000000..9e10dba1b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strncpy-chk.c @@ -0,0 +1,227 @@ +/* Copyright (C) 2004, 2005 Free Software Foundation. + + Ensure builtin __strncpy_chk performs correctly. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern size_t strlen(const char *); +extern void *memcpy (void *, const void *, size_t); +extern char *strncpy (char *, const char *, size_t); +extern int memcmp (const void *, const void *, size_t); +extern int strcmp (const char *, const char *); +extern int strncmp (const char *, const char *, size_t); +extern void *memset (void *, int, size_t); + +#include "chk.h" + +const char s1[] = "123"; +char p[32] = ""; +char * volatile s2 = "defg"; /* prevent constant propagation to happen when whole program assumptions are made. */ +char * volatile s3 = "FGH"; /* prevent constant propagation to happen when whole program assumptions are made. */ +char *s4; +volatile size_t l1 = 1; /* prevent constant propagation to happen when whole program assumptions are made. */ +int i; + +void +__attribute__((noinline)) +test1 (void) +{ + const char *const src = "hello world"; + const char *src2; + char dst[64], *dst2; + + strncpy_disallowed = 1; + chk_calls = 0; + + memset (dst, 0, sizeof (dst)); + if (strncpy (dst, src, 4) != dst || strncmp (dst, src, 4)) + abort(); + + memset (dst, 0, sizeof (dst)); + if (strncpy (dst+16, src, 4) != dst+16 || strncmp (dst+16, src, 4)) + abort(); + + memset (dst, 0, sizeof (dst)); + if (strncpy (dst+32, src+5, 4) != dst+32 || strncmp (dst+32, src+5, 4)) + abort(); + + memset (dst, 0, sizeof (dst)); + dst2 = dst; + if (strncpy (++dst2, src+5, 4) != dst+1 || strncmp (dst2, src+5, 4) + || dst2 != dst+1) + abort(); + + memset (dst, 0, sizeof (dst)); + if (strncpy (dst, src, 0) != dst || strcmp (dst, "")) + abort(); + + memset (dst, 0, sizeof (dst)); + dst2 = dst; src2 = src; + if (strncpy (++dst2, ++src2, 0) != dst+1 || strcmp (dst2, "") + || dst2 != dst+1 || src2 != src+1) + abort(); + + memset (dst, 0, sizeof (dst)); + dst2 = dst; src2 = src; + if (strncpy (++dst2+5, ++src2+5, 0) != dst+6 || strcmp (dst2+5, "") + || dst2 != dst+1 || src2 != src+1) + abort(); + + memset (dst, 0, sizeof (dst)); + if (strncpy (dst, src, 12) != dst || strcmp (dst, src)) + abort(); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + memset (dst, 0, sizeof (dst)); + if (__builtin_strncpy (dst, src, 4) != dst || strncmp (dst, src, 4)) + abort(); + + memset (dst, 0, sizeof (dst)); + if (strncpy (dst, i++ ? "xfoo" + 1 : "bar", 4) != dst + || strcmp (dst, "bar") + || i != 1) + abort (); + + if (chk_calls) + abort (); + strncpy_disallowed = 0; +} + +void +__attribute__((noinline)) +test2 (void) +{ + chk_calls = 0; + /* No runtime checking should be done here, both destination + and length are unknown. */ + strncpy (s4, "abcd", l1 + 1); + if (chk_calls) + abort (); +} + +/* Test whether compile time checking is done where it should + and so is runtime object size checking. */ +void +__attribute__((noinline)) +test3 (void) +{ + struct A { char buf1[10]; char buf2[10]; } a; + char *r = l1 == 1 ? &a.buf1[5] : &a.buf2[4]; + char buf3[20]; + int i; + const char *l; + size_t l2; + + /* The following calls should do runtime checking + - source length is not known, but destination is. */ + chk_calls = 0; + strncpy (a.buf1 + 2, s3 + 3, l1); + strncpy (r, s3 + 2, l1 + 2); + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + strncpy (r, s2 + 2, l1 + 2); + strncpy (r + 2, s3 + 3, l1); + r = buf3; + for (i = 0; i < 4; ++i) + { + if (i == l1 - 1) + r = &a.buf1[1]; + else if (i == l1) + r = &a.buf2[7]; + else if (i == l1 + 1) + r = &buf3[5]; + else if (i == l1 + 2) + r = &a.buf1[9]; + } + strncpy (r, s2 + 4, l1); + if (chk_calls != 5) + abort (); + + /* Following have known destination and known length, + so if optimizing certainly shouldn't result in the checking + variants. */ + chk_calls = 0; + strncpy (a.buf1 + 2, "", 3); + strncpy (a.buf1 + 2, "", 0); + strncpy (r, "a", 1); + strncpy (r, "a", 3); + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + strncpy (r, s1 + 1, 3); + strncpy (r, s1 + 1, 2); + r = buf3; + l = "abc"; + l2 = 4; + for (i = 0; i < 4; ++i) + { + if (i == l1 - 1) + r = &a.buf1[1], l = "e", l2 = 2; + else if (i == l1) + r = &a.buf2[7], l = "gh", l2 = 3; + else if (i == l1 + 1) + r = &buf3[5], l = "jkl", l2 = 4; + else if (i == l1 + 2) + r = &a.buf1[9], l = "", l2 = 1; + } + strncpy (r, "", 1); + /* Here, strlen (l) + 1 is known to be at most 4 and + __builtin_object_size (&buf3[16], 0) is 4, so this doesn't need + runtime checking. */ + strncpy (&buf3[16], l, l2); + strncpy (&buf3[15], "abc", l2); + strncpy (&buf3[10], "fghij", l2); + if (chk_calls) + abort (); + chk_calls = 0; +} + +/* Test whether runtime and/or compile time checking catches + buffer overflows. */ +void +__attribute__((noinline)) +test4 (void) +{ + struct A { char buf1[10]; char buf2[10]; } a; + char buf3[20]; + + chk_fail_allowed = 1; + /* Runtime checks. */ + if (__builtin_setjmp (chk_fail_buf) == 0) + { + strncpy (&a.buf2[9], s2 + 4, l1 + 1); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + strncpy (&a.buf2[7], s3, l1 + 4); + abort (); + } + /* This should be detectable at compile time already. */ + if (__builtin_setjmp (chk_fail_buf) == 0) + { + strncpy (&buf3[19], "abc", 2); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + strncpy (&buf3[18], "", 3); + abort (); + } + chk_fail_allowed = 0; +} + +void +main_test (void) +{ +#ifndef __OPTIMIZE__ + /* Object size checking is only intended for -O[s123]. */ + return; +#endif + __asm ("" : "=r" (s2) : "0" (s2)); + __asm ("" : "=r" (s3) : "0" (s3)); + __asm ("" : "=r" (l1) : "0" (l1)); + test1 (); + s4 = p; + test2 (); + test3 (); + test4 (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strncpy-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strncpy-lib.c new file mode 100644 index 000000000..784f72d03 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strncpy-lib.c @@ -0,0 +1 @@ +#include "lib/strncpy.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strncpy.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strncpy.c new file mode 100644 index 000000000..9918cdf6a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strncpy.c @@ -0,0 +1,75 @@ +/* Copyright (C) 2000, 2005 Free Software Foundation. + + Ensure all expected transformations of builtin strncpy occur and + perform correctly. + + Written by Kaveh R. Ghazi, 11/25/2000. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern char *strncpy (char *, const char *, size_t); +extern int memcmp (const void *, const void *, size_t); +extern void *memset (void *, int, size_t); + +/* Reset the destination buffer to a known state. */ +#define RESET_DST memset(dst, 'X', sizeof(dst)) + +int i; + +void +main_test (void) +{ + const char *const src = "hello world"; + const char *src2; + char dst[64], *dst2; + + RESET_DST; + if (strncpy (dst, src, 4) != dst || memcmp (dst, "hellXXX", 7)) + abort(); + + RESET_DST; + if (strncpy (dst+16, src, 4) != dst+16 || memcmp (dst+16, "hellXXX", 7)) + abort(); + + RESET_DST; + if (strncpy (dst+32, src+5, 4) != dst+32 || memcmp (dst+32, " worXXX", 7)) + abort(); + + RESET_DST; + dst2 = dst; + if (strncpy (++dst2, src+5, 4) != dst+1 || memcmp (dst2, " worXXX", 7) + || dst2 != dst+1) + abort(); + + RESET_DST; + if (strncpy (dst, src, 0) != dst || memcmp (dst, "XXX", 3)) + abort(); + + RESET_DST; + dst2 = dst; src2 = src; + if (strncpy (++dst2, ++src2, 0) != dst+1 || memcmp (dst2, "XXX", 3) + || dst2 != dst+1 || src2 != src+1) + abort(); + + RESET_DST; + dst2 = dst; src2 = src; + if (strncpy (++dst2+5, ++src2+5, 0) != dst+6 || memcmp (dst2+5, "XXX", 3) + || dst2 != dst+1 || src2 != src+1) + abort(); + + RESET_DST; + if (strncpy (dst, src, 12) != dst || memcmp (dst, "hello world\0XXX", 15)) + abort(); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + RESET_DST; + if (__builtin_strncpy (dst, src, 4) != dst || memcmp (dst, "hellXXX", 7)) + abort(); + + RESET_DST; + if (strncpy (dst, i++ ? "xfoo" + 1 : "bar", 4) != dst + || memcmp (dst, "bar\0XXX", 7) + || i != 1) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strpbrk-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strpbrk-lib.c new file mode 100644 index 000000000..66bf8be7c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strpbrk-lib.c @@ -0,0 +1 @@ +#include "lib/strpbrk.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strpbrk.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strpbrk.c new file mode 100644 index 000000000..cc963a9af --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strpbrk.c @@ -0,0 +1,42 @@ +/* Copyright (C) 2000 Free Software Foundation. + + Ensure all expected transformations of builtin strpbrk occur and + perform correctly. + + Written by Kaveh R. Ghazi, 11/6/2000. */ + +extern void abort(void); +extern char *strpbrk (const char *, const char *); +extern int strcmp (const char *, const char *); + +void fn (const char *foo, const char *const *bar) +{ + if (strcmp(strpbrk ("hello world", "lrooo"), "llo world") != 0) + abort(); + if (strpbrk (foo, "") != 0) + abort(); + if (strpbrk (foo + 4, "") != 0) + abort(); + if (strpbrk (*bar--, "") != 0) + abort(); + if (strpbrk (*bar, "h") != foo) + abort(); + if (strpbrk (foo, "h") != foo) + abort(); + if (strpbrk (foo, "w") != foo + 6) + abort(); + if (strpbrk (foo + 6, "o") != foo + 7) + abort(); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + if (__builtin_strpbrk (foo + 6, "o") != foo + 7) + abort(); +} + +void +main_test (void) +{ + const char *const foo[] = { "hello world", "bye bye world" }; + fn (foo[0], foo + 1); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strpcpy-2-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strpcpy-2-lib.c new file mode 100644 index 000000000..b31cdf4f5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strpcpy-2-lib.c @@ -0,0 +1 @@ +#include "lib/stpcpy.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strpcpy-2.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strpcpy-2.c new file mode 100644 index 000000000..eb275c422 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strpcpy-2.c @@ -0,0 +1,45 @@ +/* Copyright (C) 2003 Free Software Foundation. + + Ensure that builtin stpcpy performs correctly. + + Written by Jakub Jelinek, 21/05/2003. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern int memcmp (const void *, const void *, size_t); +extern char *stpcpy (char *, const char *); +extern int inside_main; + +long buf1[64]; +char *buf2 = (char *) (buf1 + 32); +long buf5[20]; +char buf7[20]; + +void +__attribute__((noinline)) +test (long *buf3, char *buf4, char *buf6, int n) +{ + int i = 4; + + if (stpcpy ((char *) buf3, "abcdefghijklmnop") != (char *) buf1 + 16 + || memcmp (buf1, "abcdefghijklmnop", 17)) + abort (); + + if (__builtin_stpcpy ((char *) buf3, "ABCDEFG") != (char *) buf1 + 7 + || memcmp (buf1, "ABCDEFG\0ijklmnop", 17)) + abort (); + + if (stpcpy ((char *) buf3 + i++, "x") != (char *) buf1 + 5 + || memcmp (buf1, "ABCDx\0G\0ijklmnop", 17)) + abort (); +} + +void +main_test (void) +{ + /* All these tests are allowed to call mempcpy/stpcpy. */ + inside_main = 0; + __builtin_memcpy (buf5, "RSTUVWXYZ0123456789", 20); + __builtin_memcpy (buf7, "RSTUVWXYZ0123456789", 20); + test (buf1, buf2, "rstuvwxyz", 0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strpcpy-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strpcpy-lib.c new file mode 100644 index 000000000..b31cdf4f5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strpcpy-lib.c @@ -0,0 +1 @@ +#include "lib/stpcpy.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strpcpy.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strpcpy.c new file mode 100644 index 000000000..737bfaa80 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strpcpy.c @@ -0,0 +1,60 @@ +/* Copyright (C) 2003, 2004 Free Software Foundation. + + Ensure builtin stpcpy performs correctly. + + Written by Kaveh Ghazi, 4/11/2003. */ + +typedef __SIZE_TYPE__ size_t; + +extern void abort (void); +extern char *strcpy (char *, const char *); +extern char *stpcpy (char *, const char *); +extern int memcmp (const void *, const void *, size_t); + +extern int inside_main; + +const char s1[] = "123"; +char p[32] = ""; +char *s2 = "defg"; +char *s3 = "FGH"; +size_t l1 = 1; + +void +main_test (void) +{ + int i = 8; + +#if !defined __i386__ && !defined __x86_64__ + /* The functions below might not be optimized into direct stores on all + arches. It depends on how many instructions would be generated and + what limits the architecture chooses in STORE_BY_PIECES_P. */ + inside_main = 0; +#endif + if (stpcpy (p, "abcde") != p + 5 || memcmp (p, "abcde", 6)) + abort (); + if (stpcpy (p + 16, "vwxyz" + 1) != p + 16 + 4 || memcmp (p + 16, "wxyz", 5)) + abort (); + if (stpcpy (p + 1, "") != p + 1 + 0 || memcmp (p, "a\0cde", 6)) + abort (); + if (stpcpy (p + 3, "fghij") != p + 3 + 5 || memcmp (p, "a\0cfghij", 9)) + abort (); + + if (stpcpy ((i++, p + 20 + 1), "23") != (p + 20 + 1 + 2) + || i != 9 || memcmp (p + 19, "z\0""23\0", 5)) + abort (); + + if (stpcpy (stpcpy (p, "ABCD"), "EFG") != p + 7 || memcmp (p, "ABCDEFG", 8)) + abort(); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + if (__builtin_stpcpy (p, "abcde") != p + 5 || memcmp (p, "abcde", 6)) + abort (); + + /* If the result of stpcpy is ignored, gcc should use strcpy. + This should be optimized always, so set inside_main again. */ + inside_main = 1; + stpcpy (p + 3, s3); + if (memcmp (p, "abcFGH", 6)) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strrchr-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strrchr-lib.c new file mode 100644 index 000000000..9194c555f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strrchr-lib.c @@ -0,0 +1,8 @@ +#include "lib/strrchr.c" +#ifdef __vxworks +/* The RTP C library uses bzero, bfill and bcopy, all of which are defined + in the same file as rindex. */ +#include "lib/bzero.c" +#include "lib/bfill.c" +#include "lib/memmove.c" +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strrchr.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strrchr.c new file mode 100644 index 000000000..3cc8faa2e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strrchr.c @@ -0,0 +1,49 @@ +/* Copyright (C) 2000, 2003, 2004 Free Software Foundation. + + Ensure all expected transformations of builtin strrchr and rindex + occur and perform correctly. + + Written by Jakub Jelinek, 11/7/2000. */ + +extern void abort (void); +extern char *strrchr (const char *, int); +extern char *rindex (const char *, int); + +char *bar = "hi world"; +int x = 7; + +void +main_test (void) +{ + const char *const foo = "hello world"; + + if (strrchr (foo, 'x')) + abort (); + if (strrchr (foo, 'o') != foo + 7) + abort (); + if (strrchr (foo, 'e') != foo + 1) + abort (); + if (strrchr (foo + 3, 'e')) + abort (); + if (strrchr (foo, '\0') != foo + 11) + abort (); + if (strrchr (bar, '\0') != bar + 8) + abort (); + if (strrchr (bar + 4, '\0') != bar + 8) + abort (); + if (strrchr (bar + (x++ & 3), '\0') != bar + 8) + abort (); + if (x != 8) + abort (); + /* Test only one instance of rindex since the code path is the same + as that of strrchr. */ + if (rindex ("hello", 'z') != 0) + abort (); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + if (__builtin_strrchr (foo, 'o') != foo + 7) + abort (); + if (__builtin_rindex (foo, 'o') != foo + 7) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strspn-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strspn-lib.c new file mode 100644 index 000000000..9e044d793 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strspn-lib.c @@ -0,0 +1 @@ +#include "lib/strspn.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strspn.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strspn.c new file mode 100644 index 000000000..4f2782a58 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strspn.c @@ -0,0 +1,54 @@ +/* Copyright (C) 2000 Free Software Foundation. + + Ensure all expected transformations of builtin strspn occur and + perform correctly. + + Written by Kaveh R. Ghazi, 11/27/2000. */ + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern size_t strspn (const char *, const char *); +extern char *strcpy (char *, const char *); + +void +main_test (void) +{ + const char *const s1 = "hello world"; + char dst[64], *d2; + + if (strspn (s1, "hello") != 5) + abort(); + if (strspn (s1+4, "hello") != 1) + abort(); + if (strspn (s1, "z") != 0) + abort(); + if (strspn (s1, "hello world") != 11) + abort(); + if (strspn (s1, "") != 0) + abort(); + strcpy (dst, s1); + if (strspn (dst, "") != 0) + abort(); + strcpy (dst, s1); d2 = dst; + if (strspn (++d2, "") != 0 || d2 != dst+1) + abort(); + strcpy (dst, s1); d2 = dst; + if (strspn (++d2+5, "") != 0 || d2 != dst+1) + abort(); + if (strspn ("", s1) != 0) + abort(); + strcpy (dst, s1); + if (strspn ("", dst) != 0) + abort(); + strcpy (dst, s1); d2 = dst; + if (strspn ("", ++d2) != 0 || d2 != dst+1) + abort(); + strcpy (dst, s1); d2 = dst; + if (strspn ("", ++d2+5) != 0 || d2 != dst+1) + abort(); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + if (__builtin_strspn (s1, "hello") != 5) + abort(); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strstr-asm-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strstr-asm-lib.c new file mode 100644 index 000000000..a031a56a9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strstr-asm-lib.c @@ -0,0 +1,37 @@ +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern size_t strlen(const char *); +extern char *strchr(const char *, int); +extern int strcmp(const char *, const char *); +extern int strncmp(const char *, const char *, size_t); +extern int inside_main; +extern const char *p; + +char * +my_strstr (const char *s1, const char *s2) +{ + const size_t len = strlen (s2); + +#ifdef __OPTIMIZE__ + /* If optimizing, we should be called only in the strstr (foo + 2, p) + case. All other cases should be optimized. */ + if (inside_main) + if (s2 != p || strcmp (s1, "hello world" + 2) != 0) + abort (); +#endif + if (len == 0) + return (char *) s1; + for (s1 = strchr (s1, *s2); s1; s1 = strchr (s1 + 1, *s2)) + if (strncmp (s1, s2, len) == 0) + return (char *) s1; + return (char *) 0; +} + +char * +strstr (const char *s1, const char *s2) +{ + if (inside_main) + abort (); + + return my_strstr (s1, s2); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strstr-asm.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strstr-asm.c new file mode 100644 index 000000000..3c3e45dfa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strstr-asm.c @@ -0,0 +1,45 @@ +/* Copyright (C) 2000, 2003 Free Software Foundation. + + Ensure all expected transformations of builtin strstr occur and + perform correctly in presence of redirect. */ + +#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname) +#define ASMNAME2(prefix, cname) STRING (prefix) cname +#define STRING(x) #x + +typedef __SIZE_TYPE__ size_t; +extern void abort (void); +extern char *strstr (const char *, const char *) + __asm (ASMNAME ("my_strstr")); + +const char *p = "rld", *q = "hello world"; + +void +main_test (void) +{ + const char *const foo = "hello world"; + + if (strstr (foo, "") != foo) + abort (); + if (strstr (foo + 4, "") != foo + 4) + abort (); + if (strstr (foo, "h") != foo) + abort (); + if (strstr (foo, "w") != foo + 6) + abort (); + if (strstr (foo + 6, "o") != foo + 7) + abort (); + if (strstr (foo + 1, "world") != foo + 6) + abort (); + if (strstr (foo + 2, p) != foo + 8) + abort (); + if (strstr (q, "") != q) + abort (); + if (strstr (q + 1, "o") != q + 4) + abort (); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + if (__builtin_strstr (foo + 1, "world") != foo + 6) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strstr-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strstr-lib.c new file mode 100644 index 000000000..591058de4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strstr-lib.c @@ -0,0 +1 @@ +#include "lib/strstr.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strstr.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strstr.c new file mode 100644 index 000000000..ae503aa43 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strstr.c @@ -0,0 +1,33 @@ +/* Copyright (C) 2000 Free Software Foundation. + + Ensure all expected transformations of builtin strstr occur and + perform correctly. + + Written by Kaveh R. Ghazi, 11/6/2000. */ + +extern void abort(void); +extern char *strstr (const char *, const char *); + +void +main_test (void) +{ + const char *const foo = "hello world"; + + if (strstr (foo, "") != foo) + abort(); + if (strstr (foo + 4, "") != foo + 4) + abort(); + if (strstr (foo, "h") != foo) + abort(); + if (strstr (foo, "w") != foo + 6) + abort(); + if (strstr (foo + 6, "o") != foo + 7) + abort(); + if (strstr (foo + 1, "world") != foo + 6) + abort(); + + /* Test at least one instance of the __builtin_ style. We do this + to ensure that it works and that the prototype is correct. */ + if (__builtin_strstr (foo + 1, "world") != foo + 6) + abort(); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c new file mode 100644 index 000000000..9daf13e82 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c @@ -0,0 +1 @@ +#include "lib/chk.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/vsnprintf-chk.c b/gcc/testsuite/gcc.c-torture/execute/builtins/vsnprintf-chk.c new file mode 100644 index 000000000..8a3f37203 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/vsnprintf-chk.c @@ -0,0 +1,321 @@ +/* Copyright (C) 2004, 2005 Free Software Foundation. + + Ensure builtin __vsnprintf_chk performs correctly. */ + +#include + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern size_t strlen(const char *); +extern void *memcpy (void *, const void *, size_t); +extern char *strcpy (char *, const char *); +extern int memcmp (const void *, const void *, size_t); +extern void *memset (void *, int, size_t); +extern int vsnprintf (char *, size_t, const char *, va_list); + +#include "chk.h" + +const char s1[] = "123"; +char p[32] = ""; +char *s2 = "defg"; +char *s3 = "FGH"; +char *s4; +size_t l1 = 1; +static char buffer[32]; +char * volatile ptr = "barf"; /* prevent constant propagation to happen when whole program assumptions are made. */ + +int +__attribute__((noinline)) +test1_sub (int i, ...) +{ + int ret = 0; + va_list ap; + va_start (ap, i); + switch (i) + { + case 0: + vsnprintf (buffer, 4, "foo", ap); + break; + case 1: + ret = vsnprintf (buffer, 4, "foo bar", ap); + break; + case 2: + vsnprintf (buffer, 32, "%s", ap); + break; + case 3: + ret = vsnprintf (buffer, 21, "%s", ap); + break; + case 4: + ret = vsnprintf (buffer, 4, "%d%d%d", ap); + break; + case 5: + ret = vsnprintf (buffer, 32, "%d%d%d", ap); + break; + case 6: + ret = vsnprintf (buffer, strlen (ptr) + 1, "%s", ap); + break; + case 7: + vsnprintf (buffer, l1 + 31, "%d - %c", ap); + break; + case 8: + vsnprintf (s4, l1 + 6, "%d - %c", ap); + break; + } + va_end (ap); + return ret; +} + +void +__attribute__((noinline)) +test1 (void) +{ + chk_calls = 0; + /* vsnprintf_disallowed = 1; */ + + memset (buffer, 'A', 32); + test1_sub (0); + if (memcmp (buffer, "foo", 4) || buffer[4] != 'A') + abort (); + + memset (buffer, 'A', 32); + if (test1_sub (1) != 7) + abort (); + if (memcmp (buffer, "foo", 4) || buffer[4] != 'A') + abort (); + + vsnprintf_disallowed = 0; + + memset (buffer, 'A', 32); + test1_sub (2, "bar"); + if (memcmp (buffer, "bar", 4) || buffer[4] != 'A') + abort (); + + memset (buffer, 'A', 32); + if (test1_sub (3, "bar") != 3) + abort (); + if (memcmp (buffer, "bar", 4) || buffer[4] != 'A') + abort (); + + memset (buffer, 'A', 32); + if (test1_sub (4, (int) l1, (int) l1 + 1, (int) l1 + 12) != 4) + abort (); + if (memcmp (buffer, "121", 4) || buffer[4] != 'A') + abort (); + + memset (buffer, 'A', 32); + if (test1_sub (5, (int) l1, (int) l1 + 1, (int) l1 + 12) != 4) + abort (); + if (memcmp (buffer, "1213", 5) || buffer[5] != 'A') + abort (); + + if (chk_calls) + abort (); + + memset (buffer, 'A', 32); + test1_sub (6, ptr); + if (memcmp (buffer, "barf", 5) || buffer[5] != 'A') + abort (); + + memset (buffer, 'A', 32); + test1_sub (7, (int) l1 + 27, *ptr); + if (memcmp (buffer, "28 - b\0AAAAA", 12)) + abort (); + + if (chk_calls != 2) + abort (); + chk_calls = 0; + + memset (s4, 'A', 32); + test1_sub (8, (int) l1 - 17, ptr[1]); + if (memcmp (s4, "-16 - \0AAA", 10)) + abort (); + if (chk_calls) + abort (); +} + +void +__attribute__((noinline)) +test2_sub (int i, ...) +{ + va_list ap; + struct A { char buf1[10]; char buf2[10]; } a; + char *r = l1 == 1 ? &a.buf1[5] : &a.buf2[4]; + char buf3[20]; + int j; + + va_start (ap, i); + /* The following calls should do runtime checking + - length is not known, but destination is. */ + switch (i) + { + case 0: + vsnprintf (a.buf1 + 2, l1, "%s", ap); + break; + case 1: + vsnprintf (r, l1 + 4, "%s%c", ap); + break; + case 2: + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + vsnprintf (r, strlen (s2) - 2, "%c %s", ap); + break; + case 3: + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + vsnprintf (r + 2, l1, s3 + 3, ap); + break; + case 4: + case 7: + r = buf3; + for (j = 0; j < 4; ++j) + { + if (j == l1 - 1) + r = &a.buf1[1]; + else if (j == l1) + r = &a.buf2[7]; + else if (j == l1 + 1) + r = &buf3[5]; + else if (j == l1 + 2) + r = &a.buf1[9]; + } + if (i == 4) + vsnprintf (r, l1, s2 + 4, ap); + else + vsnprintf (r, 1, "a", ap); + break; + case 5: + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + vsnprintf (r, l1 + 3, "%s", ap); + break; + case 6: + vsnprintf (a.buf1 + 2, 4, "", ap); + break; + case 8: + vsnprintf (s4, 3, "%s %d", ap); + break; + } + va_end (ap); +} + +/* Test whether compile time checking is done where it should + and so is runtime object size checking. */ +void +__attribute__((noinline)) +test2 (void) +{ + /* The following calls should do runtime checking + - length is not known, but destination is. */ + chk_calls = 0; + test2_sub (0, s3 + 3); + test2_sub (1, s3 + 3, s3[3]); + test2_sub (2, s2[2], s2 + 4); + test2_sub (3); + test2_sub (4); + test2_sub (5, s1 + 1); + if (chk_calls != 6) + abort (); + + /* Following have known destination and known source length, + so if optimizing certainly shouldn't result in the checking + variants. */ + chk_calls = 0; + /* vsnprintf_disallowed = 1; */ + test2_sub (6); + test2_sub (7); + vsnprintf_disallowed = 0; + /* Unknown destination and source, no checking. */ + test2_sub (8, s3, 0); + if (chk_calls) + abort (); +} + +void +__attribute__((noinline)) +test3_sub (int i, ...) +{ + va_list ap; + struct A { char buf1[10]; char buf2[10]; } a; + char buf3[20]; + + va_start (ap, i); + /* The following calls should do runtime checking + - source length is not known, but destination is. */ + switch (i) + { + case 0: + vsnprintf (&a.buf2[9], l1 + 1, "%c%s", ap); + break; + case 1: + vsnprintf (&a.buf2[7], l1 + 30, "%s%c", ap); + break; + case 2: + vsnprintf (&a.buf2[7], l1 + 3, "%d", ap); + break; + case 3: + vsnprintf (&buf3[17], l1 + 3, "%s", ap); + break; + case 4: + vsnprintf (&buf3[19], 2, "a", ap); + break; + case 5: + vsnprintf (&buf3[16], 5, "a", ap); + break; + } + va_end (ap); +} + +/* Test whether runtime and/or compile time checking catches + buffer overflows. */ +void +__attribute__((noinline)) +test3 (void) +{ + chk_fail_allowed = 1; + /* Runtime checks. */ + if (__builtin_setjmp (chk_fail_buf) == 0) + { + test3_sub (0, s2[3], s2 + 4); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + test3_sub (1, s3 + strlen (s3) - 2, *s3); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + test3_sub (2, (int) l1 + 9999); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + test3_sub (3, "abc"); + abort (); + } + /* This should be detectable at compile time already. */ + if (__builtin_setjmp (chk_fail_buf) == 0) + { + test3_sub (4); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + test3_sub (5); + abort (); + } + chk_fail_allowed = 0; +} + +void +main_test (void) +{ +#ifndef __OPTIMIZE__ + /* Object size checking is only intended for -O[s123]. */ + return; +#endif + __asm ("" : "=r" (s2) : "0" (s2)); + __asm ("" : "=r" (s3) : "0" (s3)); + __asm ("" : "=r" (l1) : "0" (l1)); + s4 = p; + test1 (); + test2 (); + test3 (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/vsprintf-chk-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/vsprintf-chk-lib.c new file mode 100644 index 000000000..9daf13e82 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/vsprintf-chk-lib.c @@ -0,0 +1 @@ +#include "lib/chk.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/vsprintf-chk.c b/gcc/testsuite/gcc.c-torture/execute/builtins/vsprintf-chk.c new file mode 100644 index 000000000..5649b9e90 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/vsprintf-chk.c @@ -0,0 +1,290 @@ +/* Copyright (C) 2004, 2005 Free Software Foundation. + + Ensure builtin __vsprintf_chk performs correctly. */ + +#include + +extern void abort (void); +typedef __SIZE_TYPE__ size_t; +extern size_t strlen(const char *); +extern void *memcpy (void *, const void *, size_t); +extern char *strcpy (char *, const char *); +extern int memcmp (const void *, const void *, size_t); +extern void *memset (void *, int, size_t); +extern int vsprintf (char *, const char *, va_list); + +#include "chk.h" + +const char s1[] = "123"; +char p[32] = ""; +char *s2 = "defg"; +char *s3 = "FGH"; +char *s4; +size_t l1 = 1; +static char buffer[32]; +char * volatile ptr = "barf"; /* prevent constant propagation to happen when whole program assumptions are made. */ + +int +__attribute__((noinline)) +test1_sub (int i, ...) +{ + int ret = 0; + va_list ap; + va_start (ap, i); + switch (i) + { + case 0: + vsprintf (buffer, "foo", ap); + break; + case 1: + ret = vsprintf (buffer, "foo", ap); + break; + case 2: + vsprintf (buffer, "%s", ap); + break; + case 3: + ret = vsprintf (buffer, "%s", ap); + break; + case 4: + vsprintf (buffer, "%d - %c", ap); + break; + case 5: + vsprintf (s4, "%d - %c", ap); + break; + } + va_end (ap); + return ret; +} + +void +__attribute__((noinline)) +test1 (void) +{ + chk_calls = 0; + vsprintf_disallowed = 1; + + memset (buffer, 'A', 32); + test1_sub (0); + if (memcmp (buffer, "foo", 4) || buffer[4] != 'A') + abort (); + + memset (buffer, 'A', 32); + if (test1_sub (1) != 3) + abort (); + if (memcmp (buffer, "foo", 4) || buffer[4] != 'A') + abort (); + + if (chk_calls) + abort (); + vsprintf_disallowed = 0; + + memset (buffer, 'A', 32); + test1_sub (2, "bar"); + if (memcmp (buffer, "bar", 4) || buffer[4] != 'A') + abort (); + + memset (buffer, 'A', 32); + if (test1_sub (3, "bar") != 3) + abort (); + if (memcmp (buffer, "bar", 4) || buffer[4] != 'A') + abort (); + + memset (buffer, 'A', 32); + test1_sub (2, ptr); + if (memcmp (buffer, "barf", 5) || buffer[5] != 'A') + abort (); + + memset (buffer, 'A', 32); + test1_sub (4, (int) l1 + 27, *ptr); + if (memcmp (buffer, "28 - b\0AAAAA", 12)) + abort (); + + if (chk_calls != 4) + abort (); + chk_calls = 0; + + test1_sub (5, (int) l1 - 17, ptr[1]); + if (memcmp (s4, "-16 - a", 8)) + abort (); + if (chk_calls) + abort (); +} + +void +__attribute__((noinline)) +test2_sub (int i, ...) +{ + va_list ap; + struct A { char buf1[10]; char buf2[10]; } a; + char *r = l1 == 1 ? &a.buf1[5] : &a.buf2[4]; + char buf3[20]; + int j; + + va_start (ap, i); + /* The following calls should do runtime checking + - source length is not known, but destination is. */ + switch (i) + { + case 0: + vsprintf (a.buf1 + 2, "%s", ap); + break; + case 1: + vsprintf (r, "%s%c", ap); + break; + case 2: + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + vsprintf (r, "%c %s", ap); + break; + case 3: + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + vsprintf (r + 2, s3 + 3, ap); + break; + case 4: + case 7: + r = buf3; + for (j = 0; j < 4; ++j) + { + if (j == l1 - 1) + r = &a.buf1[1]; + else if (j == l1) + r = &a.buf2[7]; + else if (j == l1 + 1) + r = &buf3[5]; + else if (j == l1 + 2) + r = &a.buf1[9]; + } + if (i == 4) + vsprintf (r, s2 + 4, ap); + else + vsprintf (r, "a", ap); + break; + case 5: + r = l1 == 1 ? __builtin_alloca (4) : &a.buf2[7]; + vsprintf (r, "%s", ap); + break; + case 6: + vsprintf (a.buf1 + 2, "", ap); + break; + case 8: + vsprintf (s4, "%s %d", ap); + break; + } + va_end (ap); +} + +/* Test whether compile time checking is done where it should + and so is runtime object size checking. */ +void +__attribute__((noinline)) +test2 (void) +{ + /* The following calls should do runtime checking + - source length is not known, but destination is. */ + chk_calls = 0; + test2_sub (0, s3 + 3); + test2_sub (1, s3 + 3, s3[3]); + test2_sub (2, s2[2], s2 + 4); + test2_sub (3); + test2_sub (4); + test2_sub (5, s1 + 1); + if (chk_calls != 6) + abort (); + + /* Following have known destination and known source length, + so if optimizing certainly shouldn't result in the checking + variants. */ + chk_calls = 0; + vsprintf_disallowed = 1; + test2_sub (6); + test2_sub (7); + vsprintf_disallowed = 0; + /* Unknown destination and source, no checking. */ + test2_sub (8, s3, 0); + if (chk_calls) + abort (); +} + +void +__attribute__((noinline)) +test3_sub (int i, ...) +{ + va_list ap; + struct A { char buf1[10]; char buf2[10]; } a; + char buf3[20]; + + va_start (ap, i); + /* The following calls should do runtime checking + - source length is not known, but destination is. */ + switch (i) + { + case 0: + vsprintf (&a.buf2[9], "%c%s", ap); + break; + case 1: + vsprintf (&a.buf2[7], "%s%c", ap); + break; + case 2: + vsprintf (&a.buf2[7], "%d", ap); + break; + case 3: + vsprintf (&buf3[17], "%s", ap); + break; + case 4: + vsprintf (&buf3[19], "a", ap); + break; + } + va_end (ap); +} + +/* Test whether runtime and/or compile time checking catches + buffer overflows. */ +void +__attribute__((noinline)) +test3 (void) +{ + chk_fail_allowed = 1; + /* Runtime checks. */ + if (__builtin_setjmp (chk_fail_buf) == 0) + { + test3_sub (0, s2[3], s2 + 4); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + test3_sub (1, s3 + strlen (s3) - 2, *s3); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + test3_sub (2, (int) l1 + 9999); + abort (); + } + if (__builtin_setjmp (chk_fail_buf) == 0) + { + test3_sub (3, "abc"); + abort (); + } + /* This should be detectable at compile time already. */ + if (__builtin_setjmp (chk_fail_buf) == 0) + { + test3_sub (4); + abort (); + } + chk_fail_allowed = 0; +} + +void +main_test (void) +{ +#ifndef __OPTIMIZE__ + /* Object size checking is only intended for -O[s123]. */ + return; +#endif + __asm ("" : "=r" (s2) : "0" (s2)); + __asm ("" : "=r" (s3) : "0" (s3)); + __asm ("" : "=r" (l1) : "0" (l1)); + s4 = p; + test1 (); + test2 (); + test3 (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/call-trap-1.c b/gcc/testsuite/gcc.c-torture/execute/call-trap-1.c new file mode 100644 index 000000000..aa226e745 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/call-trap-1.c @@ -0,0 +1,26 @@ +/* Undefined behavior from a call to a function cast to a different + type does not appear until after the function designator and + arguments have been evaluated. PR 38483. */ +/* Origin: Joseph Myers */ + +extern void exit (int); +extern void abort (void); + +int +foo (void) +{ + exit (0); + return 0; +} + +void +bar (void) +{ +} + +int +main (void) +{ + ((long (*)(int))bar) (foo ()); + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/cbrt.c b/gcc/testsuite/gcc.c-torture/execute/cbrt.c new file mode 100644 index 000000000..8659cc7a7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/cbrt.c @@ -0,0 +1,92 @@ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== +*/ + +#ifndef __vax__ +static const unsigned long + B1 = 715094163, /* B1 = (682-0.03306235651)*2**20 */ + B2 = 696219795; /* B2 = (664-0.03306235651)*2**20 */ + +static const double + C = 5.42857142857142815906e-01, /* 19/35 = 0x3FE15F15, 0xF15F15F1 */ + D = -7.05306122448979611050e-01, /* -864/1225 = 0xBFE691DE, 0x2532C834 */ + E = 1.41428571428571436819e+00, /* 99/70 = 0x3FF6A0EA, 0x0EA0EA0F */ + F = 1.60714285714285720630e+00, /* 45/28 = 0x3FF9B6DB, 0x6DB6DB6E */ + G = 3.57142857142857150787e-01; /* 5/14 = 0x3FD6DB6D, 0xB6DB6DB7 */ + +double +cbrtl (double x) +{ + long hx; + double r,s,w; + double lt; + unsigned sign; + typedef unsigned unsigned32 __attribute__((mode(SI))); + union { + double t; + unsigned32 pt[2]; + } ut, ux; + int n0; + + ut.t = 1.0; + n0 = (ut.pt[0] == 0); + + ut.t = 0.0; + ux.t = x; + + hx = ux.pt[n0]; /* high word of x */ + sign=hx&0x80000000; /* sign= sign(x) */ + hx ^=sign; + if(hx>=0x7ff00000) return(x+x); /* cbrt(NaN,INF) is itself */ + if((hx| ux.pt[1-n0])==0) + return(ux.t); /* cbrt(0) is itself */ + + ux.pt[n0] = hx; + /* rough cbrt to 5 bits */ + if(hx<0x00100000) /* subnormal number */ + {ut.pt[n0]=0x43500000; /* set t= 2**54 */ + ut.t*=x; ut.pt[n0]=ut.pt[n0]/3+B2; + } + else + ut.pt[n0]=hx/3+B1; + + /* new cbrt to 23 bits, may be implemented in single precision */ + r=ut.t*ut.t/ux.t; + s=C+r*ut.t; + ut.t*=G+F/(s+E+D/s); + + /* chopped to 20 bits and make it larger than cbrt(x) */ + ut.pt[1-n0]=0; ut.pt[n0]+=0x00000001; + + /* one step newton iteration to 53 bits with error less than 0.667 ulps */ + s=ut.t*ut.t; /* t*t is exact */ + r=ux.t/s; + w=ut.t+ut.t; + r=(r-ut.t)/(w+r); /* r-s is exact */ + ut.t=ut.t+ut.t*r; + + /* restore the sign bit */ + ut.pt[n0] |= sign; + + lt = ut.t; + lt -= (lt - (x/(lt*lt))) * 0.333333333333333333333; + return lt; +} + +main () +{ + if ((int) (cbrtl (27.0) + 0.5) != 3) + abort (); + + exit (0); +} +#else +main () { exit (0); } +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/cmpdi-1.c b/gcc/testsuite/gcc.c-torture/execute/cmpdi-1.c new file mode 100644 index 000000000..e3e9c8606 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/cmpdi-1.c @@ -0,0 +1,218 @@ +#define F 140 +#define T 13 + +feq (x, y) + long long int x; + long long int y; +{ + if (x == y) + return T; + else + return F; +} + +fne (x, y) + long long int x; + long long int y; +{ + if (x != y) + return T; + else + return F; +} + +flt (x, y) + long long int x; + long long int y; +{ + if (x < y) + return T; + else + return F; +} + +fge (x, y) + long long int x; + long long int y; +{ + if (x >= y) + return T; + else + return F; +} + +fgt (x, y) + long long int x; + long long int y; +{ + if (x > y) + return T; + else + return F; +} + +fle (x, y) + long long int x; + long long int y; +{ + if (x <= y) + return T; + else + return F; +} + +fltu (x, y) + unsigned long long int x; + unsigned long long int y; +{ + if (x < y) + return T; + else + return F; +} + +fgeu (x, y) + unsigned long long int x; + unsigned long long int y; +{ + if (x >= y) + return T; + else + return F; +} + +fgtu (x, y) + unsigned long long int x; + unsigned long long int y; +{ + if (x > y) + return T; + else + return F; +} + +fleu (x, y) + unsigned long long int x; + unsigned long long int y; +{ + if (x <= y) + return T; + else + return F; +} + +long long args[] = +{ + 0LL, + 1LL, + -1LL, + 0x7fffffffffffffffLL, + 0x8000000000000000LL, + 0x8000000000000001LL, + 0x1A3F237394D36C58LL, + 0x93850E92CAAC1B04LL +}; + +int correct_results[] = +{ + T, F, F, T, F, T, F, T, F, T, + F, T, T, F, F, T, T, F, F, T, + F, T, F, T, T, F, T, F, F, T, + F, T, T, F, F, T, T, F, F, T, + F, T, F, T, T, F, T, F, F, T, + F, T, F, T, T, F, T, F, F, T, + F, T, T, F, F, T, T, F, F, T, + F, T, F, T, T, F, T, F, F, T, + F, T, F, T, T, F, F, T, T, F, + T, F, F, T, F, T, F, T, F, T, + F, T, F, T, T, F, T, F, F, T, + F, T, T, F, F, T, T, F, F, T, + F, T, F, T, T, F, T, F, F, T, + F, T, F, T, T, F, T, F, F, T, + F, T, T, F, F, T, T, F, F, T, + F, T, F, T, T, F, T, F, F, T, + F, T, T, F, F, T, F, T, T, F, + F, T, T, F, F, T, F, T, T, F, + T, F, F, T, F, T, F, T, F, T, + F, T, T, F, F, T, F, T, T, F, + F, T, F, T, T, F, F, T, T, F, + F, T, F, T, T, F, F, T, T, F, + F, T, T, F, F, T, F, T, T, F, + F, T, F, T, T, F, F, T, T, F, + F, T, F, T, T, F, F, T, T, F, + F, T, F, T, T, F, F, T, T, F, + F, T, F, T, T, F, T, F, F, T, + T, F, F, T, F, T, F, T, F, T, + F, T, F, T, T, F, T, F, F, T, + F, T, F, T, T, F, T, F, F, T, + F, T, F, T, T, F, F, T, T, F, + F, T, F, T, T, F, T, F, F, T, + F, T, T, F, F, T, F, T, T, F, + F, T, T, F, F, T, F, T, T, F, + F, T, T, F, F, T, T, F, F, T, + F, T, T, F, F, T, F, T, T, F, + T, F, F, T, F, T, F, T, F, T, + F, T, T, F, F, T, T, F, F, T, + F, T, T, F, F, T, F, T, T, F, + F, T, T, F, F, T, T, F, F, T, + F, T, T, F, F, T, F, T, T, F, + F, T, T, F, F, T, F, T, T, F, + F, T, T, F, F, T, T, F, F, T, + F, T, T, F, F, T, F, T, T, F, + F, T, F, T, T, F, F, T, T, F, + T, F, F, T, F, T, F, T, F, T, + F, T, T, F, F, T, F, T, T, F, + F, T, T, F, F, T, T, F, F, T, + F, T, F, T, T, F, F, T, T, F, + F, T, F, T, T, F, F, T, T, F, + F, T, F, T, T, F, T, F, F, T, + F, T, T, F, F, T, T, F, F, T, + F, T, F, T, T, F, T, F, F, T, + F, T, F, T, T, F, T, F, F, T, + T, F, F, T, F, T, F, T, F, T, + F, T, F, T, T, F, T, F, F, T, + F, T, T, F, F, T, F, T, T, F, + F, T, T, F, F, T, F, T, T, F, + F, T, T, F, F, T, T, F, F, T, + F, T, T, F, F, T, F, T, T, F, + F, T, F, T, T, F, F, T, T, F, + F, T, F, T, T, F, F, T, T, F, + F, T, T, F, F, T, F, T, T, F, + T, F, F, T, F, T, F, T, F, T +}; + +main () +{ + int i, j, *res = correct_results; + + for (i = 0; i < 8; i++) + { + long long arg0 = args[i]; + for (j = 0; j < 8; j++) + { + long long arg1 = args[j]; + + if (feq (arg0, arg1) != *res++) + abort (); + if (fne (arg0, arg1) != *res++) + abort (); + if (flt (arg0, arg1) != *res++) + abort (); + if (fge (arg0, arg1) != *res++) + abort (); + if (fgt (arg0, arg1) != *res++) + abort (); + if (fle (arg0, arg1) != *res++) + abort (); + if (fltu (arg0, arg1) != *res++) + abort (); + if (fgeu (arg0, arg1) != *res++) + abort (); + if (fgtu (arg0, arg1) != *res++) + abort (); + if (fleu (arg0, arg1) != *res++) + abort (); + } + } + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/cmpsf-1.c b/gcc/testsuite/gcc.c-torture/execute/cmpsf-1.c new file mode 100644 index 000000000..87886c6de --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/cmpsf-1.c @@ -0,0 +1,161 @@ +#include + +#define F 140 +#define T 13 + +feq (float x, float y) +{ + if (x == y) + return T; + else + return F; +} + +fne (float x, float y) +{ + if (x != y) + return T; + else + return F; +} + +flt (float x, float y) +{ + if (x < y) + return T; + else + return F; +} + +fge (float x, float y) +{ + if (x >= y) + return T; + else + return F; +} + +fgt (float x, float y) +{ + if (x > y) + return T; + else + return F; +} + +fle (float x, float y) +{ + if (x <= y) + return T; + else + return F; +} + +float args[] = +{ + 0.0F, + 1.0F, + -1.0F, + __FLT_MAX__, + __FLT_MIN__, + 0.0000000000001F, + 123456789.0F, + -987654321.0F +}; + +int correct_results[] = +{ + T, F, F, T, F, T, + F, T, T, F, F, T, + F, T, F, T, T, F, + F, T, T, F, F, T, + F, T, T, F, F, T, + F, T, T, F, F, T, + F, T, T, F, F, T, + F, T, F, T, T, F, + F, T, F, T, T, F, + T, F, F, T, F, T, + F, T, F, T, T, F, + F, T, T, F, F, T, + F, T, F, T, T, F, + F, T, F, T, T, F, + F, T, T, F, F, T, + F, T, F, T, T, F, + F, T, T, F, F, T, + F, T, T, F, F, T, + T, F, F, T, F, T, + F, T, T, F, F, T, + F, T, T, F, F, T, + F, T, T, F, F, T, + F, T, T, F, F, T, + F, T, F, T, T, F, + F, T, F, T, T, F, + F, T, F, T, T, F, + F, T, F, T, T, F, + T, F, F, T, F, T, + F, T, F, T, T, F, + F, T, F, T, T, F, + F, T, F, T, T, F, + F, T, F, T, T, F, + F, T, F, T, T, F, + F, T, T, F, F, T, + F, T, F, T, T, F, + F, T, T, F, F, T, + T, F, F, T, F, T, + F, T, T, F, F, T, + F, T, T, F, F, T, + F, T, F, T, T, F, + F, T, F, T, T, F, + F, T, T, F, F, T, + F, T, F, T, T, F, + F, T, T, F, F, T, + F, T, F, T, T, F, + T, F, F, T, F, T, + F, T, T, F, F, T, + F, T, F, T, T, F, + F, T, F, T, T, F, + F, T, F, T, T, F, + F, T, F, T, T, F, + F, T, T, F, F, T, + F, T, F, T, T, F, + F, T, F, T, T, F, + T, F, F, T, F, T, + F, T, F, T, T, F, + F, T, T, F, F, T, + F, T, T, F, F, T, + F, T, T, F, F, T, + F, T, T, F, F, T, + F, T, T, F, F, T, + F, T, T, F, F, T, + F, T, T, F, F, T, + T, F, F, T, F, T, +}; + +int +main (void) +{ + int i, j, *res = correct_results; + + for (i = 0; i < 8; i++) + { + float arg0 = args[i]; + for (j = 0; j < 8; j++) + { + float arg1 = args[j]; + + if (feq (arg0, arg1) != *res++) + abort (); + if (fne (arg0, arg1) != *res++) + abort (); + if (flt (arg0, arg1) != *res++) + abort (); + if (fge (arg0, arg1) != *res++) + abort (); + if (fgt (arg0, arg1) != *res++) + abort (); + if (fle (arg0, arg1) != *res++) + abort (); + } + } + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/cmpsi-1.c b/gcc/testsuite/gcc.c-torture/execute/cmpsi-1.c new file mode 100644 index 000000000..9fce104fe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/cmpsi-1.c @@ -0,0 +1,32 @@ +f1 (unsigned int x, unsigned int y) +{ + if (x == 0) + dummy (); + x -= y; + /* 0xfffffff2 < 0x80000000? */ + if (x < ~(~(unsigned int) 0 >> 1)) + abort (); + return x; +} + +f2 (unsigned long int x, unsigned long int y) +{ + if (x == 0) + dummy (); + x -= y; + /* 0xfffffff2 < 0x80000000? */ + if (x < ~(~(unsigned long int) 0 >> 1)) + abort (); + return x; +} + + +dummy () {} + +main () +{ + /* 0x7ffffff3 0x80000001 */ + f1 ((~(unsigned int) 0 >> 1) - 12, ~(~(unsigned int) 0 >> 1) + 1); + f2 ((~(unsigned long int) 0 >> 1) - 12, ~(~(unsigned long int) 0 >> 1) + 1); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/cmpsi-2.c b/gcc/testsuite/gcc.c-torture/execute/cmpsi-2.c new file mode 100644 index 000000000..62832a9bf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/cmpsi-2.c @@ -0,0 +1,199 @@ +#define F 140 +#define T 13 + +feq (int x, int y) +{ + if (x == y) + return T; + else + return F; +} + +fne (int x, int y) +{ + if (x != y) + return T; + else + return F; +} + +flt (int x, int y) +{ + if (x < y) + return T; + else + return F; +} + +fge (int x, int y) +{ + if (x >= y) + return T; + else + return F; +} + +fgt (int x, int y) +{ + if (x > y) + return T; + else + return F; +} + +fle (int x, int y) +{ + if (x <= y) + return T; + else + return F; +} + +fltu (unsigned int x, unsigned int y) +{ + if (x < y) + return T; + else + return F; +} + +fgeu (unsigned int x, unsigned int y) +{ + if (x >= y) + return T; + else + return F; +} + +fgtu (unsigned int x, unsigned int y) +{ + if (x > y) + return T; + else + return F; +} + +fleu (unsigned int x, unsigned int y) +{ + if (x <= y) + return T; + else + return F; +} + +unsigned int args[] = +{ + 0L, + 1L, + -1L, + 0x7fffffffL, + 0x80000000L, + 0x80000001L, + 0x1A3F2373L, + 0x93850E92L +}; + +int correct_results[] = +{ + T, F, F, T, F, T, F, T, F, T, + F, T, T, F, F, T, T, F, F, T, + F, T, F, T, T, F, T, F, F, T, + F, T, T, F, F, T, T, F, F, T, + F, T, F, T, T, F, T, F, F, T, + F, T, F, T, T, F, T, F, F, T, + F, T, T, F, F, T, T, F, F, T, + F, T, F, T, T, F, T, F, F, T, + F, T, F, T, T, F, F, T, T, F, + T, F, F, T, F, T, F, T, F, T, + F, T, F, T, T, F, T, F, F, T, + F, T, T, F, F, T, T, F, F, T, + F, T, F, T, T, F, T, F, F, T, + F, T, F, T, T, F, T, F, F, T, + F, T, T, F, F, T, T, F, F, T, + F, T, F, T, T, F, T, F, F, T, + F, T, T, F, F, T, F, T, T, F, + F, T, T, F, F, T, F, T, T, F, + T, F, F, T, F, T, F, T, F, T, + F, T, T, F, F, T, F, T, T, F, + F, T, F, T, T, F, F, T, T, F, + F, T, F, T, T, F, F, T, T, F, + F, T, T, F, F, T, F, T, T, F, + F, T, F, T, T, F, F, T, T, F, + F, T, F, T, T, F, F, T, T, F, + F, T, F, T, T, F, F, T, T, F, + F, T, F, T, T, F, T, F, F, T, + T, F, F, T, F, T, F, T, F, T, + F, T, F, T, T, F, T, F, F, T, + F, T, F, T, T, F, T, F, F, T, + F, T, F, T, T, F, F, T, T, F, + F, T, F, T, T, F, T, F, F, T, + F, T, T, F, F, T, F, T, T, F, + F, T, T, F, F, T, F, T, T, F, + F, T, T, F, F, T, T, F, F, T, + F, T, T, F, F, T, F, T, T, F, + T, F, F, T, F, T, F, T, F, T, + F, T, T, F, F, T, T, F, F, T, + F, T, T, F, F, T, F, T, T, F, + F, T, T, F, F, T, T, F, F, T, + F, T, T, F, F, T, F, T, T, F, + F, T, T, F, F, T, F, T, T, F, + F, T, T, F, F, T, T, F, F, T, + F, T, T, F, F, T, F, T, T, F, + F, T, F, T, T, F, F, T, T, F, + T, F, F, T, F, T, F, T, F, T, + F, T, T, F, F, T, F, T, T, F, + F, T, T, F, F, T, T, F, F, T, + F, T, F, T, T, F, F, T, T, F, + F, T, F, T, T, F, F, T, T, F, + F, T, F, T, T, F, T, F, F, T, + F, T, T, F, F, T, T, F, F, T, + F, T, F, T, T, F, T, F, F, T, + F, T, F, T, T, F, T, F, F, T, + T, F, F, T, F, T, F, T, F, T, + F, T, F, T, T, F, T, F, F, T, + F, T, T, F, F, T, F, T, T, F, + F, T, T, F, F, T, F, T, T, F, + F, T, T, F, F, T, T, F, F, T, + F, T, T, F, F, T, F, T, T, F, + F, T, F, T, T, F, F, T, T, F, + F, T, F, T, T, F, F, T, T, F, + F, T, T, F, F, T, F, T, T, F, + T, F, F, T, F, T, F, T, F, T +}; + +int +main (void) +{ + int i, j, *res = correct_results; + + for (i = 0; i < 8; i++) + { + unsigned int arg0 = args[i]; + for (j = 0; j < 8; j++) + { + unsigned int arg1 = args[j]; + + if (feq (arg0, arg1) != *res++) + abort (); + if (fne (arg0, arg1) != *res++) + abort (); + if (flt (arg0, arg1) != *res++) + abort (); + if (fge (arg0, arg1) != *res++) + abort (); + if (fgt (arg0, arg1) != *res++) + abort (); + if (fle (arg0, arg1) != *res++) + abort (); + if (fltu (arg0, arg1) != *res++) + abort (); + if (fgeu (arg0, arg1) != *res++) + abort (); + if (fgtu (arg0, arg1) != *res++) + abort (); + if (fleu (arg0, arg1) != *res++) + abort (); + } + } + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/comp-goto-1.c b/gcc/testsuite/gcc.c-torture/execute/comp-goto-1.c new file mode 100644 index 000000000..3bf9a26f6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/comp-goto-1.c @@ -0,0 +1,164 @@ +#include + +#if !defined(NO_LABEL_VALUES) && (!defined(STACK_SIZE) || STACK_SIZE >= 4000) && __INT_MAX__ >= 2147483647 +typedef unsigned int uint32; +typedef signed int sint32; + +typedef uint32 reg_t; + +typedef unsigned long int host_addr_t; +typedef uint32 target_addr_t; +typedef sint32 target_saddr_t; + +typedef union +{ + struct + { + unsigned int offset:18; + unsigned int ignore:4; + unsigned int s1:8; + int :2; + signed int simm:14; + unsigned int s3:8; + unsigned int s2:8; + int pad2:2; + } f1; + long long ll; + double d; +} insn_t; + +typedef struct +{ + target_addr_t vaddr_tag; + unsigned long int rigged_paddr; +} tlb_entry_t; + +typedef struct +{ + insn_t *pc; + reg_t registers[256]; + insn_t *program; + tlb_entry_t tlb_tab[0x100]; +} environment_t; + +enum operations +{ + LOAD32_RR, + METAOP_DONE +}; + +host_addr_t +f () +{ + abort (); +} + +reg_t +simulator_kernel (int what, environment_t *env) +{ + register insn_t *pc = env->pc; + register reg_t *regs = env->registers; + register insn_t insn; + register int s1; + register reg_t r2; + register void *base_addr = &&sim_base_addr; + register tlb_entry_t *tlb = env->tlb_tab; + + if (what != 0) + { + int i; + static void *op_map[] = + { + &&L_LOAD32_RR, + &&L_METAOP_DONE, + }; + insn_t *program = env->program; + for (i = 0; i < what; i++) + program[i].f1.offset = op_map[program[i].f1.offset] - base_addr; + } + + sim_base_addr:; + + insn = *pc++; + r2 = (*(reg_t *) (((char *) regs) + (insn.f1.s2 << 2))); + s1 = (insn.f1.s1 << 2); + goto *(base_addr + insn.f1.offset); + + L_LOAD32_RR: + { + target_addr_t vaddr_page = r2 / 4096; + unsigned int x = vaddr_page % 0x100; + insn = *pc++; + + for (;;) + { + target_addr_t tag = tlb[x].vaddr_tag; + host_addr_t rigged_paddr = tlb[x].rigged_paddr; + + if (tag == vaddr_page) + { + *(reg_t *) (((char *) regs) + s1) = *(uint32 *) (rigged_paddr + r2); + r2 = *(reg_t *) (((char *) regs) + (insn.f1.s2 << 2)); + s1 = insn.f1.s1 << 2; + goto *(base_addr + insn.f1.offset); + } + + if (((target_saddr_t) tag < 0)) + { + *(reg_t *) (((char *) regs) + s1) = *(uint32 *) f (); + r2 = *(reg_t *) (((char *) regs) + (insn.f1.s2 << 2)); + s1 = insn.f1.s1 << 2; + goto *(base_addr + insn.f1.offset); + } + + x = (x - 1) % 0x100; + } + + L_METAOP_DONE: + return (*(reg_t *) (((char *) regs) + s1)); + } +} + +insn_t program[2 + 1]; + +void *malloc (); + +int +main () +{ + environment_t env; + insn_t insn; + int i, res; + host_addr_t a_page = (host_addr_t) malloc (2 * 4096); + target_addr_t a_vaddr = 0x123450; + target_addr_t vaddr_page = a_vaddr / 4096; + a_page = (a_page + 4096 - 1) & -4096; + + env.tlb_tab[((vaddr_page) % 0x100)].vaddr_tag = vaddr_page; + env.tlb_tab[((vaddr_page) % 0x100)].rigged_paddr = a_page - vaddr_page * 4096; + insn.f1.offset = LOAD32_RR; + env.registers[0] = 0; + env.registers[2] = a_vaddr; + *(sint32 *) (a_page + a_vaddr % 4096) = 88; + insn.f1.s1 = 0; + insn.f1.s2 = 2; + + for (i = 0; i < 2; i++) + program[i] = insn; + + insn.f1.offset = METAOP_DONE; + insn.f1.s1 = 0; + program[2] = insn; + + env.pc = program; + env.program = program; + + res = simulator_kernel (2 + 1, &env); + + if (res != 88) + abort (); + exit (0); +} +#else +main(){ exit (0); } +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/comp-goto-2.c b/gcc/testsuite/gcc.c-torture/execute/comp-goto-2.c new file mode 100644 index 000000000..771cd9569 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/comp-goto-2.c @@ -0,0 +1,36 @@ +/* A slight variation of 920501-7.c. */ + +#ifdef STACK_SIZE +#define DEPTH ((STACK_SIZE) / 512 + 1) +#else +#define DEPTH 1000 +#endif + +#if ! defined (NO_LABEL_VALUES) && !defined (NO_TRAMPOLINES) +x(a) +{ + __label__ xlab; + void y(a) + { + void *x = &&llab; + if (a==-1) + goto *x; + if (a==0) + goto xlab; + llab: + y (a-1); + } + y (a); + xlab:; + return a; +} +#endif + +main () +{ +#if ! defined (NO_LABEL_VALUES) && !defined (NO_TRAMPOLINES) + if (x (DEPTH) != DEPTH) + abort (); +#endif + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/compare-1.c b/gcc/testsuite/gcc.c-torture/execute/compare-1.c new file mode 100644 index 000000000..78b465024 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/compare-1.c @@ -0,0 +1,119 @@ +/* Copyright (C) 2002 Free Software Foundation. + + Test for correctness of composite comparisons. + + Written by Roger Sayle, 3rd June 2002. */ + +extern void abort (void); + +int ieq (int x, int y, int ok) +{ + if ((x<=y) && (x>=y)) + { + if (!ok) abort (); + } + else + if (ok) abort (); + + if ((x<=y) && (x==y)) + { + if (!ok) abort (); + } + else + if (ok) abort (); + + if ((x<=y) && (y<=x)) + { + if (!ok) abort (); + } + else + if (ok) abort (); + + if ((y==x) && (x<=y)) + { + if (!ok) abort (); + } + else + if (ok) abort (); +} + +int ine (int x, int y, int ok) +{ + if ((xy)) + { + if (!ok) abort (); + } + else + if (ok) abort (); +} + +int ilt (int x, int y, int ok) +{ + if ((xy) && (x!=y)) + { + if (!ok) abort (); + } + else + if (ok) abort (); +} + +int ige (int x, int y, int ok) +{ + if ((x>y) || (x==y)) + { + if (!ok) abort (); + } + else + if (ok) abort (); +} + +int +main () +{ + ieq (1, 4, 0); + ieq (3, 3, 1); + ieq (5, 2, 0); + + ine (1, 4, 1); + ine (3, 3, 0); + ine (5, 2, 1); + + ilt (1, 4, 1); + ilt (3, 3, 0); + ilt (5, 2, 0); + + ile (1, 4, 1); + ile (3, 3, 1); + ile (5, 2, 0); + + igt (1, 4, 0); + igt (3, 3, 0); + igt (5, 2, 1); + + ige (1, 4, 0); + ige (3, 3, 1); + ige (5, 2, 1); + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/compare-2.c b/gcc/testsuite/gcc.c-torture/execute/compare-2.c new file mode 100644 index 000000000..858df294e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/compare-2.c @@ -0,0 +1,24 @@ +/* Copyright (C) 2002 Free Software Foundation. + + Ensure that the composite comparison optimization doesn't misfire + and attempt to combine a signed comparison with an unsigned one. + + Written by Roger Sayle, 3rd June 2002. */ + +extern void abort (void); + +int +foo (int x, int y) +{ + /* If miscompiled the following may become "x == y". */ + return (x<=y) && ((unsigned int)x >= (unsigned int)y); +} + +int +main () +{ + if (! foo (-1,0)) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/compare-3.c b/gcc/testsuite/gcc.c-torture/execute/compare-3.c new file mode 100644 index 000000000..6549c904b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/compare-3.c @@ -0,0 +1,86 @@ +/* Copyright (C) 2002 Free Software Foundation. + + Test for composite comparison always true/false optimization. + + Written by Roger Sayle, 7th June 2002. */ + +extern void link_error0 (); +extern void link_error1 (); + +void +test1 (int x, int y) +{ + if ((x==y) && (x!=y)) + link_error0(); +} + +void +test2 (int x, int y) +{ + if ((xy)) + link_error0(); +} + +void +test3 (int x, int y) +{ + if ((x=y) || (x +#include + +int err; + +#define TEST(TYPE, FUNC) \ +__complex__ TYPE \ +ctest_ ## FUNC (__complex__ TYPE x) \ +{ \ + __complex__ TYPE res; \ + \ + res = ~x; \ + \ + return res; \ +} \ + \ +void \ +test_ ## FUNC (void) \ +{ \ + __complex__ TYPE res, x; \ + \ + x = 1.0 + 2.0i; \ + \ + res = ctest_ ## FUNC (x); \ + \ + if (res != 1.0 - 2.0i) \ + { \ + printf ("test_" #FUNC " failed\n"); \ + ++err; \ + } \ +} + + +TEST(float, float) +TEST(double, double) +TEST(long double, long_double) +TEST(int, int) +TEST(long int, long_int) + +int +main (void) +{ + + err = 0; + + test_float (); + test_double (); + test_long_double (); + test_int (); + test_long_int (); + + if (err != 0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/complex-7.c b/gcc/testsuite/gcc.c-torture/execute/complex-7.c new file mode 100644 index 000000000..c5bf89df7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/complex-7.c @@ -0,0 +1,56 @@ +/* Test argument passing of complex values. The MIPS64 compiler had a + bug when they were split between registers and the stack. */ +/* Origin: Joseph Myers */ + +volatile _Complex float f1 = 1.1f + 2.2if; +volatile _Complex float f2 = 3.3f + 4.4if; +volatile _Complex float f3 = 5.5f + 6.6if; +volatile _Complex float f4 = 7.7f + 8.8if; +volatile _Complex float f5 = 9.9f + 10.1if; +volatile _Complex double d1 = 1.1 + 2.2i; +volatile _Complex double d2 = 3.3 + 4.4i; +volatile _Complex double d3 = 5.5 + 6.6i; +volatile _Complex double d4 = 7.7 + 8.8i; +volatile _Complex double d5 = 9.9 + 10.1i; +volatile _Complex long double ld1 = 1.1L + 2.2iL; +volatile _Complex long double ld2 = 3.3L + 4.4iL; +volatile _Complex long double ld3 = 5.5L + 6.6iL; +volatile _Complex long double ld4 = 7.7L + 8.8iL; +volatile _Complex long double ld5 = 9.9L + 10.1iL; + +extern void abort (void); +extern void exit (int); + +__attribute__((noinline)) void +check_float (int a, _Complex float a1, _Complex float a2, + _Complex float a3, _Complex float a4, _Complex float a5) +{ + if (a1 != f1 || a2 != f2 || a3 != f3 || a4 != f4 || a5 != f5) + abort (); +} + +__attribute__((noinline)) void +check_double (int a, _Complex double a1, _Complex double a2, + _Complex double a3, _Complex double a4, _Complex double a5) +{ + if (a1 != d1 || a2 != d2 || a3 != d3 || a4 != d4 || a5 != d5) + abort (); +} + +__attribute__((noinline)) void +check_long_double (int a, _Complex long double a1, _Complex long double a2, + _Complex long double a3, _Complex long double a4, + _Complex long double a5) +{ + if (a1 != ld1 || a2 != ld2 || a3 != ld3 || a4 != ld4 || a5 != ld5) + abort (); +} + +int +main (void) +{ + check_float (0, f1, f2, f3, f4, f5); + check_double (0, d1, d2, d3, d4, d5); + check_long_double (0, ld1, ld2, ld3, ld4, ld5); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/compndlit-1.c b/gcc/testsuite/gcc.c-torture/execute/compndlit-1.c new file mode 100644 index 000000000..76328c21c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/compndlit-1.c @@ -0,0 +1,25 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int +main (void) +{ + exit (0); +} +#else +struct S +{ + int a:3; + unsigned b:1, c:28; +}; + +struct S x = {1, 1, 1}; + +main () +{ + x = (struct S) {b:0, a:0, c:({ struct S o = x; o.a == 1 ? 10 : 20;})}; + if (x.c != 10) + abort (); + exit (0); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/const-addr-expr-1.c b/gcc/testsuite/gcc.c-torture/execute/const-addr-expr-1.c new file mode 100644 index 000000000..dc34368cb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/const-addr-expr-1.c @@ -0,0 +1,33 @@ +#include +#include +extern void abort(); + +typedef struct foo +{ + int uaattrid; + char *name; +} FOO; + +FOO Upgrade_items[] = +{ + {1, "1"}, + {2, "2"}, + {0, NULL} +}; + +int *Upgd_minor_ID = + (int *) &((Upgrade_items + 1)->uaattrid); + +int *Upgd_minor_ID1 = + (int *) &((Upgrade_items)->uaattrid); + +int +main(int argc, char **argv) +{ + if (*Upgd_minor_ID != 2) + abort(); + + if (*Upgd_minor_ID1 != 1) + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/conversion.c b/gcc/testsuite/gcc.c-torture/execute/conversion.c new file mode 100644 index 000000000..82d681acf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/conversion.c @@ -0,0 +1,551 @@ +/* Test front-end conversions, optimizer conversions, and run-time + conversions between different arithmetic types. + + Constants are specified in a non-obvious way to make them work for + any word size. Their value on a 32-bit machine is indicated in the + comments. + + Note that this code is NOT intended for testing of accuracy of fp + conversions. */ + +float +u2f(u) + unsigned int u; +{ + return u; +} + +double +u2d(u) + unsigned int u; +{ + return u; +} + +long double +u2ld(u) + unsigned int u; +{ + return u; +} + +float +s2f(s) + int s; +{ + return s; +} + +double +s2d(s) + int s; +{ + return s; +} + +long double +s2ld(s) + int s; +{ + return s; +} + +int +fnear (float x, float y) +{ + float t = x - y; + return t == 0 || x / t > 1000000.0; +} + +int +dnear (double x, double y) +{ + double t = x - y; + return t == 0 || x / t > 100000000000000.0; +} + +int +ldnear (long double x, long double y) +{ + long double t = x - y; + return t == 0 || x / t > 100000000000000000000000000000000.0; +} + +test_integer_to_float() +{ + if (u2f(0U) != (float) 0U) /* 0 */ + abort(); + if (!fnear (u2f(~0U), (float) ~0U)) /* 0xffffffff */ + abort(); + if (!fnear (u2f((~0U) >> 1), (float) ((~0U) >> 1))) /* 0x7fffffff */ + abort(); + if (u2f(~((~0U) >> 1)) != (float) ~((~0U) >> 1)) /* 0x80000000 */ + abort(); + + if (u2d(0U) != (double) 0U) /* 0 */ + abort(); + if (!dnear (u2d(~0U), (double) ~0U)) /* 0xffffffff */ + abort(); + if (!dnear (u2d((~0U) >> 1),(double) ((~0U) >> 1))) /* 0x7fffffff */ + abort(); + if (u2d(~((~0U) >> 1)) != (double) ~((~0U) >> 1)) /* 0x80000000 */ + abort(); + + if (u2ld(0U) != (long double) 0U) /* 0 */ + abort(); + if (!ldnear (u2ld(~0U), (long double) ~0U)) /* 0xffffffff */ + abort(); + if (!ldnear (u2ld((~0U) >> 1),(long double) ((~0U) >> 1))) /* 0x7fffffff */ + abort(); + if (u2ld(~((~0U) >> 1)) != (long double) ~((~0U) >> 1)) /* 0x80000000 */ + abort(); + + if (s2f(0) != (float) 0) /* 0 */ + abort(); + if (!fnear (s2f(~0), (float) ~0)) /* 0xffffffff */ + abort(); + if (!fnear (s2f((int)((~0U) >> 1)), (float)(int)((~0U) >> 1))) /* 0x7fffffff */ + abort(); + if (s2f((int)(~((~0U) >> 1))) != (float)(int)~((~0U) >> 1)) /* 0x80000000 */ + abort(); + + if (s2d(0) != (double) 0) /* 0 */ + abort(); + if (!dnear (s2d(~0), (double) ~0)) /* 0xffffffff */ + abort(); + if (!dnear (s2d((int)((~0U) >> 1)), (double)(int)((~0U) >> 1))) /* 0x7fffffff */ + abort(); + if (s2d((int)~((~0U) >> 1)) != (double)(int)~((~0U) >> 1)) /* 0x80000000 */ + abort(); + + if (s2ld(0) != (long double) 0) /* 0 */ + abort(); + if (!ldnear (s2ld(~0), (long double) ~0)) /* 0xffffffff */ + abort(); + if (!ldnear (s2ld((int)((~0U) >> 1)), (long double)(int)((~0U) >> 1))) /* 0x7fffffff */ + abort(); + if (s2ld((int)~((~0U) >> 1)) != (long double)(int)~((~0U) >> 1)) /* 0x80000000 */ + abort(); +} + +#if __GNUC__ +float +ull2f(u) + unsigned long long int u; +{ + return u; +} + +double +ull2d(u) + unsigned long long int u; +{ + return u; +} + +long double +ull2ld(u) + unsigned long long int u; +{ + return u; +} + +float +sll2f(s) + long long int s; +{ + return s; +} + +double +sll2d(s) + long long int s; +{ + return s; +} + +long double +sll2ld(s) + long long int s; +{ + return s; +} + +test_longlong_integer_to_float() +{ + if (ull2f(0ULL) != (float) 0ULL) /* 0 */ + abort(); + if (ull2f(~0ULL) != (float) ~0ULL) /* 0xffffffff */ + abort(); + if (ull2f((~0ULL) >> 1) != (float) ((~0ULL) >> 1)) /* 0x7fffffff */ + abort(); + if (ull2f(~((~0ULL) >> 1)) != (float) ~((~0ULL) >> 1)) /* 0x80000000 */ + abort(); + + if (ull2d(0ULL) != (double) 0ULL) /* 0 */ + abort(); +#if __HAVE_68881__ + /* Some 68881 targets return values in fp0, with excess precision. + But the compile-time conversion to double works correctly. */ + if (! dnear (ull2d(~0ULL), (double) ~0ULL)) /* 0xffffffff */ + abort(); + if (! dnear (ull2d((~0ULL) >> 1), (double) ((~0ULL) >> 1))) /* 0x7fffffff */ + abort(); +#else + if (ull2d(~0ULL) != (double) ~0ULL) /* 0xffffffff */ + abort(); + if (ull2d((~0ULL) >> 1) != (double) ((~0ULL) >> 1)) /* 0x7fffffff */ + abort(); +#endif + if (ull2d(~((~0ULL) >> 1)) != (double) ~((~0ULL) >> 1)) /* 0x80000000 */ + abort(); + + if (ull2ld(0ULL) != (long double) 0ULL) /* 0 */ + abort(); + if (ull2ld(~0ULL) != (long double) ~0ULL) /* 0xffffffff */ + abort(); + if (ull2ld((~0ULL) >> 1) != (long double) ((~0ULL) >> 1)) /* 0x7fffffff */ + abort(); + if (ull2ld(~((~0ULL) >> 1)) != (long double) ~((~0ULL) >> 1)) /* 0x80000000 */ + abort(); + + if (sll2f(0LL) != (float) 0LL) /* 0 */ + abort(); + if (sll2f(~0LL) != (float) ~0LL) /* 0xffffffff */ + abort(); + if (! fnear (sll2f((long long int)((~0ULL) >> 1)), (float)(long long int)((~0ULL) >> 1))) /* 0x7fffffff */ + abort(); + if (sll2f((long long int)(~((~0ULL) >> 1))) != (float)(long long int)~((~0ULL) >> 1)) /* 0x80000000 */ + abort(); + + if (sll2d(0LL) != (double) 0LL) /* 0 */ + abort(); + if (sll2d(~0LL) != (double) ~0LL) /* 0xffffffff */ + abort(); + if (!dnear (sll2d((long long int)((~0ULL) >> 1)), (double)(long long int)((~0ULL) >> 1))) /* 0x7fffffff */ + abort(); + if (! dnear (sll2d((long long int)~((~0ULL) >> 1)), (double)(long long int)~((~0ULL) >> 1))) /* 0x80000000 */ + abort(); + + if (sll2ld(0LL) != (long double) 0LL) /* 0 */ + abort(); + if (sll2ld(~0LL) != (long double) ~0LL) /* 0xffffffff */ + abort(); + if (!ldnear (sll2ld((long long int)((~0ULL) >> 1)), (long double)(long long int)((~0ULL) >> 1))) /* 0x7fffffff */ + abort(); + if (! ldnear (sll2ld((long long int)~((~0ULL) >> 1)), (long double)(long long int)~((~0ULL) >> 1))) /* 0x80000000 */ + abort(); +} +#endif + +unsigned int +f2u(float f) +{ + return (unsigned) f; +} + +unsigned int +d2u(double d) +{ + return (unsigned) d; +} + +unsigned int +ld2u(long double d) +{ + return (unsigned) d; +} + +int +f2s(float f) +{ + return (int) f; +} + +int +d2s(double d) +{ + return (int) d; +} + +int +ld2s(long double d) +{ + return (int) d; +} + +test_float_to_integer() +{ + if (f2u(0.0) != 0) + abort(); + if (f2u(0.999) != 0) + abort(); + if (f2u(1.0) != 1) + abort(); + if (f2u(1.99) != 1) + abort(); +#ifdef __SPU__ + /* SPU float rounds towards zero. */ + if (f2u((float) ((~0U) >> 1)) != 0x7fffff80) + abort(); +#else + if (f2u((float) ((~0U) >> 1)) != (~0U) >> 1 && /* 0x7fffffff */ + f2u((float) ((~0U) >> 1)) != ((~0U) >> 1) + 1) + abort(); +#endif + if (f2u((float) ~((~0U) >> 1)) != ~((~0U) >> 1)) /* 0x80000000 */ + abort(); + + /* These tests require double precision, so for hosts that don't offer + that much precision, just ignore these test. */ + if (sizeof (double) >= 8) { + if (d2u(0.0) != 0) + abort(); + if (d2u(0.999) != 0) + abort(); + if (d2u(1.0) != 1) + abort(); + if (d2u(1.99) != 1) + abort(); + if (d2u((double) (~0U)) != ~0U) /* 0xffffffff */ + abort(); + if (d2u((double) ((~0U) >> 1)) != (~0U) >> 1) /* 0x7fffffff */ + abort(); + if (d2u((double) ~((~0U) >> 1)) != ~((~0U) >> 1)) /* 0x80000000 */ + abort(); + } + + /* These tests require long double precision, so for hosts that don't offer + that much precision, just ignore these test. */ + if (sizeof (long double) >= 8) { + if (ld2u(0.0) != 0) + abort(); + if (ld2u(0.999) != 0) + abort(); + if (ld2u(1.0) != 1) + abort(); + if (ld2u(1.99) != 1) + abort(); + if (ld2u((long double) (~0U)) != ~0U) /* 0xffffffff */ + abort(); + if (ld2u((long double) ((~0U) >> 1)) != (~0U) >> 1) /* 0x7fffffff */ + abort(); + if (ld2u((long double) ~((~0U) >> 1)) != ~((~0U) >> 1)) /* 0x80000000 */ + abort(); + } + + if (f2s(0.0) != 0) + abort(); + if (f2s(0.999) != 0) + abort(); + if (f2s(1.0) != 1) + abort(); + if (f2s(1.99) != 1) + abort(); + if (f2s(-0.999) != 0) + abort(); + if (f2s(-1.0) != -1) + abort(); + if (f2s(-1.99) != -1) + abort(); + if (f2s((float)(int)~((~0U) >> 1)) != (int)~((~0U) >> 1)) /* 0x80000000 */ + abort(); + + /* These tests require double precision, so for hosts that don't offer + that much precision, just ignore these test. */ + if (sizeof (double) >= 8) { + if (d2s(0.0) != 0) + abort(); + if (d2s(0.999) != 0) + abort(); + if (d2s(1.0) != 1) + abort(); + if (d2s(1.99) != 1) + abort(); + if (d2s(-0.999) != 0) + abort(); + if (d2s(-1.0) != -1) + abort(); + if (d2s(-1.99) != -1) + abort(); + if (d2s((double) ((~0U) >> 1)) != (~0U) >> 1) /* 0x7fffffff */ + abort(); + if (d2s((double)(int)~((~0U) >> 1)) != (int)~((~0U) >> 1)) /* 0x80000000 */ + abort(); + } + + /* These tests require long double precision, so for hosts that don't offer + that much precision, just ignore these test. */ + if (sizeof (long double) >= 8) { + if (ld2s(0.0) != 0) + abort(); + if (ld2s(0.999) != 0) + abort(); + if (ld2s(1.0) != 1) + abort(); + if (ld2s(1.99) != 1) + abort(); + if (ld2s(-0.999) != 0) + abort(); + if (ld2s(-1.0) != -1) + abort(); + if (ld2s(-1.99) != -1) + abort(); + if (ld2s((long double) ((~0U) >> 1)) != (~0U) >> 1) /* 0x7fffffff */ + abort(); + if (ld2s((long double)(int)~((~0U) >> 1)) != (int)~((~0U) >> 1)) /* 0x80000000 */ + abort(); + } +} + +#if __GNUC__ +unsigned long long int +f2ull(float f) +{ + return (unsigned long long int) f; +} + +unsigned long long int +d2ull(double d) +{ + return (unsigned long long int) d; +} + +unsigned long long int +ld2ull(long double d) +{ + return (unsigned long long int) d; +} + +long long int +f2sll(float f) +{ + return (long long int) f; +} + +long long int +d2sll(double d) +{ + return (long long int) d; +} + +long long int +ld2sll(long double d) +{ + return (long long int) d; +} + +test_float_to_longlong_integer() +{ + if (f2ull(0.0) != 0LL) + abort(); + if (f2ull(0.999) != 0LL) + abort(); + if (f2ull(1.0) != 1LL) + abort(); + if (f2ull(1.99) != 1LL) + abort(); +#ifdef __SPU__ + /* SPU float rounds towards zero. */ + if (f2ull((float) ((~0ULL) >> 1)) != 0x7fffff8000000000ULL) + abort(); +#else + if (f2ull((float) ((~0ULL) >> 1)) != (~0ULL) >> 1 && /* 0x7fffffff */ + f2ull((float) ((~0ULL) >> 1)) != ((~0ULL) >> 1) + 1) + abort(); +#endif + if (f2ull((float) ~((~0ULL) >> 1)) != ~((~0ULL) >> 1)) /* 0x80000000 */ + abort(); + + if (d2ull(0.0) != 0LL) + abort(); + if (d2ull(0.999) != 0LL) + abort(); + if (d2ull(1.0) != 1LL) + abort(); + if (d2ull(1.99) != 1LL) + abort(); + if (d2ull((double) ((~0ULL) >> 1)) != (~0ULL) >> 1 && /* 0x7fffffff */ + d2ull((double) ((~0ULL) >> 1)) != ((~0ULL) >> 1) + 1) + abort(); + if (d2ull((double) ~((~0ULL) >> 1)) != ~((~0ULL) >> 1)) /* 0x80000000 */ + abort(); + + if (ld2ull(0.0) != 0LL) + abort(); + if (ld2ull(0.999) != 0LL) + abort(); + if (ld2ull(1.0) != 1LL) + abort(); + if (ld2ull(1.99) != 1LL) + abort(); + if (ld2ull((long double) ((~0ULL) >> 1)) != (~0ULL) >> 1 && /* 0x7fffffff */ + ld2ull((long double) ((~0ULL) >> 1)) != ((~0ULL) >> 1) + 1) + abort(); + if (ld2ull((long double) ~((~0ULL) >> 1)) != ~((~0ULL) >> 1)) /* 0x80000000 */ + abort(); + + + if (f2sll(0.0) != 0LL) + abort(); + if (f2sll(0.999) != 0LL) + abort(); + if (f2sll(1.0) != 1LL) + abort(); + if (f2sll(1.99) != 1LL) + abort(); + if (f2sll(-0.999) != 0LL) + abort(); + if (f2sll(-1.0) != -1LL) + abort(); + if (f2sll(-1.99) != -1LL) + abort(); + if (f2sll((float)(long long int)~((~0ULL) >> 1)) != (long long int)~((~0ULL) >> 1)) /* 0x80000000 */ + abort(); + + if (d2sll(0.0) != 0LL) + abort(); + if (d2sll(0.999) != 0LL) + abort(); + if (d2sll(1.0) != 1LL) + abort(); + if (d2sll(1.99) != 1LL) + abort(); + if (d2sll(-0.999) != 0LL) + abort(); + if (d2sll(-1.0) != -1LL) + abort(); + if (d2sll(-1.99) != -1LL) + abort(); + if (d2sll((double)(long long int)~((~0ULL) >> 1)) != (long long int)~((~0ULL) >> 1)) /* 0x80000000 */ + abort(); + + if (ld2sll(0.0) != 0LL) + abort(); + if (ld2sll(0.999) != 0LL) + abort(); + if (ld2sll(1.0) != 1LL) + abort(); + if (ld2sll(1.99) != 1LL) + abort(); + if (ld2sll(-0.999) != 0LL) + abort(); + if (ld2sll(-1.0) != -1LL) + abort(); + if (ld2sll(-1.99) != -1LL) + abort(); + if (ld2sll((long double)(long long int)~((~0ULL) >> 1)) != (long long int)~((~0ULL) >> 1)) /* 0x80000000 */ + abort(); +} +#endif + +main() +{ + test_integer_to_float(); + test_float_to_integer(); +#if __GNUC__ + test_longlong_integer_to_float(); + test_float_to_longlong_integer(); +#endif + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/cvt-1.c b/gcc/testsuite/gcc.c-torture/execute/cvt-1.c new file mode 100644 index 000000000..6bb193411 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/cvt-1.c @@ -0,0 +1,28 @@ +static inline long +g1 (double x) +{ + return (double) (long) x; +} + +long +g2 (double f) +{ + return f; +} + +double +f (long i) +{ + if (g1 (i) != g2 (i)) + abort (); + return g2 (i); +} + +main () +{ + if (f (123456789L) != 123456789L) + abort (); + if (f (123456789L) != g2 (123456789L)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/cvt-1.x b/gcc/testsuite/gcc.c-torture/execute/cvt-1.x new file mode 100644 index 000000000..997c8650c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/cvt-1.x @@ -0,0 +1,7 @@ +# This doesn't work on d10v if ints are not 32 bits + +if { [istarget "d10v-*-*"] && ! [string-match "*-mint32*" $CFLAGS] } { + set torture_execute_xfail "d10v-*-*" +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/dbra-1.c b/gcc/testsuite/gcc.c-torture/execute/dbra-1.c new file mode 100644 index 000000000..20ae8988e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/dbra-1.c @@ -0,0 +1,95 @@ +f1 (a) + long a; +{ + int i; + for (i = 0; i < 10; i++) + { + if (--a == -1) + return i; + } + return -1; +} + +f2 (a) + long a; +{ + int i; + for (i = 0; i < 10; i++) + { + if (--a != -1) + return i; + } + return -1; +} + +f3 (a) + long a; +{ + int i; + for (i = 0; i < 10; i++) + { + if (--a == 0) + return i; + } + return -1; +} + +f4 (a) + long a; +{ + int i; + for (i = 0; i < 10; i++) + { + if (--a != 0) + return i; + } + return -1; +} + +f5 (a) + long a; +{ + int i; + for (i = 0; i < 10; i++) + { + if (++a == 0) + return i; + } + return -1; +} + +f6 (a) + long a; +{ + int i; + for (i = 0; i < 10; i++) + { + if (++a != 0) + return i; + } + return -1; +} + + +main() +{ + if (f1 (5L) != 5) + abort (); + if (f2 (1L) != 0) + abort (); + if (f2 (0L) != 1) + abort (); + if (f3 (5L) != 4) + abort (); + if (f4 (1L) != 1) + abort (); + if (f4 (0L) != 0) + abort (); + if (f5 (-5L) != 4) + abort (); + if (f6 (-1L) != 1) + abort (); + if (f6 (0L) != 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/divcmp-1.c b/gcc/testsuite/gcc.c-torture/execute/divcmp-1.c new file mode 100644 index 000000000..0a7f305aa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/divcmp-1.c @@ -0,0 +1,356 @@ +extern void abort(void); + +int test1(int x) +{ + return x/10 == 2; +} + +int test1u(unsigned int x) +{ + return x/10U == 2; +} + +int test2(int x) +{ + return x/10 == 0; +} + +int test2u(unsigned int x) +{ + return x/10U == 0; +} + +int test3(int x) +{ + return x/10 != 2; +} + +int test3u(unsigned int x) +{ + return x/10U != 2; +} + +int test4(int x) +{ + return x/10 != 0; +} + +int test4u(unsigned int x) +{ + return x/10U != 0; +} + +int test5(int x) +{ + return x/10 < 2; +} + +int test5u(unsigned int x) +{ + return x/10U < 2; +} + +int test6(int x) +{ + return x/10 < 0; +} + +int test7(int x) +{ + return x/10 <= 2; +} + +int test7u(unsigned int x) +{ + return x/10U <= 2; +} + +int test8(int x) +{ + return x/10 <= 0; +} + +int test8u(unsigned int x) +{ + return x/10U <= 0; +} + +int test9(int x) +{ + return x/10 > 2; +} + +int test9u(unsigned int x) +{ + return x/10U > 2; +} + +int test10(int x) +{ + return x/10 > 0; +} + +int test10u(unsigned int x) +{ + return x/10U > 0; +} + +int test11(int x) +{ + return x/10 >= 2; +} + +int test11u(unsigned int x) +{ + return x/10U >= 2; +} + +int test12(int x) +{ + return x/10 >= 0; +} + + +int main() +{ + if (test1(19) != 0) + abort (); + if (test1(20) != 1) + abort (); + if (test1(29) != 1) + abort (); + if (test1(30) != 0) + abort (); + + if (test1u(19) != 0) + abort (); + if (test1u(20) != 1) + abort (); + if (test1u(29) != 1) + abort (); + if (test1u(30) != 0) + abort (); + + if (test2(0) != 1) + abort (); + if (test2(9) != 1) + abort (); + if (test2(10) != 0) + abort (); + if (test2(-1) != 1) + abort (); + if (test2(-9) != 1) + abort (); + if (test2(-10) != 0) + abort (); + + if (test2u(0) != 1) + abort (); + if (test2u(9) != 1) + abort (); + if (test2u(10) != 0) + abort (); + if (test2u(-1) != 0) + abort (); + if (test2u(-9) != 0) + abort (); + if (test2u(-10) != 0) + abort (); + + if (test3(19) != 1) + abort (); + if (test3(20) != 0) + abort (); + if (test3(29) != 0) + abort (); + if (test3(30) != 1) + abort (); + + if (test3u(19) != 1) + abort (); + if (test3u(20) != 0) + abort (); + if (test3u(29) != 0) + abort (); + if (test3u(30) != 1) + abort (); + + if (test4(0) != 0) + abort (); + if (test4(9) != 0) + abort (); + if (test4(10) != 1) + abort (); + if (test4(-1) != 0) + abort (); + if (test4(-9) != 0) + abort (); + if (test4(-10) != 1) + abort (); + + if (test4u(0) != 0) + abort (); + if (test4u(9) != 0) + abort (); + if (test4u(10) != 1) + abort (); + if (test4u(-1) != 1) + abort (); + if (test4u(-9) != 1) + abort (); + if (test4u(-10) != 1) + abort (); + + if (test5(19) != 1) + abort (); + if (test5(20) != 0) + abort (); + if (test5(29) != 0) + abort (); + if (test5(30) != 0) + abort (); + + if (test5u(19) != 1) + abort (); + if (test5u(20) != 0) + abort (); + if (test5u(29) != 0) + abort (); + if (test5u(30) != 0) + abort (); + + if (test6(0) != 0) + abort (); + if (test6(9) != 0) + abort (); + if (test6(10) != 0) + abort (); + if (test6(-1) != 0) + abort (); + if (test6(-9) != 0) + abort (); + if (test6(-10) != 1) + abort (); + + if (test7(19) != 1) + abort (); + if (test7(20) != 1) + abort (); + if (test7(29) != 1) + abort (); + if (test7(30) != 0) + abort (); + + if (test7u(19) != 1) + abort (); + if (test7u(20) != 1) + abort (); + if (test7u(29) != 1) + abort (); + if (test7u(30) != 0) + abort (); + + if (test8(0) != 1) + abort (); + if (test8(9) != 1) + abort (); + if (test8(10) != 0) + abort (); + if (test8(-1) != 1) + abort (); + if (test8(-9) != 1) + abort (); + if (test8(-10) != 1) + abort (); + + if (test8u(0) != 1) + abort (); + if (test8u(9) != 1) + abort (); + if (test8u(10) != 0) + abort (); + if (test8u(-1) != 0) + abort (); + if (test8u(-9) != 0) + abort (); + if (test8u(-10) != 0) + abort (); + + if (test9(19) != 0) + abort (); + if (test9(20) != 0) + abort (); + if (test9(29) != 0) + abort (); + if (test9(30) != 1) + abort (); + + if (test9u(19) != 0) + abort (); + if (test9u(20) != 0) + abort (); + if (test9u(29) != 0) + abort (); + if (test9u(30) != 1) + abort (); + + if (test10(0) != 0) + abort (); + if (test10(9) != 0) + abort (); + if (test10(10) != 1) + abort (); + if (test10(-1) != 0) + abort (); + if (test10(-9) != 0) + abort (); + if (test10(-10) != 0) + abort (); + + if (test10u(0) != 0) + abort (); + if (test10u(9) != 0) + abort (); + if (test10u(10) != 1) + abort (); + if (test10u(-1) != 1) + abort (); + if (test10u(-9) != 1) + abort (); + if (test10u(-10) != 1) + abort (); + + if (test11(19) != 0) + abort (); + if (test11(20) != 1) + abort (); + if (test11(29) != 1) + abort (); + if (test11(30) != 1) + abort (); + + if (test11u(19) != 0) + abort (); + if (test11u(20) != 1) + abort (); + if (test11u(29) != 1) + abort (); + if (test11u(30) != 1) + abort (); + + if (test12(0) != 1) + abort (); + if (test12(9) != 1) + abort (); + if (test12(10) != 1) + abort (); + if (test12(-1) != 1) + abort (); + if (test12(-9) != 1) + abort (); + if (test12(-10) != 0) + abort (); + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/divcmp-2.c b/gcc/testsuite/gcc.c-torture/execute/divcmp-2.c new file mode 100644 index 000000000..b059b8fba --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/divcmp-2.c @@ -0,0 +1,92 @@ +extern void abort (void); + +int test1(int x) +{ + return x/10 == 2; +} + +int test2(int x) +{ + return x/10 == 0; +} + +int test3(int x) +{ + return x/10 == -2; +} + +int test4(int x) +{ + return x/-10 == 2; +} + +int test5(int x) +{ + return x/-10 == 0; +} + +int test6(int x) +{ + return x/-10 == -2; +} + + +int main() +{ + if (test1(19) != 0) + abort (); + if (test1(20) != 1) + abort (); + if (test1(29) != 1) + abort (); + if (test1(30) != 0) + abort (); + + if (test2(-10) != 0) + abort (); + if (test2(-9) != 1) + abort (); + if (test2(9) != 1) + abort (); + if (test2(10) != 0) + abort (); + + if (test3(-30) != 0) + abort (); + if (test3(-29) != 1) + abort (); + if (test3(-20) != 1) + abort (); + if (test3(-19) != 0) + abort (); + + if (test4(-30) != 0) + abort (); + if (test4(-29) != 1) + abort (); + if (test4(-20) != 1) + abort (); + if (test4(-19) != 0) + abort (); + + if (test5(-10) != 0) + abort (); + if (test5(-9) != 1) + abort (); + if (test5(9) != 1) + abort (); + if (test5(10) != 0) + abort (); + + if (test6(19) != 0) + abort (); + if (test6(20) != 1) + abort (); + if (test6(29) != 1) + abort (); + if (test6(30) != 0) + abort (); + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/divcmp-3.c b/gcc/testsuite/gcc.c-torture/execute/divcmp-3.c new file mode 100644 index 000000000..ba52c9e24 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/divcmp-3.c @@ -0,0 +1,97 @@ +extern void abort(void); + +int test1(char x) +{ + return x/100 == 3; +} + +int test1u(unsigned char x) +{ + return x/100 == 3; +} + +int test2(char x) +{ + return x/100 != 3; +} + +int test2u(unsigned char x) +{ + return x/100 != 3; +} + +int test3(char x) +{ + return x/100 < 3; +} + +int test3u(unsigned char x) +{ + return x/100 < 3; +} + +int test4(char x) +{ + return x/100 <= 3; +} + +int test4u(unsigned char x) +{ + return x/100 <= 3; +} + +int test5(char x) +{ + return x/100 > 3; +} + +int test5u(unsigned char x) +{ + return x/100 > 3; +} + +int test6(char x) +{ + return x/100 >= 3; +} + +int test6u(unsigned char x) +{ + return x/100 >= 3; +} + + +int main() +{ + int c; + + for (c=-128; c<256; c++) + { + if (test1(c) != 0) + abort (); + if (test1u(c) != 0) + abort (); + if (test2(c) != 1) + abort (); + if (test2u(c) != 1) + abort (); + if (test3(c) != 1) + abort (); + if (test3u(c) != 1) + abort (); + if (test4(c) != 1) + abort (); + if (test4u(c) != 1) + abort (); + if (test5(c) != 0) + abort (); + if (test5u(c) != 0) + abort (); + if (test6(c) != 0) + abort (); + if (test6u(c) != 0) + abort (); + } + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/divcmp-4.c b/gcc/testsuite/gcc.c-torture/execute/divcmp-4.c new file mode 100644 index 000000000..ebc09a10e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/divcmp-4.c @@ -0,0 +1,202 @@ +/* PR middle-end/17894 */ + +extern void abort(void); + +int test1(int x) +{ + return x/-10 == 2; +} + +int test2(int x) +{ + return x/-10 == 0; +} + +int test3(int x) +{ + return x/-10 != 2; +} + +int test4(int x) +{ + return x/-10 != 0; +} + +int test5(int x) +{ + return x/-10 < 2; +} + +int test6(int x) +{ + return x/-10 < 0; +} + +int test7(int x) +{ + return x/-10 <= 2; +} + +int test8(int x) +{ + return x/-10 <= 0; +} + +int test9(int x) +{ + return x/-10 > 2; +} + +int test10(int x) +{ + return x/-10 > 0; +} + +int test11(int x) +{ + return x/-10 >= 2; +} + +int test12(int x) +{ + return x/-10 >= 0; +} + + +int main() +{ + if (test1(-30) != 0) + abort (); + if (test1(-29) != 1) + abort (); + if (test1(-20) != 1) + abort (); + if (test1(-19) != 0) + abort (); + + if (test2(0) != 1) + abort (); + if (test2(9) != 1) + abort (); + if (test2(10) != 0) + abort (); + if (test2(-1) != 1) + abort (); + if (test2(-9) != 1) + abort (); + if (test2(-10) != 0) + abort (); + + if (test3(-30) != 1) + abort (); + if (test3(-29) != 0) + abort (); + if (test3(-20) != 0) + abort (); + if (test3(-19) != 1) + abort (); + + if (test4(0) != 0) + abort (); + if (test4(9) != 0) + abort (); + if (test4(10) != 1) + abort (); + if (test4(-1) != 0) + abort (); + if (test4(-9) != 0) + abort (); + if (test4(-10) != 1) + abort (); + + if (test5(-30) != 0) + abort (); + if (test5(-29) != 0) + abort (); + if (test5(-20) != 0) + abort (); + if (test5(-19) != 1) + abort (); + + if (test6(0) != 0) + abort (); + if (test6(9) != 0) + abort (); + if (test6(10) != 1) + abort (); + if (test6(-1) != 0) + abort (); + if (test6(-9) != 0) + abort (); + if (test6(-10) != 0) + abort (); + + if (test7(-30) != 0) + abort (); + if (test7(-29) != 1) + abort (); + if (test7(-20) != 1) + abort (); + if (test7(-19) != 1) + abort (); + + if (test8(0) != 1) + abort (); + if (test8(9) != 1) + abort (); + if (test8(10) != 1) + abort (); + if (test8(-1) != 1) + abort (); + if (test8(-9) != 1) + abort (); + if (test8(-10) != 0) + abort (); + + if (test9(-30) != 1) + abort (); + if (test9(-29) != 0) + abort (); + if (test9(-20) != 0) + abort (); + if (test9(-19) != 0) + abort (); + + if (test10(0) != 0) + abort (); + if (test10(9) != 0) + abort (); + if (test10(10) != 0) + abort (); + if (test10(-1) != 0) + abort (); + if (test10(-9) != 0) + abort (); + if (test10(-10) != 1) + abort (); + + if (test11(-30) != 1) + abort (); + if (test11(-29) != 1) + abort (); + if (test11(-20) != 1) + abort (); + if (test11(-19) != 0) + abort (); + + if (test12(0) != 1) + abort (); + if (test12(9) != 1) + abort (); + if (test12(10) != 0) + abort (); + if (test12(-1) != 1) + abort (); + if (test12(-9) != 1) + abort (); + if (test12(-10) != 1) + abort (); + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/divcmp-5.c b/gcc/testsuite/gcc.c-torture/execute/divcmp-5.c new file mode 100644 index 000000000..f6d1af3be --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/divcmp-5.c @@ -0,0 +1,31 @@ +/* PR middle-end/26561 */ + +extern void abort(void); + +int always_one_1 (int a) +{ + if (a/100 >= -999999999) + return 1; + else + return 0; +} + +int always_one_2 (int a) +{ + if (a/100 < -999999999) + return 0; + else + return 1; +} + +int main(void) +{ + if (always_one_1 (0) != 1) + abort (); + + if (always_one_2 (0) != 1) + abort (); + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/divconst-1.c b/gcc/testsuite/gcc.c-torture/execute/divconst-1.c new file mode 100644 index 000000000..ce9dd60a8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/divconst-1.c @@ -0,0 +1,21 @@ +typedef struct +{ + unsigned a, b, c, d; +} t1; + +f (t1 *ps) +{ + ps->a = 10000; + ps->b = ps->a / 3; + ps->c = 10000; + ps->d = ps->c / 3; +} + +main () +{ + t1 s; + f (&s); + if (s.a != 10000 || s.b != 3333 || s.c != 10000 || s.d != 3333) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/divconst-2.c b/gcc/testsuite/gcc.c-torture/execute/divconst-2.c new file mode 100644 index 000000000..b58f1bfdd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/divconst-2.c @@ -0,0 +1,39 @@ +long +f (long x) +{ + return x / (-0x7fffffffL - 1L); +} + +long +r (long x) +{ + return x % (-0x7fffffffL - 1L); +} + +/* Since we have a negative divisor, this equation must hold for the + results of / and %; no specific results are guaranteed. */ +long +std_eqn (long num, long denom, long quot, long rem) +{ + /* For completeness, a check for "ABS (rem) < ABS (denom)" belongs here, + but causes trouble on 32-bit machines and isn't worthwhile. */ + return quot * (-0x7fffffffL - 1L) + rem == num; +} + +long nums[] = +{ + -1L, 0x7fffffffL, -0x7fffffffL - 1L +}; + +main () +{ + int i; + + for (i = 0; + i < sizeof (nums) / sizeof (nums[0]); + i++) + if (std_eqn (nums[i], -0x7fffffffL - 1L, f (nums[i]), r (nums[i])) == 0) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/divconst-3.c b/gcc/testsuite/gcc.c-torture/execute/divconst-3.c new file mode 100644 index 000000000..ddd687cbc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/divconst-3.c @@ -0,0 +1,12 @@ +long long +f (long long x) +{ + return x / 10000000000LL; +} + +main () +{ + if (f (10000000000LL) != 1 || f (100000000000LL) != 10) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/divmod-1.c b/gcc/testsuite/gcc.c-torture/execute/divmod-1.c new file mode 100644 index 000000000..2bcd10970 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/divmod-1.c @@ -0,0 +1,77 @@ +div1 (signed char x) +{ + return x / -1; +} + +div2 (signed short x) +{ + return x / -1; +} + +div3 (signed char x, signed char y) +{ + return x / y; +} + +div4 (signed short x, signed short y) +{ + return x / y; +} + +mod1 (signed char x) +{ + return x % -1; +} + +mod2 (signed short x) +{ + return x % -1; +} + +mod3 (signed char x, signed char y) +{ + return x % y; +} + +mod4 (signed short x, signed short y) +{ + return x % y; +} + +signed long +mod5 (signed long x, signed long y) +{ + return x % y; +} + +unsigned long +mod6 (unsigned long x, unsigned long y) +{ + return x % y; +} + +main () +{ + if (div1 (-(1 << 7)) != 1 << 7) + abort (); + if (div2 (-(1 << 15)) != 1 << 15) + abort (); + if (div3 (-(1 << 7), -1) != 1 << 7) + abort (); + if (div4 (-(1 << 15), -1) != 1 << 15) + abort (); + if (mod1 (-(1 << 7)) != 0) + abort (); + if (mod2 (-(1 << 15)) != 0) + abort (); + if (mod3 (-(1 << 7), -1) != 0) + abort (); + if (mod4 (-(1 << 15), -1) != 0) + abort (); + if (mod5 (0x50000000, 2) != 0) + abort (); + if (mod6 (0x50000000, 2) != 0) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/doloop-1.c b/gcc/testsuite/gcc.c-torture/execute/doloop-1.c new file mode 100644 index 000000000..d2394a62e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/doloop-1.c @@ -0,0 +1,18 @@ +#include + +extern void exit (int); +extern void abort (void); + +volatile unsigned int i; + +int +main (void) +{ + unsigned char z = 0; + + do ++i; + while (--z > 0); + if (i != UCHAR_MAX + 1U) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/doloop-2.c b/gcc/testsuite/gcc.c-torture/execute/doloop-2.c new file mode 100644 index 000000000..f98118002 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/doloop-2.c @@ -0,0 +1,18 @@ +#include + +extern void exit (int); +extern void abort (void); + +volatile unsigned int i; + +int +main (void) +{ + unsigned short z = 0; + + do ++i; + while (--z > 0); + if (i != USHRT_MAX + 1U) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/eeprof-1.c b/gcc/testsuite/gcc.c-torture/execute/eeprof-1.c new file mode 100644 index 000000000..248b8ccbe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/eeprof-1.c @@ -0,0 +1,73 @@ +#define ASSERT(X) if (!(X)) abort (); +#define NOCHK __attribute__ ((no_instrument_function)) + +int entry_calls, exit_calls; +void (*last_fn_entered)(); +void (*last_fn_exited)(); + +__attribute__ ((noinline)) +int main () NOCHK; + +__attribute__ ((noinline)) +void foo () +{ + ASSERT (last_fn_entered == foo); +} + +__attribute__ ((noinline)) +static void foo2 () +{ + ASSERT (entry_calls == 1 && exit_calls == 0); + ASSERT (last_fn_entered == foo2); + foo (); + ASSERT (entry_calls == 2 && exit_calls == 1); + ASSERT (last_fn_entered == foo); + ASSERT (last_fn_exited == foo); +} + +__attribute__ ((noinline)) +void nfoo (void) NOCHK; +void nfoo () +{ + ASSERT (entry_calls == 2 && exit_calls == 2); + ASSERT (last_fn_entered == foo); + ASSERT (last_fn_exited == foo2); + foo (); + ASSERT (entry_calls == 3 && exit_calls == 3); + ASSERT (last_fn_entered == foo); + ASSERT (last_fn_exited == foo); +} + +int main () +{ + ASSERT (entry_calls == 0 && exit_calls == 0); + + foo2 (); + + ASSERT (entry_calls == 2 && exit_calls == 2); + ASSERT (last_fn_entered == foo); + ASSERT (last_fn_exited == foo2); + + nfoo (); + + ASSERT (entry_calls == 3 && exit_calls == 3); + ASSERT (last_fn_entered == foo); + + return 0; +} + +void __cyg_profile_func_enter (void (*fn)(), void (*parent)()) NOCHK; +void __cyg_profile_func_exit (void (*fn)(), void (*parent)()) NOCHK; + +__attribute__ ((noinline)) +void __cyg_profile_func_enter (void (*fn)(), void (*parent)()) +{ + entry_calls++; + last_fn_entered = fn; +} +__attribute__ ((noinline)) +void __cyg_profile_func_exit (void (*fn)(), void (*parent)()) +{ + exit_calls++; + last_fn_exited = fn; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/eeprof-1.x b/gcc/testsuite/gcc.c-torture/execute/eeprof-1.x new file mode 100644 index 000000000..d53f8c23e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/eeprof-1.x @@ -0,0 +1,5 @@ +if { [istarget "powerpc-ibm-aix*"] } { + set torture_execute_xfail "powerpc-ibm-aix*" +} +set additional_flags "-finstrument-functions" +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/enum-1.c b/gcc/testsuite/gcc.c-torture/execute/enum-1.c new file mode 100644 index 000000000..381e35491 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/enum-1.c @@ -0,0 +1,43 @@ +typedef enum +{ + END = -1, + EMPTY = (1 << 8 ) , + BACKREF, + BEGLINE, + ENDLINE, + BEGWORD, + ENDWORD, + LIMWORD, + NOTLIMWORD, + QMARK, + STAR, + PLUS, + REPMN, + CAT, + OR, + ORTOP, + LPAREN, + RPAREN, + CSET +} token; + +static token tok; + +static int +atom () +{ + if ((tok >= 0 && tok < (1 << 8 ) ) || tok >= CSET || tok == BACKREF + || tok == BEGLINE || tok == ENDLINE || tok == BEGWORD + || tok == ENDWORD || tok == LIMWORD || tok == NOTLIMWORD) + return 1; + else + return 0; +} + +main () +{ + tok = 0; + if (atom () != 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/enum-2.c b/gcc/testsuite/gcc.c-torture/execute/enum-2.c new file mode 100644 index 000000000..dd6f64086 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/enum-2.c @@ -0,0 +1,22 @@ +/* Copyright (C) 2000 Free Software Foundation */ +/* by Alexandre Oliva */ + +enum foo { FOO, BAR }; + +/* Even though the underlying type of an enum is unspecified, the type + of enumeration constants is explicitly defined as int (6.4.4.3/2 in + the C99 Standard). Therefore, `i' must not be promoted to + `unsigned' in the comparison below; we must exit the loop when it + becomes negative. */ + +int +main () +{ + int i; + for (i = BAR; i >= FOO; --i) + if (i == -1) + abort (); + + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/enum-3.c b/gcc/testsuite/gcc.c-torture/execute/enum-3.c new file mode 100644 index 000000000..f57bc7f78 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/enum-3.c @@ -0,0 +1,24 @@ +/* The composite type of int and an enum compatible with int might be + either of the two types, but it isn't an unsigned type. */ +/* Origin: Joseph Myers */ + +#include + +#include + +extern void abort (void); +extern void exit (int); + +enum e { a = INT_MIN }; + +int *p; +enum e *q; +int +main (void) +{ + enum e x = a; + q = &x; + if (*(1 ? q : p) > 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/execute.exp b/gcc/testsuite/gcc.c-torture/execute/execute.exp new file mode 100644 index 000000000..a26e59076 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/execute.exp @@ -0,0 +1,50 @@ +# Copyright (C) 1991, 1992, 1993, 1995, 1997, 2007, 2008 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# This file was written by Rob Savoye. (rob@cygnus.com) +# Modified and maintained by Jeffrey Wheat (cassidy@cygnus.com) + +# +# These tests come from Torbjorn Granlund (tege@cygnus.com) +# C torture test suite. +# + +if $tracelevel then { + strace $tracelevel +} + +# load support procs +load_lib torture-options.exp +load_lib c-torture.exp + +torture-init +set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS + +# +# main test loop +# + +foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] { + # If we're only testing specific files and this isn't one of them, skip it. + if ![runtest_file_p $runtests $src] then { + continue + } + + c-torture-execute $src +} + +torture-finish diff --git a/gcc/testsuite/gcc.c-torture/execute/extzvsi.c b/gcc/testsuite/gcc.c-torture/execute/extzvsi.c new file mode 100644 index 000000000..81f16185d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/extzvsi.c @@ -0,0 +1,41 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int +main (void) +{ + exit (0); +} +#else +/* Failed on powerpc due to bad extzvsi pattern. */ + +struct ieee +{ + unsigned int negative:1; + unsigned int exponent:11; + unsigned int mantissa0:20; + unsigned int mantissa1:32; +} x; + +unsigned int +foo (void) +{ + unsigned int exponent; + + exponent = x.exponent; + if (exponent == 0) + return 1; + else if (exponent > 1) + return 2; + return 0; +} + +int +main (void) +{ + x.exponent = 1; + if (foo () != 0) + abort (); + return 0; +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/ffs-1.c b/gcc/testsuite/gcc.c-torture/execute/ffs-1.c new file mode 100644 index 000000000..da82e5580 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ffs-1.c @@ -0,0 +1,12 @@ +__volatile int a = 0; + +extern void abort (void); +extern void exit (int); + +int +main (void) +{ + if (__builtin_ffs (a) != 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ffs-2.c b/gcc/testsuite/gcc.c-torture/execute/ffs-2.c new file mode 100644 index 000000000..ae246cebf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ffs-2.c @@ -0,0 +1,44 @@ +struct + { + int input; + int output; + } +ffstesttab[] = + { +#if __INT_MAX__ >= 2147483647 + /* at least 32-bit integers */ + { 0x80000000, 32 }, + { 0xa5a5a5a5, 1 }, + { 0x5a5a5a5a, 2 }, + { 0xcafe0000, 18 }, +#endif +#if __INT_MAX__ >= 32767 + /* at least 16-bit integers */ + { 0x8000, 16 }, + { 0xa5a5, 1 }, + { 0x5a5a, 2 }, + { 0x0ca0, 6 }, +#endif +#if __INT_MAX__ < 32767 +#error integers are too small +#endif + }; + +#define NFFSTESTS (sizeof (ffstesttab) / sizeof (ffstesttab[0])) + +extern void abort (void); +extern void exit (int); + +int +main (void) +{ + int i; + + for (i = 0; i < NFFSTESTS; i++) + { + if (__builtin_ffs (ffstesttab[i].input) != ffstesttab[i].output) + abort (); + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/float-floor.c b/gcc/testsuite/gcc.c-torture/execute/float-floor.c new file mode 100644 index 000000000..fedc1f73f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/float-floor.c @@ -0,0 +1,21 @@ + +#if(__SIZEOF_DOUBLE__==8) +double d = 1024.0 - 1.0 / 32768.0; +#else +double d = 1024.0 - 1.0 / 16384.0; +#endif + +extern double floor(double); +extern float floorf(float); +extern void abort(); + +int main() { + + double df = floor(d); + float f1 = (float)floor(d); + + if ((int)df != 1023 || (int)f1 != 1023) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/floatunsisf-1.c b/gcc/testsuite/gcc.c-torture/execute/floatunsisf-1.c new file mode 100644 index 000000000..cc4c49bbe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/floatunsisf-1.c @@ -0,0 +1,21 @@ +/* The fp-bit.c function __floatunsisf had a latent bug where guard bits + could be lost leading to incorrect rounding. */ +/* Origin: Joseph Myers */ + +extern void abort (void); +extern void exit (int); +#if __INT_MAX__ >= 0x7fffffff +volatile unsigned u = 0x80000081; +#else +volatile unsigned long u = 0x80000081; +#endif +volatile float f1, f2; +int +main (void) +{ + f1 = (float) u; + f2 = (float) 0x80000081; + if (f1 != f2) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/fprintf-1.c b/gcc/testsuite/gcc.c-torture/execute/fprintf-1.c new file mode 100644 index 000000000..f16252b1e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/fprintf-1.c @@ -0,0 +1,23 @@ +#include +#include + +int +main (void) +{ +#define test(ret, args...) \ + fprintf (stdout, args); \ + if (fprintf (stdout, args) != ret) \ + abort (); + test (5, "hello"); + test (6, "hello\n"); + test (1, "a"); + test (0, ""); + test (5, "%s", "hello"); + test (6, "%s", "hello\n"); + test (1, "%s", "a"); + test (0, "%s", ""); + test (1, "%c", 'x'); + test (7, "%s\n", "hello\n"); + test (2, "%d\n", 0); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/fprintf-chk-1.c b/gcc/testsuite/gcc.c-torture/execute/fprintf-chk-1.c new file mode 100644 index 000000000..918ff8e56 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/fprintf-chk-1.c @@ -0,0 +1,49 @@ +#include +#include +#include + +volatile int should_optimize; + +int +__attribute__((noinline)) +__fprintf_chk (FILE *f, int flag, const char *fmt, ...) +{ + va_list ap; + int ret; +#ifdef __OPTIMIZE__ + if (should_optimize) + abort (); +#endif + should_optimize = 1; + va_start (ap, fmt); + ret = vfprintf (f, fmt, ap); + va_end (ap); + return ret; +} + +int +main (void) +{ +#define test(ret, opt, args...) \ + should_optimize = opt; \ + __fprintf_chk (stdout, 1, args); \ + if (!should_optimize) \ + abort (); \ + should_optimize = 0; \ + if (__fprintf_chk (stdout, 1, args) != ret) \ + abort (); \ + if (!should_optimize) \ + abort (); + test (5, 1, "hello"); + test (6, 1, "hello\n"); + test (1, 1, "a"); + test (0, 1, ""); + test (5, 1, "%s", "hello"); + test (6, 1, "%s", "hello\n"); + test (1, 1, "%s", "a"); + test (0, 1, "%s", ""); + test (1, 1, "%c", 'x'); + test (7, 0, "%s\n", "hello\n"); + test (2, 0, "%d\n", 0); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/frame-address.c b/gcc/testsuite/gcc.c-torture/execute/frame-address.c new file mode 100644 index 000000000..109c2b229 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/frame-address.c @@ -0,0 +1,44 @@ +int check_fa_work (const char *, const char *) __attribute__((noinline)); +int check_fa_mid (const char *) __attribute__((noinline)); +int check_fa (char *) __attribute__((noinline)); +int how_much (void) __attribute__((noinline)); + +int check_fa_work (const char *c, const char *f) +{ + const char d = 0; + + if (c >= &d) + return c >= f && f >= &d; + else + return c <= f && f <= &d; +} + +int check_fa_mid (const char *c) +{ + const char *f = __builtin_frame_address (0); + + /* Prevent a tail call to check_fa_work, eliding the current stack frame. */ + return check_fa_work (c, f) != 0; +} + +int check_fa (char *unused) +{ + const char c = 0; + + /* Prevent a tail call to check_fa_mid, eliding the current stack frame. */ + return check_fa_mid (&c) != 0; +} + +int how_much (void) +{ + return 8; +} + +int main (void) +{ + char *unused = __builtin_alloca (how_much ()); + + if (!check_fa(unused)) + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/func-ptr-1.c b/gcc/testsuite/gcc.c-torture/execute/func-ptr-1.c new file mode 100644 index 000000000..55f0e1066 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/func-ptr-1.c @@ -0,0 +1,16 @@ +static double f (float a); +static double (*fp) (float a); + +main () +{ + fp = f; + if (fp ((float) 1) != 1.0) + abort (); + exit (0); +} + +static double +f (float a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/gofast.c b/gcc/testsuite/gcc.c-torture/execute/gofast.c new file mode 100644 index 000000000..f55ced220 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/gofast.c @@ -0,0 +1,99 @@ +/* Program to test gcc's usage of the gofast library. */ + +/* The main guiding themes are to make it trivial to add test cases over time + and to make it easy for a program to parse the output to see if the right + libcalls are being made. */ + +#include + +float fp_add (float a, float b) { return a + b; } +float fp_sub (float a, float b) { return a - b; } +float fp_mul (float a, float b) { return a * b; } +float fp_div (float a, float b) { return a / b; } +float fp_neg (float a) { return -a; } + +double dp_add (double a, double b) { return a + b; } +double dp_sub (double a, double b) { return a - b; } +double dp_mul (double a, double b) { return a * b; } +double dp_div (double a, double b) { return a / b; } +double dp_neg (double a) { return -a; } + +double fp_to_dp (float f) { return f; } +float dp_to_fp (double d) { return d; } + +int eqsf2 (float a, float b) { return a == b; } +int nesf2 (float a, float b) { return a != b; } +int gtsf2 (float a, float b) { return a > b; } +int gesf2 (float a, float b) { return a >= b; } +int ltsf2 (float a, float b) { return a < b; } +int lesf2 (float a, float b) { return a <= b; } + +int eqdf2 (double a, double b) { return a == b; } +int nedf2 (double a, double b) { return a != b; } +int gtdf2 (double a, double b) { return a > b; } +int gedf2 (double a, double b) { return a >= b; } +int ltdf2 (double a, double b) { return a < b; } +int ledf2 (double a, double b) { return a <= b; } + +float floatsisf (int i) { return i; } +double floatsidf (int i) { return i; } +int fixsfsi (float f) { return f; } +int fixdfsi (double d) { return d; } +unsigned int fixunssfsi (float f) { return f; } +unsigned int fixunsdfsi (double d) { return d; } + +int fail_count = 0; + +int +fail (char *msg) +{ + fail_count++; + fprintf (stderr, "Test failed: %s\n", msg); +} + +int +main() +{ + if (fp_add (1, 1) != 2) fail ("fp_add 1+1"); + if (fp_sub (3, 2) != 1) fail ("fp_sub 3-2"); + if (fp_mul (2, 3) != 6) fail ("fp_mul 2*3"); + if (fp_div (3, 2) != 1.5) fail ("fp_div 3/2"); + if (fp_neg (1) != -1) fail ("fp_neg 1"); + + if (dp_add (1, 1) != 2) fail ("dp_add 1+1"); + if (dp_sub (3, 2) != 1) fail ("dp_sub 3-2"); + if (dp_mul (2, 3) != 6) fail ("dp_mul 2*3"); + if (dp_div (3, 2) != 1.5) fail ("dp_div 3/2"); + if (dp_neg (1) != -1) fail ("dp_neg 1"); + + if (fp_to_dp (1.5) != 1.5) fail ("fp_to_dp 1.5"); + if (dp_to_fp (1.5) != 1.5) fail ("dp_to_fp 1.5"); + + if (floatsisf (1) != 1) fail ("floatsisf 1"); + if (floatsidf (1) != 1) fail ("floatsidf 1"); + if (fixsfsi (1.42) != 1) fail ("fixsfsi 1.42"); + if (fixunssfsi (1.42) != 1) fail ("fixunssfsi 1.42"); + if (fixdfsi (1.42) != 1) fail ("fixdfsi 1.42"); + if (fixunsdfsi (1.42) != 1) fail ("fixunsdfsi 1.42"); + + if (eqsf2 (1, 1) == 0) fail ("eqsf2 1==1"); + if (eqsf2 (1, 2) != 0) fail ("eqsf2 1==2"); + if (nesf2 (1, 2) == 0) fail ("nesf2 1!=1"); + if (nesf2 (1, 1) != 0) fail ("nesf2 1!=1"); + if (gtsf2 (2, 1) == 0) fail ("gtsf2 2>1"); + if (gtsf2 (1, 1) != 0) fail ("gtsf2 1>1"); + if (gtsf2 (0, 1) != 0) fail ("gtsf2 0>1"); + if (gesf2 (2, 1) == 0) fail ("gesf2 2>=1"); + if (gesf2 (1, 1) == 0) fail ("gesf2 1>=1"); + if (gesf2 (0, 1) != 0) fail ("gesf2 0>=1"); + if (ltsf2 (1, 2) == 0) fail ("ltsf2 1<2"); + if (ltsf2 (1, 1) != 0) fail ("ltsf2 1<1"); + if (ltsf2 (1, 0) != 0) fail ("ltsf2 1<0"); + if (lesf2 (1, 2) == 0) fail ("lesf2 1<=2"); + if (lesf2 (1, 1) == 0) fail ("lesf2 1<=1"); + if (lesf2 (1, 0) != 0) fail ("lesf2 1<=0"); + + if (fail_count != 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/20000320-1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/20000320-1.c new file mode 100644 index 000000000..873a17df4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/20000320-1.c @@ -0,0 +1,104 @@ +#if defined(__mips__) && defined(__sgi__) +#include +#endif /* defined(__mips__) && defined(__sgi__) */ +#if __INT_MAX__ != 2147483647 || (__LONG_LONG_MAX__ != 9223372036854775807ll && __LONG_MAX__ != 9223372036854775807ll) +int main(void) { exit (0); } +#else +#if __LONG_MAX__ != 9223372036854775807ll +typedef unsigned long long ull; +#else +typedef unsigned long ull; +#endif +typedef unsigned ul; + +union fl { + float f; + ul l; +} uf; +union dl { + double d; + ull ll; +} ud; + +int failed = 0; + +void c(ull d, ul f) +{ + ud.ll = d; + uf.f = (float) ud.d; + if (uf.l != f) + { + failed++; + } +} + +int main() +{ +#if defined(__mips__) && defined(__sgi__) + /* Many MIPS chips round denormalized floating point numbers to zero + rather than follow the IEEE standard. Change the rounding mode + to correspond to the IEEE rounding mode that rounds numbers to + the nearest representable mode, the most common IEEE rounding + mode. */ + set_fpc_csr(0); +#endif /* defined(__mips__) && defined(__sgi__) */ + + if (sizeof (float) != sizeof (ul) + || sizeof (double) != sizeof (ull)) + exit (0); + + c(0x3690000000000000ULL, 0x00000000U); +#if (defined __arm__ || defined __thumb__) && ! (defined __ARMEB__ || defined __VFP_FP__) + /* The ARM always stores FP numbers in big-wordian format, + even when running in little-byteian mode. */ + c(0x0000000136900000ULL, 0x00000001U); + c(0xffffffff369fffffULL, 0x00000001U); + c(0x0000000036A00000ULL, 0x00000001U); + c(0xffffffff36A7ffffULL, 0x00000001U); + c(0x0000000036A80000ULL, 0x00000002U); + c(0xffffffff36AfffffULL, 0x00000002U); + c(0x0000000036b00000ULL, 0x00000002U); + c(0x0000000136b00000ULL, 0x00000002U); + + c(0xdfffffff380fffffULL, 0x007fffffU); + c(0xe0000000380fffffULL, 0x00800000U); + c(0xe0000001380fffffULL, 0x00800000U); + c(0xffffffff380fffffULL, 0x00800000U); + c(0x0000000038100000ULL, 0x00800000U); + c(0x0000000138100000ULL, 0x00800000U); + c(0x1000000038100000ULL, 0x00800000U); + c(0x1000000138100000ULL, 0x00800001U); + c(0x2fffffff38100000ULL, 0x00800001U); + c(0x3000000038100000ULL, 0x00800002U); + c(0x5000000038100000ULL, 0x00800002U); + c(0x5000000138100000ULL, 0x00800003U); +#else + c(0x3690000000000001ULL, 0x00000001U); + c(0x369fffffffffffffULL, 0x00000001U); + c(0x36A0000000000000ULL, 0x00000001U); + c(0x36A7ffffffffffffULL, 0x00000001U); + c(0x36A8000000000000ULL, 0x00000002U); + c(0x36AfffffffffffffULL, 0x00000002U); + c(0x36b0000000000000ULL, 0x00000002U); + c(0x36b0000000000001ULL, 0x00000002U); + + c(0x380fffffdfffffffULL, 0x007fffffU); + c(0x380fffffe0000000ULL, 0x00800000U); + c(0x380fffffe0000001ULL, 0x00800000U); + c(0x380fffffffffffffULL, 0x00800000U); + c(0x3810000000000000ULL, 0x00800000U); + c(0x3810000000000001ULL, 0x00800000U); + c(0x3810000010000000ULL, 0x00800000U); + c(0x3810000010000001ULL, 0x00800001U); + c(0x381000002fffffffULL, 0x00800001U); + c(0x3810000030000000ULL, 0x00800002U); + c(0x3810000050000000ULL, 0x00800002U); + c(0x3810000050000001ULL, 0x00800003U); +#endif + + if (failed) + abort (); + else + exit (0); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/20000320-1.x b/gcc/testsuite/gcc.c-torture/execute/ieee/20000320-1.x new file mode 100644 index 000000000..4535c611e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/20000320-1.x @@ -0,0 +1,10 @@ +if {[istarget "m68k-*-*"] && [check_effective_target_coldfire_fpu]} { + # ColdFire FPUs require software handling of subnormals. We are + # not aware of any system that has this. + set torture_execute_xfail "m68k-*-*" +} +if [istarget "avr-*-*"] { + # AVR doubles are floats + return 1 +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/20001122-1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/20001122-1.c new file mode 100644 index 000000000..fd7e70262 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/20001122-1.c @@ -0,0 +1,22 @@ +volatile double a, *p; + +int main () +{ + double c, d; + volatile double b; + + d = 1.0; + p = &b; + do + { + c = d; + d = c * 0.5; + b = 1 + d; + } while (b != 1.0); + + a = 1.0 + c; + if (a == 1.0) + abort(); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/20010114-2.c b/gcc/testsuite/gcc.c-torture/execute/ieee/20010114-2.c new file mode 100644 index 000000000..e5ab9485f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/20010114-2.c @@ -0,0 +1,31 @@ +extern void exit (int); +extern void abort (void); + +float +rintf (float x) +{ + static const float TWO23 = 8388608.0; + + if (__builtin_fabs (x) < TWO23) + { + if (x > 0.0) + { + x += TWO23; + x -= TWO23; + } + else if (x < 0.0) + { + x = TWO23 - x; + x = -(x - TWO23); + } + } + + return x; +} + +int main (void) +{ + if (rintf (-1.5) != -2.0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/20010114-2.x b/gcc/testsuite/gcc.c-torture/execute/ieee/20010114-2.x new file mode 100644 index 000000000..73b18d160 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/20010114-2.x @@ -0,0 +1,6 @@ +if [istarget "spu-*-*"] { + # This doesn't work on the SPU because single precision floats are + # always rounded toward 0. + return 1 +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/20010226-1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/20010226-1.c new file mode 100644 index 000000000..ec292aca3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/20010226-1.c @@ -0,0 +1,24 @@ +#include + +long double dfrom = 1.1L; +long double m1; +long double m2; +unsigned long mant_long; + +int main() +{ + /* Some targets don't support a conforming long double type. This is + common with very small parts which set long double == float. Look + to see if the type has at least 32 bits of precision. */ + if (LDBL_EPSILON > 0x1p-31L) + return 0; + + m1 = dfrom / 2.0L; + m2 = m1 * 4294967296.0L; + mant_long = ((unsigned long) m2) & 0xffffffff; + + if (mant_long == 0x8ccccccc) + return 0; + else + abort(); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/20011123-1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/20011123-1.c new file mode 100644 index 000000000..e497251fe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/20011123-1.c @@ -0,0 +1,12 @@ +main() +{ + double db1 = 1.7976931348623157e+308; + long double ldb1 = db1; + + if (sizeof (double) != 8 || sizeof (long double) != 16) + exit (0); + + if (ldb1 != 1.7976931348623157e+308) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/20030331-1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/20030331-1.c new file mode 100644 index 000000000..64d87e13b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/20030331-1.c @@ -0,0 +1,32 @@ +extern void exit (int); +extern void abort (void); +float x = -1.5f; + +float +rintf () +{ + static const float TWO23 = 8388608.0; + + if (__builtin_fabs (x) < TWO23) + { + if (x > 0.0) + { + x += TWO23; + x -= TWO23; + } + else if (x < 0.0) + { + x = TWO23 - x; + x = -(x - TWO23); + } + } + + return x; +} + +int main (void) +{ + if (rintf () != -2.0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/20030331-1.x b/gcc/testsuite/gcc.c-torture/execute/ieee/20030331-1.x new file mode 100644 index 000000000..73b18d160 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/20030331-1.x @@ -0,0 +1,6 @@ +if [istarget "spu-*-*"] { + # This doesn't work on the SPU because single precision floats are + # always rounded toward 0. + return 1 +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/20041213-1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/20041213-1.c new file mode 100644 index 000000000..07bdf6860 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/20041213-1.c @@ -0,0 +1,17 @@ +extern double sqrt (double); +extern void abort (void); +int once; + +double foo (void) +{ + if (once++) + abort (); + return 0.0 / 0.0; +} + +double x; +int main (void) +{ + x = sqrt (foo ()); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/920518-1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/920518-1.c new file mode 100644 index 000000000..7f072b298 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/920518-1.c @@ -0,0 +1,8 @@ +unsigned u=2147483839;float f0=2147483648e0,f1=2147483904e0; +main() +{ + float f=u; + if(f==f0) + abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/920518-1.x b/gcc/testsuite/gcc.c-torture/execute/ieee/920518-1.x new file mode 100644 index 000000000..73b18d160 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/920518-1.x @@ -0,0 +1,6 @@ +if [istarget "spu-*-*"] { + # This doesn't work on the SPU because single precision floats are + # always rounded toward 0. + return 1 +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/920810-1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/920810-1.c new file mode 100644 index 000000000..62d22940a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/920810-1.c @@ -0,0 +1,3 @@ +#include +double normalize(x)double x;{if(x==0)x=0;return x;} +main(){char b[9];sprintf(b,"%g",normalize(-0.0));if(strcmp(b,"0"))abort();exit(0);} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/930529-1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/930529-1.c new file mode 100644 index 000000000..b96a3c064 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/930529-1.c @@ -0,0 +1,27 @@ +main () +{ + union { + double d; + unsigned char c[8]; + } d; + + d.d = 1.0/7.0; + + if (sizeof (char) * 8 == sizeof (double)) + { + if (d.c[0] == 0x92 && d.c[1] == 0x24 && d.c[2] == 0x49 && d.c[3] == 0x92 + && d.c[4] == 0x24 && d.c[5] == 0x49 && d.c[6] == 0xc2 && d.c[7] == 0x3f) + exit (0); + if (d.c[7] == 0x92 && d.c[6] == 0x24 && d.c[5] == 0x49 && d.c[4] == 0x92 + && d.c[3] == 0x24 && d.c[2] == 0x49 && d.c[1] == 0xc2 && d.c[0] == 0x3f) + exit (0); +#if defined __arm__ || defined __thumb__ + if (d.c[4] == 0x92 && d.c[5] == 0x24 && d.c[6] == 0x49 && d.c[7] == 0x92 + && d.c[0] == 0x24 && d.c[1] == 0x49 && d.c[2] == 0xc2 && d.c[3] == 0x3f) + exit (0); +#endif + abort (); + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/980619-1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/980619-1.c new file mode 100644 index 000000000..0465ed51c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/980619-1.c @@ -0,0 +1,23 @@ + int main(void) + { + float reale = 1.0f; + float oneplus; + int i; + + if (sizeof (float) != 4) + exit (0); + + for (i = 0; ; i++) + { + oneplus = 1.0f + reale; + if (oneplus == 1.0f) + break; + reale=reale/2.0f; + } + /* Assumes ieee754 accurate arithmetic above. */ + if (i != 24) + abort (); + else + exit (0); + } + diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/980619-1.x b/gcc/testsuite/gcc.c-torture/execute/ieee/980619-1.x new file mode 100644 index 000000000..4e65f3abd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/980619-1.x @@ -0,0 +1,15 @@ +# This used to fail on ia32, with or without -ffloat-store. +# It works now, but some people think that's a fluke, so I'm +# keeping this around just in case. + +#set torture_eval_before_execute { +# +# set compiler_conditional_xfail_data { +# "ia32 fp rounding isn't pedantic" \ +# "i?86-*-*" \ +# { "-O3" "-O2" "-O1" "-Os"} \ +# { "" } +# } +#} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/acc1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/acc1.c new file mode 100644 index 000000000..e0d969b9d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/acc1.c @@ -0,0 +1,18 @@ +/* Tail call optimizations would reverse the order of additions in func(). */ + +double func (const double *array) +{ + double d = *array; + if (d == 0.0) + return d; + else + return d + func (array + 1); +} + +int main () +{ + double values[] = { 0.1e-100, 1.0, -1.0, 0.0 }; + if (func (values) != 0.1e-100) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/acc2.c b/gcc/testsuite/gcc.c-torture/execute/ieee/acc2.c new file mode 100644 index 000000000..2a44c8a01 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/acc2.c @@ -0,0 +1,19 @@ +/* Tail call optimizations would reverse the order of multiplications + in func(). */ + +double func (const double *array) +{ + double d = *array; + if (d == 1.0) + return d; + else + return d * func (array + 1); +} + +int main () +{ + double values[] = { __DBL_MAX__, 2.0, 0.5, 1.0 }; + if (func (values) != __DBL_MAX__) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/builtin-nan-1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/builtin-nan-1.c new file mode 100644 index 000000000..a487dd4af --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/builtin-nan-1.c @@ -0,0 +1,17 @@ +/* PR middle-end/19983 */ + +typedef __SIZE_TYPE__ size_t; + +extern void abort(void); +extern int memcmp(const void *, const void *, size_t); + +double n1 = __builtin_nan("0x1"); +double n2 = __builtin_nan("0X1"); + +int main() +{ + if (memcmp (&n1, &n2, sizeof(double))) + abort(); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-1.c new file mode 100644 index 000000000..81642534c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-1.c @@ -0,0 +1,189 @@ +/* Copyright (C) 2004 Free Software Foundation. + + Test for correctness of composite floating-point comparisons. + + Written by Paolo Bonzini, 26th May 2004. */ + +extern void abort (void); + +#define TEST(c) if ((c) != ok) abort (); +#define ORD(a, b) (!__builtin_isunordered ((a), (b))) +#define UNORD(a, b) (__builtin_isunordered ((a), (b))) +#define UNEQ(a, b) (__builtin_isunordered ((a), (b)) || ((a) == (b))) +#define UNLT(a, b) (__builtin_isunordered ((a), (b)) || ((a) < (b))) +#define UNLE(a, b) (__builtin_isunordered ((a), (b)) || ((a) <= (b))) +#define UNGT(a, b) (__builtin_isunordered ((a), (b)) || ((a) > (b))) +#define UNGE(a, b) (__builtin_isunordered ((a), (b)) || ((a) >= (b))) +#define LTGT(a, b) (__builtin_islessgreater ((a), (b))) + +float pinf; +float ninf; +float NaN; + +int iuneq (float x, float y, int ok) +{ + TEST (UNEQ (x, y)); + TEST (!LTGT (x, y)); + TEST (UNLE (x, y) && UNGE (x,y)); +} + +int ieq (float x, float y, int ok) +{ + TEST (ORD (x, y) && UNEQ (x, y)); +} + +int iltgt (float x, float y, int ok) +{ + TEST (!UNEQ (x, y)); /* Not optimizable. */ + TEST (LTGT (x, y)); /* Same, __builtin_islessgreater does not trap. */ + TEST (ORD (x, y) && (UNLT (x, y) || UNGT (x,y))); +} + +int ine (float x, float y, int ok) +{ + TEST (UNLT (x, y) || UNGT (x, y)); +} + +int iunlt (float x, float y, int ok) +{ + TEST (UNLT (x, y)); + TEST (UNORD (x, y) || (x < y)); +} + +int ilt (float x, float y, int ok) +{ + TEST (ORD (x, y) && UNLT (x, y)); /* Not optimized */ + TEST ((x <= y) && (x != y)); + TEST ((x <= y) && (y != x)); + TEST ((x != y) && (x <= y)); /* Not optimized */ + TEST ((y != x) && (x <= y)); /* Not optimized */ +} + +int iunle (float x, float y, int ok) +{ + TEST (UNLE (x, y)); + TEST (UNORD (x, y) || (x <= y)); +} + +int ile (float x, float y, int ok) +{ + TEST (ORD (x, y) && UNLE (x, y)); /* Not optimized */ + TEST ((x < y) || (x == y)); + TEST ((y > x) || (x == y)); + TEST ((x == y) || (x < y)); /* Not optimized */ + TEST ((y == x) || (x < y)); /* Not optimized */ +} + +int iungt (float x, float y, int ok) +{ + TEST (UNGT (x, y)); + TEST (UNORD (x, y) || (x > y)); +} + +int igt (float x, float y, int ok) +{ + TEST (ORD (x, y) && UNGT (x, y)); /* Not optimized */ + TEST ((x >= y) && (x != y)); + TEST ((x >= y) && (y != x)); + TEST ((x != y) && (x >= y)); /* Not optimized */ + TEST ((y != x) && (x >= y)); /* Not optimized */ +} + +int iunge (float x, float y, int ok) +{ + TEST (UNGE (x, y)); + TEST (UNORD (x, y) || (x >= y)); +} + +int ige (float x, float y, int ok) +{ + TEST (ORD (x, y) && UNGE (x, y)); /* Not optimized */ + TEST ((x > y) || (x == y)); + TEST ((y < x) || (x == y)); + TEST ((x == y) || (x > y)); /* Not optimized */ + TEST ((y == x) || (x > y)); /* Not optimized */ +} + +int +main () +{ + pinf = __builtin_inf (); + ninf = -__builtin_inf (); + NaN = __builtin_nan (""); + + iuneq (ninf, pinf, 0); + iuneq (NaN, NaN, 1); + iuneq (pinf, ninf, 0); + iuneq (1, 4, 0); + iuneq (3, 3, 1); + iuneq (5, 2, 0); + + ieq (1, 4, 0); + ieq (3, 3, 1); + ieq (5, 2, 0); + + iltgt (ninf, pinf, 1); + iltgt (NaN, NaN, 0); + iltgt (pinf, ninf, 1); + iltgt (1, 4, 1); + iltgt (3, 3, 0); + iltgt (5, 2, 1); + + ine (1, 4, 1); + ine (3, 3, 0); + ine (5, 2, 1); + + iunlt (NaN, ninf, 1); + iunlt (pinf, NaN, 1); + iunlt (pinf, ninf, 0); + iunlt (pinf, pinf, 0); + iunlt (ninf, ninf, 0); + iunlt (1, 4, 1); + iunlt (3, 3, 0); + iunlt (5, 2, 0); + + ilt (1, 4, 1); + ilt (3, 3, 0); + ilt (5, 2, 0); + + iunle (NaN, ninf, 1); + iunle (pinf, NaN, 1); + iunle (pinf, ninf, 0); + iunle (pinf, pinf, 1); + iunle (ninf, ninf, 1); + iunle (1, 4, 1); + iunle (3, 3, 1); + iunle (5, 2, 0); + + ile (1, 4, 1); + ile (3, 3, 1); + ile (5, 2, 0); + + iungt (NaN, ninf, 1); + iungt (pinf, NaN, 1); + iungt (pinf, ninf, 1); + iungt (pinf, pinf, 0); + iungt (ninf, ninf, 0); + iungt (1, 4, 0); + iungt (3, 3, 0); + iungt (5, 2, 1); + + igt (1, 4, 0); + igt (3, 3, 0); + igt (5, 2, 1); + + iunge (NaN, ninf, 1); + iunge (pinf, NaN, 1); + iunge (ninf, pinf, 0); + iunge (pinf, pinf, 1); + iunge (ninf, ninf, 1); + iunge (1, 4, 0); + iunge (3, 3, 1); + iunge (5, 2, 1); + + ige (1, 4, 0); + ige (3, 3, 1); + ige (5, 2, 1); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-1.x b/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-1.x new file mode 100644 index 000000000..2f7a4ecc5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-1.x @@ -0,0 +1,6 @@ +if [istarget "spu-*-*"] { + # The SPU single-precision floating point format does not + # support Nan & Inf. + return 1 +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-2.c b/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-2.c new file mode 100644 index 000000000..1f78a435a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-2.c @@ -0,0 +1,24 @@ +/* Copyright (C) 2004 Free Software Foundation. + + Ensure that the composite comparison optimization doesn't misfire + and attempt to combine an integer comparison with a floating-point one. + + Written by Paolo Bonzini, 26th May 2004. */ + +extern void abort (void); + +int +foo (double x, double y) +{ + /* If miscompiled the following may become false. */ + return (x > y) && ((int)x == (int)y); +} + +int +main () +{ + if (! foo (1.3,1.0)) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-3.c b/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-3.c new file mode 100644 index 000000000..03e6ff2c5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-3.c @@ -0,0 +1,97 @@ +/* Copyright (C) 2004 Free Software Foundation. + + Test for composite comparison always true/false optimization. + + Written by Paolo Bonzini, 26th May 2004. */ + +extern void link_error0 (); +extern void link_error1 (); + +void +test1 (float x, float y) +{ + if ((x==y) && (x!=y)) + link_error0(); +} + +void +test2 (float x, float y) +{ + if ((xy)) + link_error0(); +} + +void +test3 (float x, float y) +{ + if ((x=y) || (x= (b)) +#define UNORD(a, b) (!ORD ((a), (b))) +#define UNEQ(a, b) (!LTGT ((a), (b))) +#define UNLT(a, b) (((a) < (b)) || __builtin_isunordered ((a), (b))) +#define UNLE(a, b) (((a) <= (b)) || __builtin_isunordered ((a), (b))) +#define UNGT(a, b) (((a) > (b)) || __builtin_isunordered ((a), (b))) +#define UNGE(a, b) (((a) >= (b)) || __builtin_isunordered ((a), (b))) +#define LTGT(a, b) (((a) < (b)) || (a) > (b)) + +float pinf; +float ninf; +float NaN; + +int iuneq (float x, float y, int ok) +{ + TEST (UNEQ (x, y)); + TEST (!LTGT (x, y)); + TEST (UNLE (x, y) && UNGE (x,y)); +} + +int ieq (float x, float y, int ok) +{ + TEST (ORD (x, y) && UNEQ (x, y)); +} + +int iltgt (float x, float y, int ok) +{ + TEST (!UNEQ (x, y)); + TEST (LTGT (x, y)); + TEST (ORD (x, y) && (UNLT (x, y) || UNGT (x,y))); +} + +int ine (float x, float y, int ok) +{ + TEST (UNLT (x, y) || UNGT (x, y)); + TEST ((x < y) || (x > y) || UNORD (x, y)); +} + +int iunlt (float x, float y, int ok) +{ + TEST (UNLT (x, y)); + TEST (UNORD (x, y) || (x < y)); +} + +int ilt (float x, float y, int ok) +{ + TEST (ORD (x, y) && UNLT (x, y)); + TEST ((x <= y) && (x != y)); + TEST ((x <= y) && (y != x)); + TEST ((x != y) && (x <= y)); + TEST ((y != x) && (x <= y)); +} + +int iunle (float x, float y, int ok) +{ + TEST (UNLE (x, y)); + TEST (UNORD (x, y) || (x <= y)); +} + +int ile (float x, float y, int ok) +{ + TEST (ORD (x, y) && UNLE (x, y)); + TEST ((x < y) || (x == y)); + TEST ((y > x) || (x == y)); + TEST ((x == y) || (x < y)); + TEST ((y == x) || (x < y)); +} + +int iungt (float x, float y, int ok) +{ + TEST (UNGT (x, y)); + TEST (UNORD (x, y) || (x > y)); +} + +int igt (float x, float y, int ok) +{ + TEST (ORD (x, y) && UNGT (x, y)); + TEST ((x >= y) && (x != y)); + TEST ((x >= y) && (y != x)); + TEST ((x != y) && (x >= y)); + TEST ((y != x) && (x >= y)); +} + +int iunge (float x, float y, int ok) +{ + TEST (UNGE (x, y)); + TEST (UNORD (x, y) || (x >= y)); +} + +int ige (float x, float y, int ok) +{ + TEST (ORD (x, y) && UNGE (x, y)); + TEST ((x > y) || (x == y)); + TEST ((y < x) || (x == y)); + TEST ((x == y) || (x > y)); + TEST ((y == x) || (x > y)); +} + +int +main () +{ + pinf = __builtin_inf (); + ninf = -__builtin_inf (); + NaN = __builtin_nan (""); + + iuneq (ninf, pinf, 0); + iuneq (NaN, NaN, 1); + iuneq (pinf, ninf, 0); + iuneq (1, 4, 0); + iuneq (3, 3, 1); + iuneq (5, 2, 0); + + ieq (1, 4, 0); + ieq (3, 3, 1); + ieq (5, 2, 0); + + iltgt (ninf, pinf, 1); + iltgt (NaN, NaN, 0); + iltgt (pinf, ninf, 1); + iltgt (1, 4, 1); + iltgt (3, 3, 0); + iltgt (5, 2, 1); + + ine (1, 4, 1); + ine (3, 3, 0); + ine (5, 2, 1); + + iunlt (NaN, ninf, 1); + iunlt (pinf, NaN, 1); + iunlt (pinf, ninf, 0); + iunlt (pinf, pinf, 0); + iunlt (ninf, ninf, 0); + iunlt (1, 4, 1); + iunlt (3, 3, 0); + iunlt (5, 2, 0); + + ilt (1, 4, 1); + ilt (3, 3, 0); + ilt (5, 2, 0); + + iunle (NaN, ninf, 1); + iunle (pinf, NaN, 1); + iunle (pinf, ninf, 0); + iunle (pinf, pinf, 1); + iunle (ninf, ninf, 1); + iunle (1, 4, 1); + iunle (3, 3, 1); + iunle (5, 2, 0); + + ile (1, 4, 1); + ile (3, 3, 1); + ile (5, 2, 0); + + iungt (NaN, ninf, 1); + iungt (pinf, NaN, 1); + iungt (pinf, ninf, 1); + iungt (pinf, pinf, 0); + iungt (ninf, ninf, 0); + iungt (1, 4, 0); + iungt (3, 3, 0); + iungt (5, 2, 1); + + igt (1, 4, 0); + igt (3, 3, 0); + igt (5, 2, 1); + + iunge (NaN, ninf, 1); + iunge (pinf, NaN, 1); + iunge (ninf, pinf, 0); + iunge (pinf, pinf, 1); + iunge (ninf, ninf, 1); + iunge (1, 4, 0); + iunge (3, 3, 1); + iunge (5, 2, 1); + + ige (1, 4, 0); + ige (3, 3, 1); + ige (5, 2, 1); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-4.x b/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-4.x new file mode 100644 index 000000000..d7ecd1100 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-4.x @@ -0,0 +1,23 @@ +# The ARM VxWorks kernel uses an external floating-point library in +# which routines like __ledf2 are just aliases for __cmpdf2. These +# routines therefore don't handle NaNs correctly. +if [istarget "arm*-*-vxworks*"] { + set torture_eval_before_execute { + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data { + "The ARM kernel uses a flawed floating-point library." + { "*-*-*" } + {} + { "-mrtp" } + } + } +} + +if [istarget "spu-*-*"] { + # The SPU single-precision floating point format does not + # support Nan & Inf. + return 1 +} + +lappend additional_flags "-fno-trapping-math" +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/copysign1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/copysign1.c new file mode 100644 index 000000000..fa4097a74 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/copysign1.c @@ -0,0 +1,76 @@ +#include +#include +#include + +#define fpsizeoff sizeof(float) +#define fpsizeof sizeof(double) +#define fpsizeofl sizeof(long double) + +/* Work around the fact that with the Intel double-extended precision, + we've got a 10 byte type stuffed into some amount of padding. And + the fact that -ffloat-store is going to stuff this value temporarily + into some bit of stack frame that we've no control over and can't zero. */ +#if LDBL_MANT_DIG == 64 +# if defined(__i386__) || defined(__x86_64__) || defined (__ia64__) +# undef fpsizeofl +# define fpsizeofl 10 +# endif +#endif + +/* Work around the fact that the sign of the second double in the IBM + double-double format is not strictly specified when it contains a zero. + For instance, -0.0L can be represented with either (-0.0, +0.0) or + (-0.0, -0.0). The former is what we'll get from the compiler when it + builds constants; the later is what we'll get from the negation operator + at runtime. */ +/* ??? This hack only works for big-endian, which is fortunately true for + all of AIX, Darwin, and Irix. */ +#if LDBL_MANT_DIG == 106 +# undef fpsizeofl +# define fpsizeofl sizeof(double) +#endif + + +#define TEST(TYPE, EXT) \ +TYPE c##EXT (TYPE x, TYPE y) \ +{ \ + return __builtin_copysign##EXT (x, y); \ +} \ + \ +struct D##EXT { TYPE x, y, z; }; \ + \ +static const struct D##EXT T##EXT[] = { \ + { 1.0, 2.0, 1.0 }, \ + { 1.0, -2.0, -1.0 }, \ + { -1.0, -2.0, -1.0 }, \ + { 0.0, -2.0, -0.0 }, \ + { -0.0, -2.0, -0.0 }, \ + { -0.0, 2.0, 0.0 }, \ + { __builtin_inf##EXT (), -0.0, -__builtin_inf##EXT () }, \ + { -__builtin_nan##EXT (""), __builtin_inf##EXT (), \ + __builtin_nan##EXT ("") } \ +}; \ + \ +void test##EXT (void) \ +{ \ + int i, n = sizeof (T##EXT) / sizeof (T##EXT[0]); \ + TYPE r; \ + for (i = 0; i < n; ++i) \ + { \ + r = c##EXT (T##EXT[i].x, T##EXT[i].y); \ + if (memcmp (&r, &T##EXT[i].z, fpsizeof##EXT) != 0) \ + abort (); \ + } \ +} + +TEST(float, f) +TEST(double, ) +TEST(long double, l) + +int main() +{ + testf(); + test(); + testl(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/copysign2.c b/gcc/testsuite/gcc.c-torture/execute/ieee/copysign2.c new file mode 100644 index 000000000..fac7ab3a5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/copysign2.c @@ -0,0 +1,70 @@ +#include +#include +#include + +#define fpsizeoff sizeof(float) +#define fpsizeof sizeof(double) +#define fpsizeofl sizeof(long double) + +/* Work around the fact that with the Intel double-extended precision, + we've got a 10 byte type stuffed into some amount of padding. And + the fact that -ffloat-store is going to stuff this value temporarily + into some bit of stack frame that we've no control over and can't zero. */ +#if LDBL_MANT_DIG == 64 +# if defined(__i386__) || defined(__x86_64__) || defined (__ia64__) +# undef fpsizeofl +# define fpsizeofl 10 +# endif +#endif + +/* Work around the fact that the sign of the second double in the IBM + double-double format is not strictly specified when it contains a zero. + For instance, -0.0L can be represented with either (-0.0, +0.0) or + (-0.0, -0.0). The former is what we'll get from the compiler when it + builds constants; the later is what we'll get from the negation operator + at runtime. */ +/* ??? This hack only works for big-endian, which is fortunately true for + all of AIX, Darwin, and Irix. */ +#if LDBL_MANT_DIG == 106 +# undef fpsizeofl +# define fpsizeofl sizeof(double) +#endif + + +#define TEST(TYPE, EXT) \ +static TYPE Y##EXT[] = { \ + 2.0, -2.0, -2.0, -2.0, -2.0, 2.0, -0.0, __builtin_inf##EXT () \ +}; \ +static const TYPE Z##EXT[] = { \ + 1.0, -1.0, -1.0, -0.0, -0.0, 0.0, -__builtin_inf##EXT (), \ + __builtin_nan##EXT ("") \ +}; \ + \ +void test##EXT (void) \ +{ \ + TYPE r[8]; \ + int i; \ + r[0] = __builtin_copysign##EXT (1.0, Y##EXT[0]); \ + r[1] = __builtin_copysign##EXT (1.0, Y##EXT[1]); \ + r[2] = __builtin_copysign##EXT (-1.0, Y##EXT[2]); \ + r[3] = __builtin_copysign##EXT (0.0, Y##EXT[3]); \ + r[4] = __builtin_copysign##EXT (-0.0, Y##EXT[4]); \ + r[5] = __builtin_copysign##EXT (-0.0, Y##EXT[5]); \ + r[6] = __builtin_copysign##EXT (__builtin_inf##EXT (), Y##EXT[6]); \ + r[7] = __builtin_copysign##EXT (-__builtin_nan##EXT (""), Y##EXT[7]); \ + for (i = 0; i < 8; ++i) \ + if (memcmp (r+i, Z##EXT+i, fpsizeof##EXT) != 0) \ + abort (); \ +} + +TEST(float, f) +TEST(double, ) +TEST(long double, l) + +int main() +{ + testf(); + test(); + testl(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-1.c new file mode 100644 index 000000000..0655c73a1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-1.c @@ -0,0 +1,43 @@ +#ifndef SIGNAL_SUPPRESS +#include +#endif + +double dnan = 1.0/0.0 - 1.0/0.0; +double x = 1.0; + +void leave () +{ + exit (0); +} + +main () +{ +#if ! defined (__vax__) && ! defined (_CRAY) + /* Move this line earlier, for architectures (like alpha) that issue + SIGFPE on the first comparisons. */ +#ifndef SIGNAL_SUPPRESS + /* Some machines catches a SIGFPE when a NaN is compared. + Let this test succeed o such machines. */ + signal (SIGFPE, leave); +#endif + /* NaN is an IEEE unordered operand. All these test should be false. */ + if (dnan == dnan) + abort (); + if (dnan != x) + x = 1.0; + else + abort (); + + if (dnan < x) + abort (); + if (dnan > x) + abort (); + if (dnan <= x) + abort (); + if (dnan >= x) + abort (); + if (dnan == x) + abort (); +#endif + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-1.x b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-1.x new file mode 100644 index 000000000..84c193fe0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-1.x @@ -0,0 +1,16 @@ +# The ARM VxWorks kernel uses an external floating-point library in +# which routines like __ledf2 are just aliases for __cmpdf2. These +# routines therefore don't handle NaNs correctly. +if [istarget "arm*-*-vxworks*"] { + set torture_eval_before_execute { + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data { + "The ARM kernel uses a flawed floating-point library." + { "*-*-*" } + {} + { "-mrtp" } + } + } +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-2.c b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-2.c new file mode 100644 index 000000000..0f4c6f145 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-2.c @@ -0,0 +1,43 @@ +#ifndef SIGNAL_SUPPRESS +#include +#endif + +float fnan = 1.0f/0.0f - 1.0f/0.0f; +float x = 1.0f; + +void leave () +{ + exit (0); +} + +main () +{ +#if ! defined (__vax__) && ! defined (_CRAY) + /* Move this line earlier, for architectures (like alpha) that issue + SIGFPE on the first comparisons. */ +#ifndef SIGNAL_SUPPRESS + /* Some machines catches a SIGFPE when a NaN is compared. + Let this test succeed o such machines. */ + signal (SIGFPE, leave); +#endif + /* NaN is an IEEE unordered operand. All these test should be false. */ + if (fnan == fnan) + abort (); + if (fnan != x) + x = 1.0; + else + abort (); + + if (fnan < x) + abort (); + if (fnan > x) + abort (); + if (fnan <= x) + abort (); + if (fnan >= x) + abort (); + if (fnan == x) + abort (); +#endif + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-2.x b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-2.x new file mode 100644 index 000000000..0fe5a98d3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-2.x @@ -0,0 +1,22 @@ +# The ARM VxWorks kernel uses an external floating-point library in +# which routines like __ledf2 are just aliases for __cmpdf2. These +# routines therefore don't handle NaNs correctly. +if [istarget "arm*-*-vxworks*"] { + set torture_eval_before_execute { + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data { + "The ARM kernel uses a flawed floating-point library." + { "*-*-*" } + {} + { "-mrtp" } + } + } +} + +if [istarget "spu-*-*"] { + # The SPU single-precision floating point format does not + # support Nan & Inf. + return 1 +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-3.c b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-3.c new file mode 100644 index 000000000..710b85ccb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-3.c @@ -0,0 +1,43 @@ +#ifndef SIGNAL_SUPPRESS +#include +#endif + +long double dnan = 1.0l/0.0l - 1.0l/0.0l; +long double x = 1.0l; + +void leave () +{ + exit (0); +} + +main () +{ +#if ! defined (__vax__) && ! defined (_CRAY) + /* Move this line earlier, for architectures (like alpha) that issue + SIGFPE on the first comparisons. */ +#ifndef SIGNAL_SUPPRESS + /* Some machines catches a SIGFPE when a NaN is compared. + Let this test succeed o such machines. */ + signal (SIGFPE, leave); +#endif + /* NaN is an IEEE unordered operand. All these test should be false. */ + if (dnan == dnan) + abort (); + if (dnan != x) + x = 1.0; + else + abort (); + + if (dnan < x) + abort (); + if (dnan > x) + abort (); + if (dnan <= x) + abort (); + if (dnan >= x) + abort (); + if (dnan == x) + abort (); +#endif + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-3.x b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-3.x new file mode 100644 index 000000000..84c193fe0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-3.x @@ -0,0 +1,16 @@ +# The ARM VxWorks kernel uses an external floating-point library in +# which routines like __ledf2 are just aliases for __cmpdf2. These +# routines therefore don't handle NaNs correctly. +if [istarget "arm*-*-vxworks*"] { + set torture_eval_before_execute { + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data { + "The ARM kernel uses a flawed floating-point library." + { "*-*-*" } + {} + { "-mrtp" } + } + } +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4.c b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4.c new file mode 100644 index 000000000..d4bb9c6c6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4.c @@ -0,0 +1,135 @@ +#ifndef FLOAT +#define FLOAT double +#endif + +void +test_isunordered(FLOAT x, FLOAT y, int true) +{ + if (__builtin_isunordered(x, y)) + { + if (! true) + abort (); + } + else + { + if (true) + abort (); + } +} + +void +test_isless(FLOAT x, FLOAT y, int true) +{ + if (__builtin_isless(x, y)) + { + if (! true) + abort (); + } + else + { + if (true) + abort (); + } +} + +void +test_islessequal(FLOAT x, FLOAT y, int true) +{ + if (__builtin_islessequal(x, y)) + { + if (! true) + abort (); + } + else + { + if (true) + abort (); + } +} + +void +test_isgreater(FLOAT x, FLOAT y, int true) +{ + if (__builtin_isgreater(x, y)) + { + if (! true) + abort (); + } + else + { + if (true) + abort (); + } +} + +void +test_isgreaterequal(FLOAT x, FLOAT y, int true) +{ + if (__builtin_isgreaterequal(x, y)) + { + if (! true) + abort (); + } + else + { + if (true) + abort (); + } +} + +void +test_islessgreater(FLOAT x, FLOAT y, int true) +{ + if (__builtin_islessgreater(x, y)) + { + if (! true) + abort (); + } + else + { + if (true) + abort (); + } +} + +#define NAN (0.0 / 0.0) + +int +main() +{ + struct try + { + FLOAT x, y; + unsigned unord : 1; + unsigned lt : 1; + unsigned le : 1; + unsigned gt : 1; + unsigned ge : 1; + unsigned lg : 1; + }; + + static struct try const data[] = + { + { NAN, NAN, 1, 0, 0, 0, 0, 0 }, + { 0.0, NAN, 1, 0, 0, 0, 0, 0 }, + { NAN, 0.0, 1, 0, 0, 0, 0, 0 }, + { 0.0, 0.0, 0, 0, 1, 0, 1, 0 }, + { 1.0, 2.0, 0, 1, 1, 0, 0, 1 }, + { 2.0, 1.0, 0, 0, 0, 1, 1, 1 }, + }; + + const int n = sizeof(data) / sizeof(data[0]); + int i; + + for (i = 0; i < n; ++i) + { + test_isunordered (data[i].x, data[i].y, data[i].unord); + test_isless (data[i].x, data[i].y, data[i].lt); + test_islessequal (data[i].x, data[i].y, data[i].le); + test_isgreater (data[i].x, data[i].y, data[i].gt); + test_isgreaterequal (data[i].x, data[i].y, data[i].ge); + test_islessgreater (data[i].x, data[i].y, data[i].lg); + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4e.c b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4e.c new file mode 100644 index 000000000..c8cacb27a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4e.c @@ -0,0 +1,10 @@ +#if defined (__ia64__) && defined (__hpux__) +#define FLOAT __float80 +#include "fp-cmp-4.c" +#else +int +main () +{ + return 0; +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4f.c b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4f.c new file mode 100644 index 000000000..6221b250d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4f.c @@ -0,0 +1,2 @@ +#define FLOAT float +#include "fp-cmp-4.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4f.x b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4f.x new file mode 100644 index 000000000..2f7a4ecc5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4f.x @@ -0,0 +1,6 @@ +if [istarget "spu-*-*"] { + # The SPU single-precision floating point format does not + # support Nan & Inf. + return 1 +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4l.c b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4l.c new file mode 100644 index 000000000..5ac8b7565 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4l.c @@ -0,0 +1,2 @@ +#define FLOAT long double +#include "fp-cmp-4.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-5.c b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-5.c new file mode 100644 index 000000000..9c70072f4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-5.c @@ -0,0 +1,131 @@ +/* Like fp-cmp-4.c, but test that the setcc patterns are correct. */ + +static int +test_isunordered(double x, double y) +{ + return __builtin_isunordered(x, y); +} + +static int +test_not_isunordered(double x, double y) +{ + return !__builtin_isunordered(x, y); +} + +static int +test_isless(double x, double y) +{ + return __builtin_isless(x, y); +} + +static int +test_not_isless(double x, double y) +{ + return !__builtin_isless(x, y); +} + +static int +test_islessequal(double x, double y) +{ + return __builtin_islessequal(x, y); +} + +static int +test_not_islessequal(double x, double y) +{ + return !__builtin_islessequal(x, y); +} + +static int +test_isgreater(double x, double y) +{ + return __builtin_isgreater(x, y); +} + +static int +test_not_isgreater(double x, double y) +{ + return !__builtin_isgreater(x, y); +} + +static int +test_isgreaterequal(double x, double y) +{ + return __builtin_isgreaterequal(x, y); +} + +static int +test_not_isgreaterequal(double x, double y) +{ + return !__builtin_isgreaterequal(x, y); +} + +static int +test_islessgreater(double x, double y) +{ + return __builtin_islessgreater(x, y); +} + +static int +test_not_islessgreater(double x, double y) +{ + return !__builtin_islessgreater(x, y); +} + +static void +one_test(double x, double y, int expected, + int (*pos) (double, double), int (*neg) (double, double)) +{ + if ((*pos)(x, y) != expected) + abort (); + if ((*neg)(x, y) != !expected) + abort (); +} + +#define NAN (0.0 / 0.0) + +int +main() +{ + struct try + { + double x, y; + int result[6]; + }; + + static struct try const data[] = + { + { NAN, NAN, { 1, 0, 0, 0, 0, 0 } }, + { 0.0, NAN, { 1, 0, 0, 0, 0, 0 } }, + { NAN, 0.0, { 1, 0, 0, 0, 0, 0 } }, + { 0.0, 0.0, { 0, 0, 1, 0, 1, 0 } }, + { 1.0, 2.0, { 0, 1, 1, 0, 0, 1 } }, + { 2.0, 1.0, { 0, 0, 0, 1, 1, 1 } }, + }; + + struct test + { + int (*pos)(double, double); + int (*neg)(double, double); + }; + + static struct test const tests[] = + { + { test_isunordered, test_not_isunordered }, + { test_isless, test_not_isless }, + { test_islessequal, test_not_islessequal }, + { test_isgreater, test_not_isgreater }, + { test_isgreaterequal, test_not_isgreaterequal }, + { test_islessgreater, test_not_islessgreater } + }; + + const int n = sizeof(data) / sizeof(data[0]); + int i, j; + + for (i = 0; i < n; ++i) + for (j = 0; j < 6; ++j) + one_test (data[i].x, data[i].y, data[i].result[j], + tests[j].pos, tests[j].neg); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-6.c b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-6.c new file mode 100644 index 000000000..782455831 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-6.c @@ -0,0 +1,39 @@ + +const double dnan = 1.0/0.0 - 1.0/0.0; +double x = 1.0; + +extern void link_error (void); +extern void abort (void); + +main () +{ +#if ! defined (__vax__) && ! defined (_CRAY) + /* NaN is an IEEE unordered operand. All these test should be false. */ + if (dnan == dnan) + link_error (); + if (dnan != x) + x = 1.0; + else + link_error (); + + if (dnan < x) + link_error (); + if (dnan > x) + link_error (); + if (dnan <= x) + link_error (); + if (dnan >= x) + link_error (); + if (dnan == x) + link_error (); +#endif + exit (0); +} + +#ifndef __OPTIMIZE__ +void link_error (void) +{ + abort (); +} +#endif + diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-6.x b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-6.x new file mode 100644 index 000000000..e7c051d8f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-6.x @@ -0,0 +1,16 @@ +# The ARM VxWorks kernel uses an external floating-point library in +# which routines like __ledf2 are just aliases for __cmpdf2. These +# routines therefore don't handle NaNs correctly. +if [istarget "arm*-*-vxworks*"] { + set torture_eval_before_execute { + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data { + "The ARM kernel uses a flawed floating-point library." + { "*-*-*" } + { "-O0" } + { "-mrtp" } + } + } +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-7.c b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-7.c new file mode 100644 index 000000000..385acafc2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-7.c @@ -0,0 +1,14 @@ +extern void link_error (); + +void foo(double x) +{ + if (x > __builtin_inf()) + link_error (); +} + +int main () +{ + foo (1.0); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8.c b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8.c new file mode 100644 index 000000000..7e24c66d9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8.c @@ -0,0 +1,145 @@ +#ifndef FLOAT +#define FLOAT double +#endif + +/* Like fp-cmp-4.c, but test that the cmove patterns are correct. */ + +static FLOAT +test_isunordered(FLOAT x, FLOAT y, FLOAT a, FLOAT b) +{ + return __builtin_isunordered(x, y) ? a : b; +} + +static FLOAT +test_not_isunordered(FLOAT x, FLOAT y, FLOAT a, FLOAT b) +{ + return !__builtin_isunordered(x, y) ? a : b; +} + +static FLOAT +test_isless(FLOAT x, FLOAT y, FLOAT a, FLOAT b) +{ + return __builtin_isless(x, y) ? a : b; +} + +static FLOAT +test_not_isless(FLOAT x, FLOAT y, FLOAT a, FLOAT b) +{ + return !__builtin_isless(x, y) ? a : b; +} + +static FLOAT +test_islessequal(FLOAT x, FLOAT y, FLOAT a, FLOAT b) +{ + return __builtin_islessequal(x, y) ? a : b; +} + +static FLOAT +test_not_islessequal(FLOAT x, FLOAT y, FLOAT a, FLOAT b) +{ + return !__builtin_islessequal(x, y) ? a : b; +} + +static FLOAT +test_isgreater(FLOAT x, FLOAT y, FLOAT a, FLOAT b) +{ + return __builtin_isgreater(x, y) ? a : b; +} + +static FLOAT +test_not_isgreater(FLOAT x, FLOAT y, FLOAT a, FLOAT b) +{ + return !__builtin_isgreater(x, y) ? a : b; +} + +static FLOAT +test_isgreaterequal(FLOAT x, FLOAT y, FLOAT a, FLOAT b) +{ + return __builtin_isgreaterequal(x, y) ? a : b; +} + +static FLOAT +test_not_isgreaterequal(FLOAT x, FLOAT y, FLOAT a, FLOAT b) +{ + return !__builtin_isgreaterequal(x, y) ? a : b; +} + +static FLOAT +test_islessgreater(FLOAT x, FLOAT y, FLOAT a, FLOAT b) +{ + return __builtin_islessgreater(x, y) ? a : b; +} + +static FLOAT +test_not_islessgreater(FLOAT x, FLOAT y, FLOAT a, FLOAT b) +{ + return !__builtin_islessgreater(x, y) ? a : b; +} + +static void +one_test(FLOAT x, FLOAT y, int expected, + FLOAT (*pos) (FLOAT, FLOAT, FLOAT, FLOAT), + FLOAT (*neg) (FLOAT, FLOAT, FLOAT, FLOAT)) +{ + if (((*pos)(x, y, 1.0, 2.0) == 1.0) != expected) + abort (); + if (((*neg)(x, y, 3.0, 4.0) == 4.0) != expected) + abort (); +} + +#define NAN (0.0 / 0.0) +#define INF (1.0 / 0.0) + +int +main() +{ + struct try + { + FLOAT x, y; + int result[6]; + }; + + static struct try const data[] = + { + { NAN, NAN, { 1, 0, 0, 0, 0, 0 } }, + { 0.0, NAN, { 1, 0, 0, 0, 0, 0 } }, + { NAN, 0.0, { 1, 0, 0, 0, 0, 0 } }, + { 0.0, 0.0, { 0, 0, 1, 0, 1, 0 } }, + { 1.0, 2.0, { 0, 1, 1, 0, 0, 1 } }, + { 2.0, 1.0, { 0, 0, 0, 1, 1, 1 } }, + { INF, 0.0, { 0, 0, 0, 1, 1, 1 } }, + { 1.0, INF, { 0, 1, 1, 0, 0, 1 } }, + { INF, INF, { 0, 0, 1, 0, 1, 0 } }, + { 0.0, -INF, { 0, 0, 0, 1, 1, 1 } }, + { -INF, 1.0, { 0, 1, 1, 0, 0, 1 } }, + { -INF, -INF, { 0, 0, 1, 0, 1, 0 } }, + { INF, -INF, { 0, 0, 0, 1, 1, 1 } }, + { -INF, INF, { 0, 1, 1, 0, 0, 1 } }, + }; + + struct test + { + FLOAT (*pos)(FLOAT, FLOAT, FLOAT, FLOAT); + FLOAT (*neg)(FLOAT, FLOAT, FLOAT, FLOAT); + }; + + static struct test const tests[] = + { + { test_isunordered, test_not_isunordered }, + { test_isless, test_not_isless }, + { test_islessequal, test_not_islessequal }, + { test_isgreater, test_not_isgreater }, + { test_isgreaterequal, test_not_isgreaterequal }, + { test_islessgreater, test_not_islessgreater } + }; + + const int n = sizeof(data) / sizeof(data[0]); + int i, j; + + for (i = 0; i < n; ++i) + for (j = 0; j < 6; ++j) + one_test (data[i].x, data[i].y, data[i].result[j], + tests[j].pos, tests[j].neg); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8e.c b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8e.c new file mode 100644 index 000000000..acb83f67f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8e.c @@ -0,0 +1,10 @@ +#if defined (__ia64__) && defined (__hpux__) +#define FLOAT __float80 +#include "fp-cmp-8.c" +#else +int +main () +{ + return 0; +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8f.c b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8f.c new file mode 100644 index 000000000..9826ec916 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8f.c @@ -0,0 +1,2 @@ +#define FLOAT float +#include "fp-cmp-8.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8f.x b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8f.x new file mode 100644 index 000000000..2f7a4ecc5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8f.x @@ -0,0 +1,6 @@ +if [istarget "spu-*-*"] { + # The SPU single-precision floating point format does not + # support Nan & Inf. + return 1 +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8l.c b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8l.c new file mode 100644 index 000000000..528eeb0ab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8l.c @@ -0,0 +1,2 @@ +#define FLOAT long double +#include "fp-cmp-8.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/hugeval.c b/gcc/testsuite/gcc.c-torture/execute/ieee/hugeval.c new file mode 100644 index 000000000..15f7088e1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/hugeval.c @@ -0,0 +1,27 @@ +#include + +static const double zero = 0.0; +static const double pone = 1.0; +static const double none = -1.0; +static const double pinf = 1.0 / 0.0; +static const double ninf = -1.0 / 0.0; + +int +main () +{ + if (pinf != pone/zero) + abort (); + + if (ninf != none/zero) + abort (); + +#ifdef HUGE_VAL + if (HUGE_VAL != pinf) + abort (); + + if (-HUGE_VAL != ninf) + abort (); +#endif + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/hugeval.x b/gcc/testsuite/gcc.c-torture/execute/ieee/hugeval.x new file mode 100644 index 000000000..ee4ac4feb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/hugeval.x @@ -0,0 +1,23 @@ +# This test fails under hpux 9.X and 10.X because HUGE_VAL is DBL_MAX +# instead of +Infinity. + +global target_triplet +if { [istarget "hppa*-*-hpux9*"] || [istarget "hppa*-*-hpux10*"] } { + set torture_execute_xfail "$target_triplet" +} + +# VxWorks kernel mode has the same problem. +if {[istarget "*-*-vxworks*"]} { + set torture_eval_before_execute { + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data { + "The kernel HUGE_VAL is defined to DBL_MAX instead of +Inf." + { "*-*-*" } + {} + { "-mrtp" } + } + } +} + +return 0 + diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp b/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp new file mode 100644 index 000000000..25009e47c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp @@ -0,0 +1,79 @@ +# +# Expect driver script for GCC Regression Tests +# Copyright (C) 1993, 1996, 2001, 2005, 2007, 2008, 2010 Free Software Foundation +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . +# +# Written by Jeffrey Wheat (cassidy@cygnus.com) +# + +# Load support procs. +load_lib gcc-dg.exp +load_lib torture-options.exp +load_lib c-torture.exp + +# These tests come from Torbjorn Granlund's (tege@cygnus.com) +# C torture test suite, and other contributors. + +# Disable tests on machines with no hardware support for IEEE arithmetic. +if { [istarget "vax-*-*"] || [ istarget "powerpc-*-*spe"] || [istarget "pdp11-*-*"] } { return } + +if $tracelevel then { + strace $tracelevel +} + +torture-init +set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS + +set additional_flags "-fno-inline" + +# We must use -ffloat-store/-mieee to ensure that excess precision on some +# machines does not cause problems +if [istarget "i\[34567\]86-*-*"] then { + lappend additional_flags "-ffloat-store" +} +if { [istarget "x86_64-*-*"] && [check_effective_target_ilp32] } then { + lappend additional_flags "-ffloat-store" +} +if [istarget "m68k-*-*"] then { + lappend additional_flags "-ffloat-store" +} +if { [istarget "alpha*-*-*"] + || [istarget "sh*-*-*"] } then { + lappend additional_flags "-mieee" +} + +# load support procs +load_lib c-torture.exp + +# initialize harness +gcc_init + +# +# main test loop +# + +foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] { + # If we're only testing specific files and this isn't one of them, skip it. + if ![runtest_file_p $runtests $src] then { + continue + } + + c-torture-execute $src $additional_flags +} + +# All done. +torture-finish +gcc_finish diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/inf-1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/inf-1.c new file mode 100644 index 000000000..eee8c0130 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/inf-1.c @@ -0,0 +1,44 @@ +extern void abort (void); + +int main() +{ +#ifndef __SPU__ + /* The SPU single-precision floating point format does not support Inf. */ + float fi = __builtin_inff(); +#endif + double di = __builtin_inf(); + long double li = __builtin_infl(); + + float fh = __builtin_huge_valf(); + double dh = __builtin_huge_val(); + long double lh = __builtin_huge_vall(); + +#ifndef __SPU__ + if (fi + fi != fi) + abort (); +#endif + if (di + di != di) + abort (); + if (li + li != li) + abort (); + +#ifndef __SPU__ + if (fi != fh) + abort (); +#endif + if (di != dh) + abort (); + if (li != lh) + abort (); + +#ifndef __SPU__ + if (fi <= 0) + abort (); +#endif + if (di <= 0) + abort (); + if (li <= 0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/inf-2.c b/gcc/testsuite/gcc.c-torture/execute/ieee/inf-2.c new file mode 100644 index 000000000..dafd95835 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/inf-2.c @@ -0,0 +1,83 @@ +extern void abort (void); + +void test(double f, double i) +{ + if (f == __builtin_inf()) + abort (); + if (f == -__builtin_inf()) + abort (); + if (i == -__builtin_inf()) + abort (); + if (i != __builtin_inf()) + abort (); + + if (f >= __builtin_inf()) + abort (); + if (f > __builtin_inf()) + abort (); + if (i > __builtin_inf()) + abort (); + if (f <= -__builtin_inf()) + abort (); + if (f < -__builtin_inf()) + abort (); +} + +void testf(float f, float i) +{ +#ifndef __SPU__ + /* The SPU single-precision floating point format does not support Inf. */ + + if (f == __builtin_inff()) + abort (); + if (f == -__builtin_inff()) + abort (); + if (i == -__builtin_inff()) + abort (); + if (i != __builtin_inff()) + abort (); + + if (f >= __builtin_inff()) + abort (); + if (f > __builtin_inff()) + abort (); + if (i > __builtin_inff()) + abort (); + if (f <= -__builtin_inff()) + abort (); + if (f < -__builtin_inff()) + abort (); +#endif +} + +void testl(long double f, long double i) +{ + if (f == __builtin_infl()) + abort (); + if (f == -__builtin_infl()) + abort (); + if (i == -__builtin_infl()) + abort (); + if (i != __builtin_infl()) + abort (); + + if (f >= __builtin_infl()) + abort (); + if (f > __builtin_infl()) + abort (); + if (i > __builtin_infl()) + abort (); + if (f <= -__builtin_infl()) + abort (); + if (f < -__builtin_infl()) + abort (); +} + +int main() +{ + test (34.0, __builtin_inf()); + testf (34.0f, __builtin_inff()); + testl (34.0l, __builtin_infl()); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/inf-3.c b/gcc/testsuite/gcc.c-torture/execute/ieee/inf-3.c new file mode 100644 index 000000000..f2ee48062 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/inf-3.c @@ -0,0 +1,79 @@ +extern void abort (void); + +void test(double f, double i) +{ + if (f == __builtin_huge_val()) + abort (); + if (f == -__builtin_huge_val()) + abort (); + if (i == -__builtin_huge_val()) + abort (); + if (i != __builtin_huge_val()) + abort (); + + if (f >= __builtin_huge_val()) + abort (); + if (f > __builtin_huge_val()) + abort (); + if (i > __builtin_huge_val()) + abort (); + if (f <= -__builtin_huge_val()) + abort (); + if (f < -__builtin_huge_val()) + abort (); +} + +void testf(float f, float i) +{ + if (f == __builtin_huge_valf()) + abort (); + if (f == -__builtin_huge_valf()) + abort (); + if (i == -__builtin_huge_valf()) + abort (); + if (i != __builtin_huge_valf()) + abort (); + + if (f >= __builtin_huge_valf()) + abort (); + if (f > __builtin_huge_valf()) + abort (); + if (i > __builtin_huge_valf()) + abort (); + if (f <= -__builtin_huge_valf()) + abort (); + if (f < -__builtin_huge_valf()) + abort (); +} + +void testl(long double f, long double i) +{ + if (f == __builtin_huge_vall()) + abort (); + if (f == -__builtin_huge_vall()) + abort (); + if (i == -__builtin_huge_vall()) + abort (); + if (i != __builtin_huge_vall()) + abort (); + + if (f >= __builtin_huge_vall()) + abort (); + if (f > __builtin_huge_vall()) + abort (); + if (i > __builtin_huge_vall()) + abort (); + if (f <= -__builtin_huge_vall()) + abort (); + if (f < -__builtin_huge_vall()) + abort (); +} + +int main() +{ + test (34.0, __builtin_huge_val()); + testf (34.0f, __builtin_huge_valf()); + testl (34.0l, __builtin_huge_vall()); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/minuszero.c b/gcc/testsuite/gcc.c-torture/execute/ieee/minuszero.c new file mode 100644 index 000000000..85715261d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/minuszero.c @@ -0,0 +1,22 @@ +main () +{ + union + { + double d; + unsigned short i[sizeof (double) / sizeof (short)]; + } u; + int a = 0; + int b = -5; + int j; + + u.d = (double) a / b; + + /* Look for the right pattern, but be sloppy since + we don't know the byte order. */ + for (j = 0; j < sizeof (double) / sizeof (short); j++) + { + if (u.i[j] == 0x8000) + exit (0); + } + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.c new file mode 100644 index 000000000..d5f3fb45b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.c @@ -0,0 +1,75 @@ +/* Check that certain subnormal numbers (formerly known as denormalized + numbers) are rounded to within 0.5 ulp. PR other/14354. */ + +/* This test requires that float and unsigned int are the same size and + that the sign-bit of the float is at MSB of the unsigned int. */ + +#if __INT_MAX__ != 2147483647L +int main () { exit (0); } +#else + +union uf +{ + unsigned int u; + float f; +}; + +static float +u2f (unsigned int v) +{ + union uf u; + u.u = v; + return u.f; +} + +static unsigned int +f2u (float v) +{ + union uf u; + u.f = v; + return u.u; +} + +int ok = 1; + +static void +tstmul (unsigned int ux, unsigned int uy, unsigned int ur) +{ + float x = u2f (ux); + float y = u2f (uy); + + if (f2u (x * y) != ur) + /* Set a variable rather than aborting here, to simplify tracing when + several computations are wrong. */ + ok = 0; +} + +/* We don't want to make this const and static, or else we risk inlining + causing the test to fold as constants at compile-time. */ +struct +{ + unsigned int p1, p2, res; +} expected[] = + { + {0xfff, 0x3f800400, 0xfff}, + {0xf, 0x3fc88888, 0x17}, + {0xf, 0x3f844444, 0xf} + }; + +int +main (int argc, char *argv[], char *envp[]) +{ + unsigned int i; + + for (i = 0; i < sizeof (expected) / sizeof (expected[0]); i++) + { + tstmul (expected[i].p1, expected[i].p2, expected[i].res); + tstmul (expected[i].p2, expected[i].p1, expected[i].res); + } + + if (!ok) + abort (); + + exit (0); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.x b/gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.x new file mode 100644 index 000000000..5978c94a8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.x @@ -0,0 +1,16 @@ +if [istarget "mips-sgi-irix6*"] { + # IRIX 6 sets the MIPS IV flush to zero bit by default, so this test + # isn't expected to work for n32 and n64 on MIPS IV targets. + return 1 +} +if {[istarget "m68k-*-*"] && [check_effective_target_coldfire_fpu]} { + # ColdFire FPUs require software handling of subnormals. We are + # not aware of any system that has this. + set torture_execute_xfail "m68k-*-*" +} +if [istarget "spu-*-*"] { + # The SPU single-precision floating point format does not + # support subnormals. + return 1 +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/mzero2.c b/gcc/testsuite/gcc.c-torture/execute/ieee/mzero2.c new file mode 100644 index 000000000..0da53d247 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/mzero2.c @@ -0,0 +1,58 @@ +/* Test IEEE +0/-0 rules */ + +static double pzero = +0.0; +static double nzero = -0.0; +static double pinf = +1.0 / 0.0; +static double ninf = -1.0 / 0.0; +static double nan = 0.0 / 0.0; + +void +expect (double value, double expected) +{ + if (expected != expected) /* expected value is Not a number */ + { + if (value == value) /* actual value is a number */ + abort (); + } + + else if (value != value) + abort (); /* actual value is a NaN */ + + else if (memcmp ((void *)&value, (void *)&expected, sizeof (double)) != 0) + abort (); /* values don't match */ +} + +main () +{ + expect (pzero + pzero, pzero); + expect (pzero + nzero, pzero); + expect (nzero + pzero, pzero); + expect (nzero + nzero, nzero); + + expect (pzero - pzero, pzero); + expect (pzero - nzero, pzero); + expect (nzero - pzero, nzero); + expect (nzero - nzero, pzero); + + expect (pzero * pzero, pzero); + expect (pzero * nzero, nzero); + expect (nzero * pzero, nzero); + expect (nzero * nzero, pzero); + + expect (+1.00 * pzero, pzero); + expect (-1.00 * pzero, nzero); + expect (+1.00 * nzero, nzero); + expect (-1.00 * nzero, pzero); + + expect (pzero / pzero, nan); + expect (pzero / nzero, nan); + expect (nzero / pzero, nan); + expect (nzero / nzero, nan); + + expect (+1.00 / pzero, pinf); + expect (-1.00 / pzero, ninf); + expect (+1.00 / nzero, ninf); + expect (-1.00 / nzero, pinf); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/mzero2.x b/gcc/testsuite/gcc.c-torture/execute/ieee/mzero2.x new file mode 100644 index 000000000..0b3ec4c00 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/mzero2.x @@ -0,0 +1,6 @@ +# freebsd sets up the fpu with a different precision control which causes +# this test to "fail". +if { [istarget "i?86-*-freebsd*\[123\]\.*"] } { + set torture_execute_xfail "i?86-*-freebsd*" +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/mzero3.c b/gcc/testsuite/gcc.c-torture/execute/ieee/mzero3.c new file mode 100644 index 000000000..fdfb8a118 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/mzero3.c @@ -0,0 +1,51 @@ +/* Copyright (C) 2002 Free Software Foundation. + by Hans-Peter Nilsson , derived from mzero2.c + + In the MMIX port, negdf2 was bogusly expanding -x into 0 - x. */ + +double nzerod = -0.0; +float nzerof = -0.0; +double zerod = 0.0; +float zerof = 0.0; + +void expectd (double, double); +void expectf (float, float); +double negd (double); +float negf (float); + +main () +{ + expectd (negd (zerod), nzerod); + expectf (negf (zerof), nzerof); + expectd (negd (nzerod), zerod); + expectf (negf (nzerof), zerof); + exit (0); +} + +void +expectd (double value, double expected) +{ + if (value != expected + || memcmp ((void *)&value, (void *) &expected, sizeof (double)) != 0) + abort (); +} + +void +expectf (float value, float expected) +{ + if (value != expected + || memcmp ((void *)&value, (void *) &expected, sizeof (float)) != 0) + abort (); +} + +double +negd (double v) +{ + return -v; +} + +float +negf (float v) +{ + return -v; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/mzero4.c b/gcc/testsuite/gcc.c-torture/execute/ieee/mzero4.c new file mode 100644 index 000000000..0ede7ec95 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/mzero4.c @@ -0,0 +1,58 @@ +/* Copyright (C) 2003 Free Software Foundation. + by Roger Sayle , derived from mzero3.c + + Constant folding of sin(-0.0), tan(-0.0) and atan(-0.0) should + all return -0.0, for both double and float forms. */ + +void abort (void); +typedef __SIZE_TYPE__ size_t; +extern int memcmp (const void *, const void *, size_t); + +double sin (double); +double tan (double); +double atan (double); + +float sinf (float); +float tanf (float); +float atanf (float); + +void expectd (double, double); +void expectf (float, float); + +void +expectd (double value, double expected) +{ + if (value != expected + || memcmp ((void *)&value, (void *) &expected, sizeof (double)) != 0) + abort (); +} + +void +expectf (float value, float expected) +{ + if (value != expected + || memcmp ((void *)&value, (void *) &expected, sizeof (float)) != 0) + abort (); +} + +int main () +{ + expectd (sin (0.0), 0.0); + expectd (tan (0.0), 0.0); + expectd (atan (0.0), 0.0); + + expectd (sin (-0.0), -0.0); + expectd (tan (-0.0), -0.0); + expectd (atan (-0.0), -0.0); + + expectf (sinf (0.0f), 0.0f); + expectf (tanf (0.0f), 0.0f); + expectf (atanf (0.0f), 0.0f); + + expectf (sinf (-0.0f), -0.0f); + expectf (tanf (-0.0f), -0.0f); + expectf (atanf (-0.0f), -0.0f); + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/mzero5.c b/gcc/testsuite/gcc.c-torture/execute/ieee/mzero5.c new file mode 100644 index 000000000..3804c08a8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/mzero5.c @@ -0,0 +1,29 @@ +/* Test gcse handling of IEEE 0/-0 rules. */ +static double zero = 0.0; + +int +negzero_check (double d) +{ + if (d == 0) + return !!memcmp ((void *)&zero, (void *)&d, sizeof (double)); + return 0; +} + +int +sub (double d, double e) +{ + if (d == 0.0 && e == 0.0 + && negzero_check (d) == 0 && negzero_check (e) == 0) + return 1; + else + return 0; +} + +int +main (void) +{ + double minus_zero = -0.0; + if (sub (minus_zero, 0)) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/mzero6.c b/gcc/testsuite/gcc.c-torture/execute/ieee/mzero6.c new file mode 100644 index 000000000..59ba6fee1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/mzero6.c @@ -0,0 +1,24 @@ +/* Tail call optimizations would convert func() into the moral equivalent of: + + double acc = 0.0; + for (int i = 0; i <= n; i++) + acc += d; + return acc; + + which mishandles the case where 'd' is -0. They also initialised 'acc' + to a zero int rather than a zero double. */ + +double func (double d, int n) +{ + if (n == 0) + return d; + else + return d + func (d, n - 1); +} + +int main () +{ + if (__builtin_copysign (1.0, func (0.0 / -5.0, 10)) != -1.0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/pr28634.c b/gcc/testsuite/gcc.c-torture/execute/ieee/pr28634.c new file mode 100644 index 000000000..a0c525497 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/pr28634.c @@ -0,0 +1,15 @@ +/* PR rtl-optimization/28634. On targets with delayed branches, + dbr_schedule could do the next iteration's addition in the + branch delay slot, then subtract the value again if the branch + wasn't taken. This can lead to rounding errors. */ +double x = -0x1.0p53; +double y = 1; +int +main (void) +{ + while (y > 0) + y += x; + if (y != x + 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/pr29302-1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/pr29302-1.c new file mode 100644 index 000000000..f6f3dd2cd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/pr29302-1.c @@ -0,0 +1,16 @@ +extern void abort (void); + +int main (void) +{ + int n; + long double x; + + x = 1/0.0; + + n = (x == 1/0.0); + + if (n == 1) + return 0; + else + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/pr30704.c b/gcc/testsuite/gcc.c-torture/execute/ieee/pr30704.c new file mode 100644 index 000000000..2b63e67a0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/pr30704.c @@ -0,0 +1,55 @@ +/* PR middle-end/30704 */ + +typedef __SIZE_TYPE__ size_t; +extern void abort (void); +extern int memcmp (const void *, const void *, size_t); +extern void *memcpy (void *, const void *, size_t); + +long long +f1 (void) +{ + long long t; + double d = 0x0.fffffffffffff000p-1022; + memcpy (&t, &d, sizeof (long long)); + return t; +} + +double +f2 (void) +{ + long long t = 0x000fedcba9876543LL; + double d; + memcpy (&d, &t, sizeof (long long)); + return d; +} + +int +main () +{ + union + { + long long ll; + double d; + } u; + + if (sizeof (long long) != sizeof (double) || __DBL_MIN_EXP__ != -1021) + return 0; + + u.ll = f1 (); + if (u.d != 0x0.fffffffffffff000p-1022) + abort (); + + u.d = f2 (); + if (u.ll != 0x000fedcba9876543LL) + abort (); + + double b = 234.0; + long long c; + double d = b; + memcpy (&c, &b, sizeof (double)); + long long e = c; + if (memcmp (&e, &d, sizeof (double)) != 0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/pr30704.x b/gcc/testsuite/gcc.c-torture/execute/ieee/pr30704.x new file mode 100644 index 000000000..1e111fc2c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/pr30704.x @@ -0,0 +1,5 @@ +if [istarget "avr-*-*"] { + # AVR doubles are floats + return 1 +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/pr36332.c b/gcc/testsuite/gcc.c-torture/execute/ieee/pr36332.c new file mode 100644 index 000000000..325ac88b8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/pr36332.c @@ -0,0 +1,15 @@ +/* PR target/36332 */ + +int +foo (long double ld) +{ + return ld == __builtin_infl (); +} + +int +main () +{ + if (foo (__LDBL_MAX__)) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/pr38016.c b/gcc/testsuite/gcc.c-torture/execute/ieee/pr38016.c new file mode 100644 index 000000000..1fc083488 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/pr38016.c @@ -0,0 +1 @@ +#include "fp-cmp-8.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/pr38016.x b/gcc/testsuite/gcc.c-torture/execute/ieee/pr38016.x new file mode 100644 index 000000000..b70c87439 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/pr38016.x @@ -0,0 +1,2 @@ +lappend additional_flags "-fno-ivopts" "-fno-gcse" +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/pr50310.c b/gcc/testsuite/gcc.c-torture/execute/ieee/pr50310.c new file mode 100644 index 000000000..8d323ca78 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/pr50310.c @@ -0,0 +1,73 @@ +/* PR target/50310 */ + +extern void abort (void); +double s1[4], s2[4], s3[64]; + +void +foo (void) +{ + int i; + for (i = 0; i < 4; i++) + s3[0 * 4 + i] = __builtin_isgreater (s1[i], s2[i]) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) + s3[1 * 4 + i] = (!__builtin_isgreater (s1[i], s2[i])) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) + s3[2 * 4 + i] = __builtin_isgreaterequal (s1[i], s2[i]) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) + s3[3 * 4 + i] = (!__builtin_isgreaterequal (s1[i], s2[i])) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) + s3[4 * 4 + i] = __builtin_isless (s1[i], s2[i]) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) + s3[5 * 4 + i] = (!__builtin_isless (s1[i], s2[i])) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) + s3[6 * 4 + i] = __builtin_islessequal (s1[i], s2[i]) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) + s3[7 * 4 + i] = (!__builtin_islessequal (s1[i], s2[i])) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) + s3[8 * 4 + i] = __builtin_islessgreater (s1[i], s2[i]) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) + s3[9 * 4 + i] = (!__builtin_islessgreater (s1[i], s2[i])) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) + s3[10 * 4 + i] = __builtin_isunordered (s1[i], s2[i]) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) + s3[11 * 4 + i] = (!__builtin_isunordered (s1[i], s2[i])) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) + s3[12 * 4 + i] = s1[i] > s2[i] ? -1.0 : 0.0; + for (i = 0; i < 4; i++) + s3[13 * 4 + i] = s1[i] <= s2[i] ? -1.0 : 0.0; + for (i = 0; i < 4; i++) + s3[14 * 4 + i] = s1[i] < s2[i] ? -1.0 : 0.0; + for (i = 0; i < 4; i++) + s3[15 * 4 + i] = s1[i] >= s2[i] ? -1.0 : 0.0; +} + +int +main () +{ + int i; + s1[0] = 5.0; + s1[1] = 6.0; + s1[2] = 5.0; + s1[3] = __builtin_nan (""); + s2[0] = 6.0; + s2[1] = 5.0; + s2[2] = 5.0; + s2[3] = 5.0; + asm volatile ("" : : : "memory"); + foo (); + asm volatile ("" : : : "memory"); + for (i = 0; i < 16 * 4; i++) + if (i >= 12 * 4 && (i & 3) == 3) + { + if (s3[i] != 0.0) abort (); + } + else + { + static int masks[] = { 2, 2|4, 1, 1|4, 1|2, 8, 2, 1 }; + if (s3[i] + != (((1 << (i & 3)) & ((i & 4) ? ~masks[i / 8] : masks[i / 8])) + ? -1.0 : 0.0)) + abort (); + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/rbug.c b/gcc/testsuite/gcc.c-torture/execute/ieee/rbug.c new file mode 100644 index 000000000..1586bd7d4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/rbug.c @@ -0,0 +1,55 @@ +#if defined(__i386__) && defined(__FreeBSD__) +#include +#endif + +double d (unsigned long long k) +{ + double x; + + x = (double) k; + return x; +} + +float s (unsigned long long k) +{ + float x; + + x = (float) k; + return x; +} + +main () +{ + unsigned long long int k; + double x; + +#if defined(__i386__) && defined(__FreeBSD__) + /* This test case assumes extended-precision, but FreeBSD defaults to + double-precision. Make it so. */ + fpsetprec (FP_PE); +#endif + + if (sizeof (double) >= 8) + { + k = 0x8693ba6d7d220401ULL; + x = d (k); + k = (unsigned long long) x; + if (k != 0x8693ba6d7d220800ULL) + abort (); + } + + k = 0x8234508000000001ULL; + x = s (k); + k = (unsigned long long) x; +#ifdef __SPU__ + /* SPU float rounds towards zero. */ + if (k != 0x8234500000000000ULL) + abort (); +#else + if (k != 0x8234510000000000ULL) + abort (); +#endif + + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/rbug.x b/gcc/testsuite/gcc.c-torture/execute/ieee/rbug.x new file mode 100644 index 000000000..2664174e0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/rbug.x @@ -0,0 +1,10 @@ +# This doesn't work on d10v if doubles are not 64 bits + +if { [istarget "d10v-*-*"] && ! [string-match "*-mdouble64*" $CFLAGS] } { + set torture_execute_xfail "d10v-*-*" +} +if [istarget "avr-*-*"] { + # AVR doubles are floats + return 1 +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/unsafe-fp-assoc-1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/unsafe-fp-assoc-1.c new file mode 100644 index 000000000..7021b99ad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/unsafe-fp-assoc-1.c @@ -0,0 +1,39 @@ +extern void abort(); + +typedef union { + struct { + unsigned int hi; + unsigned int lo; + } i; + double d; +} hexdouble; + +static const double twoTo52 = 0x1.0p+52; + +void func ( double x ) +{ + hexdouble argument; + register double y, z; + unsigned int xHead; + argument.d = x; + xHead = argument.i.hi & 0x7fffffff; + if (__builtin_expect(!!(xHead < 0x43300000u), 1)) + { + y = ( x - twoTo52 ) + twoTo52; + if ( y != x ) + abort(); + z = x - 0.5; + y = ( z - twoTo52 ) + twoTo52; + if ( y == (( x - twoTo52 ) + twoTo52) ) + abort(); + } + return; +} + +int main() +{ + if (sizeof (double) == 4) + return 0; + func((double)1.00); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/unsafe-fp-assoc-1.x b/gcc/testsuite/gcc.c-torture/execute/ieee/unsafe-fp-assoc-1.x new file mode 100644 index 000000000..1e111fc2c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/unsafe-fp-assoc-1.x @@ -0,0 +1,5 @@ +if [istarget "avr-*-*"] { + # AVR doubles are floats + return 1 +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/unsafe-fp-assoc.c b/gcc/testsuite/gcc.c-torture/execute/ieee/unsafe-fp-assoc.c new file mode 100644 index 000000000..d67fef023 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/unsafe-fp-assoc.c @@ -0,0 +1,19 @@ +#include + +extern void abort(void); + +static const double C = DBL_MAX; + +double foo(double x) +{ + return ( ( (x * C) * C ) * C); +} + +int main () +{ + double d = foo (0.0); + if (d != 0.0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ifcvt-onecmpl-abs-1.c b/gcc/testsuite/gcc.c-torture/execute/ifcvt-onecmpl-abs-1.c new file mode 100644 index 000000000..679e552f8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ifcvt-onecmpl-abs-1.c @@ -0,0 +1,19 @@ + +extern void abort(void); + +__attribute__ ((noinline)) +int foo(int n) +{ + if (n < 0) + n = ~n; + + return n; +} + +int main(void) +{ + if (foo (-1) != 0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/index-1.c b/gcc/testsuite/gcc.c-torture/execute/index-1.c new file mode 100644 index 000000000..b00090d83 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/index-1.c @@ -0,0 +1,20 @@ +int a[] = +{ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39 +}; + +int +f (long n) +{ + return a[n - 100000]; +} + +main () +{ + if (f (100030L) != 30) + abort(); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/inst-check.c b/gcc/testsuite/gcc.c-torture/execute/inst-check.c new file mode 100644 index 000000000..ff4b00d78 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/inst-check.c @@ -0,0 +1,14 @@ +#include + +f(m) +{ + int i,s=0; + for(i=0;i + +gt (a, b) +{ + return a > b; +} + +ge (a, b) +{ + return a >= b; +} + +lt (a, b) +{ + return a < b; +} + +le (a, b) +{ + return a <= b; +} + +void +true (c) +{ + if (!c) + abort(); +} + +void +false (c) +{ + if (c) + abort(); +} + +f () +{ + true (gt (2, 1)); + false (gt (1, 2)); + + true (gt (INT_MAX, 0)); + false (gt (0, INT_MAX)); + true (gt (INT_MAX, 1)); + false (gt (1, INT_MAX)); + + false (gt (INT_MIN, 0)); + true (gt (0, INT_MIN)); + false (gt (INT_MIN, 1)); + true (gt (1, INT_MIN)); + + true (gt (INT_MAX, INT_MIN)); + false (gt (INT_MIN, INT_MAX)); + + true (ge (2, 1)); + false (ge (1, 2)); + + true (ge (INT_MAX, 0)); + false (ge (0, INT_MAX)); + true (ge (INT_MAX, 1)); + false (ge (1, INT_MAX)); + + false (ge (INT_MIN, 0)); + true (ge (0, INT_MIN)); + false (ge (INT_MIN, 1)); + true (ge (1, INT_MIN)); + + true (ge (INT_MAX, INT_MIN)); + false (ge (INT_MIN, INT_MAX)); + + false (lt (2, 1)); + true (lt (1, 2)); + + false (lt (INT_MAX, 0)); + true (lt (0, INT_MAX)); + false (lt (INT_MAX, 1)); + true (lt (1, INT_MAX)); + + true (lt (INT_MIN, 0)); + false (lt (0, INT_MIN)); + true (lt (INT_MIN, 1)); + false (lt (1, INT_MIN)); + + false (lt (INT_MAX, INT_MIN)); + true (lt (INT_MIN, INT_MAX)); + + false (le (2, 1)); + true (le (1, 2)); + + false (le (INT_MAX, 0)); + true (le (0, INT_MAX)); + false (le (INT_MAX, 1)); + true (le (1, INT_MAX)); + + true (le (INT_MIN, 0)); + false (le (0, INT_MIN)); + true (le (INT_MIN, 1)); + false (le (1, INT_MIN)); + + false (le (INT_MAX, INT_MIN)); + true (le (INT_MIN, INT_MAX)); +} + +main () +{ + f (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ipa-sra-1.c b/gcc/testsuite/gcc.c-torture/execute/ipa-sra-1.c new file mode 100644 index 000000000..777ed2a83 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ipa-sra-1.c @@ -0,0 +1,29 @@ +/* Trivially making sure IPA-SRA does not introduce segfaults where they should + not be. */ + +struct bovid +{ + float red; + int green; + void *blue; +}; + +static int +__attribute__((noinline)) +ox (int fail, struct bovid *cow) +{ + int r; + if (fail) + r = cow->red; + else + r = 0; + return r; +} + +int main (int argc, char *argv[]) +{ + int r; + + r = ox ((argc > 2000), (void *) 0); + return r; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ipa-sra-2.c b/gcc/testsuite/gcc.c-torture/execute/ipa-sra-2.c new file mode 100644 index 000000000..515d41624 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ipa-sra-2.c @@ -0,0 +1,40 @@ +struct big +{ + int data[1000000]; +}; + +struct small +{ + int data[10]; +}; + +union both +{ + struct big big; + struct small small; +}; + +extern void *calloc (__SIZE_TYPE__, __SIZE_TYPE__); +extern void free (void *); + +static int __attribute__((noinline)) +foo (int fail, union both *agg) +{ + int r; + if (fail) + r = agg->big.data[999999]; + else + r = agg->small.data[0]; + return r; +} + +int main (int argc, char *argv[]) +{ + union both *agg = calloc (1, sizeof (struct small)); + int r; + + r = foo ((argc > 2000), agg); + + free (agg); + return r; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ipa-sra-2.x b/gcc/testsuite/gcc.c-torture/execute/ipa-sra-2.x new file mode 100644 index 000000000..c65423ef6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ipa-sra-2.x @@ -0,0 +1,3 @@ +load_lib target-supports.exp + +return [expr [check_effective_target_int16 ]] diff --git a/gcc/testsuite/gcc.c-torture/execute/longlong.c b/gcc/testsuite/gcc.c-torture/execute/longlong.c new file mode 100644 index 000000000..56f1d8eab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/longlong.c @@ -0,0 +1,39 @@ +/* Source: PR 321 modified for test suite by Neil Booth 14 Jan 2001. */ + +typedef unsigned long long uint64; +unsigned long pars; + +uint64 b[32]; +uint64 *r = b; + +void alpha_ep_extbl_i_eq_0() +{ + unsigned int rb, ra, rc; + + rb = (((unsigned long)(pars) >> 27)) & 0x1fUL; + ra = (((unsigned int)(pars) >> 5)) & 0x1fUL; + rc = (((unsigned int)(pars) >> 0)) & 0x1fUL; + { + uint64 temp = ((r[ra] >> ((r[rb] & 0x7) << 3)) & 0x00000000000000FFLL); + if (rc != 31) + r[rc] = temp; + } +} + +int +main(void) +{ + if (sizeof (uint64) == 8) + { + b[17] = 0x0000000000303882ULL; /* rb */ + b[2] = 0x534f4f4c494d000aULL; /* ra & rc */ + + pars = 0x88000042; /* 17, 2, 2 coded */ + alpha_ep_extbl_i_eq_0(); + + if (b[2] != 0x4d) + abort (); + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-1.c b/gcc/testsuite/gcc.c-torture/execute/loop-1.c new file mode 100644 index 000000000..81aeeb6b3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-1.c @@ -0,0 +1,18 @@ +main () +{ + int i, j, k[3]; + + j = 0; + for (i=0; i < 3; i++) + { + k[i] = j++; + } + + for (i=2; i >= 0; i--) + { + if (k[i] != i) + abort (); + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-10.c b/gcc/testsuite/gcc.c-torture/execute/loop-10.c new file mode 100644 index 000000000..1a6afba6b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-10.c @@ -0,0 +1,31 @@ +/* Reduced from PR optimization/5076, PR optimization/2847 */ + +static int count = 0; + +static void +inc (void) +{ + count++; +} + +int +main (void) +{ + int iNbr = 1; + int test = 0; + while (test == 0) + { + inc (); + if (iNbr == 0) + break; + else + { + inc (); + iNbr--; + } + test = 1; + } + if (count != 2) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-11.c b/gcc/testsuite/gcc.c-torture/execute/loop-11.c new file mode 100644 index 000000000..ab240cef3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-11.c @@ -0,0 +1,20 @@ +static int a[199]; + +static void +foo () +{ + int i; + for (i = 198; i >= 0; i--) + a[i] = i; +} + +int +main () +{ + int i; + foo (); + for (i = 0; i < 199; i++) + if (a[i] != i) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-12.c b/gcc/testsuite/gcc.c-torture/execute/loop-12.c new file mode 100644 index 000000000..1e340990c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-12.c @@ -0,0 +1,25 @@ +/* Checks that pure functions are not treated as const. */ + +char *p; + +static int __attribute__ ((pure)) +is_end_of_statement (void) +{ + return *p == '\n' || *p == ';' || *p == '!'; +} + +void foo (void) +{ + /* The is_end_of_statement call was moved out of the loop at one stage, + resulting in an endless loop. */ + while (!is_end_of_statement ()) + p++; +} + +int +main (void) +{ + p = "abc\n"; + foo (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-13.c b/gcc/testsuite/gcc.c-torture/execute/loop-13.c new file mode 100644 index 000000000..d56c8293d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-13.c @@ -0,0 +1,36 @@ +/* PR opt/7130 */ +#define TYPE long + +void +scale (TYPE *alpha, TYPE *x, int n) +{ + int i, ix; + + if (*alpha != 1) + for (i = 0, ix = 0; i < n; i++, ix += 2) + { + TYPE tmpr, tmpi; + tmpr = *alpha * x[ix]; + tmpi = *alpha * x[ix + 1]; + x[ix] = tmpr; + x[ix + 1] = tmpi; + } +} + +int +main (void) +{ + int i; + TYPE x[10]; + TYPE alpha = 2; + + for (i = 0; i < 10; i++) + x[i] = i; + + scale (&alpha, x, 5); + + if (x[9] != 18) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-14.c b/gcc/testsuite/gcc.c-torture/execute/loop-14.c new file mode 100644 index 000000000..8c9929276 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-14.c @@ -0,0 +1,20 @@ +int a3[3]; + +void f(int *a) +{ + int i; + + for (i=3; --i;) + a[i] = 42 / i; +} + +int +main () +{ + f(a3); + + if (a3[1] != 42 || a3[2] != 21) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-15.c b/gcc/testsuite/gcc.c-torture/execute/loop-15.c new file mode 100644 index 000000000..8cb5125a2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-15.c @@ -0,0 +1,40 @@ +/* Bombed with a segfault on powerpc-linux. doloop.c generated wrong + loop count. */ +void +foo (unsigned long *start, unsigned long *end) +{ + unsigned long *temp = end - 1; + + while (end > start) + *end-- = *temp--; +} + +int +main (void) +{ + unsigned long a[5]; + int start, end, k; + + for (start = 0; start < 5; start++) + for (end = 0; end < 5; end++) + { + for (k = 0; k < 5; k++) + a[k] = k; + + foo (a + start, a + end); + + for (k = 0; k <= start; k++) + if (a[k] != k) + abort (); + + for (k = start + 1; k <= end; k++) + if (a[k] != k - 1) + abort (); + + for (k = end + 1; k < 5; k++) + if (a[k] != k) + abort (); + } + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-2.c b/gcc/testsuite/gcc.c-torture/execute/loop-2.c new file mode 100644 index 000000000..3227734fb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-2.c @@ -0,0 +1,17 @@ +int a[2]; + +f (b) +{ + unsigned int i; + for (i = 0; i < b; i++) + a[i] = i - 2; +} + +main () +{ + a[0] = a[1] = 0; + f (2); + if (a[0] != -2 || a[1] != -1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-2b.c b/gcc/testsuite/gcc.c-torture/execute/loop-2b.c new file mode 100644 index 000000000..7f67bcd63 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-2b.c @@ -0,0 +1,22 @@ +#include + +int a[2]; + +f (int i) +{ + for (; i < INT_MAX; i++) + { + a[i] = -2; + if (&a[i] == &a[1]) + break; + } +} + +main () +{ + a[0] = a[1] = 0; + f (0); + if (a[0] != -2 || a[1] != -2) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-2c.c b/gcc/testsuite/gcc.c-torture/execute/loop-2c.c new file mode 100644 index 000000000..9facf3bfd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-2c.c @@ -0,0 +1,23 @@ +int a[2]; + +__inline__ f (b, o) +{ + unsigned int i; + int *p; + for (p = &a[b], i = b; --i < ~0; ) + *--p = i * 3 + o; +} + +g(int b) +{ + f (b, (int)a); +} + +main () +{ + a[0] = a[1] = 0; + g (2); + if (a[0] != (int)a || a[1] != (int)a + 3) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-2d.c b/gcc/testsuite/gcc.c-torture/execute/loop-2d.c new file mode 100644 index 000000000..19272bf01 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-2d.c @@ -0,0 +1,18 @@ +int a[2]; + +f (b) +{ + unsigned int i; + int *p; + for (p = &a[b], i = b; --i < ~0; ) + *--p = i * 3 + (int)a; +} + +main () +{ + a[0] = a[1] = 0; + f (2); + if (a[0] != (int)a || a[1] != (int)a + 3) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-2e.c b/gcc/testsuite/gcc.c-torture/execute/loop-2e.c new file mode 100644 index 000000000..71c7a4d1d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-2e.c @@ -0,0 +1,39 @@ +void f (int *p, int **q) +{ + int i; + for (i = 0; i < 40; i++) + { + *q++ = &p[i]; + } +} + +int main () +{ + void *p; + int *q[40]; + __SIZE_TYPE__ start; + + /* Find the signed middle of the address space. */ + if (sizeof(start) == sizeof(int)) + start = (__SIZE_TYPE__) __INT_MAX__; + else if (sizeof(start) == sizeof(long)) + start = (__SIZE_TYPE__) __LONG_MAX__; + else if (sizeof(start) == sizeof(long long)) + start = (__SIZE_TYPE__) __LONG_LONG_MAX__; + else + return 0; + + /* Arbitrarily align the pointer. */ + start &= -32; + + /* Pretend that's good enough to start address arithmetic. */ + p = (void *)start; + + /* Verify that GIV replacement computes the correct results. */ + q[39] = 0; + f (p, q); + if (q[39] != (int *)p + 39) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-2f.c b/gcc/testsuite/gcc.c-torture/execute/loop-2f.c new file mode 100644 index 000000000..9f544b9fc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-2f.c @@ -0,0 +1,63 @@ +#include + +#ifdef __unix__ /* ??? Is that good enough? */ +#include +#include +#include +#include +#ifndef MAP_ANON +#ifdef MAP_ANONYMOUS +#define MAP_ANON MAP_ANONYMOUS +#else +#define MAP_ANON MAP_FILE +#endif +#endif +#ifndef MAP_FILE +#define MAP_FILE 0 +#endif +#ifndef MAP_FIXED +#define MAP_FIXED 0 +#endif +#endif + +#define MAP_START (void *)0x7fff8000 +#define MAP_LEN 0x10000 + +#define OFFSET (MAP_LEN/2 - 2 * sizeof (char)); + +f (int s, char *p) +{ + int i; + for (i = s; i >= 0 && &p[i] < &p[40]; i++) + { + p[i] = -2; + } +} + +main () +{ +#ifdef MAP_ANON + char *p; + int dev_zero; + + dev_zero = open ("/dev/zero", O_RDONLY); + /* -1 is OK when we have MAP_ANON; else mmap will flag an error. */ + if (INT_MAX != 0x7fffffffL || sizeof (char *) != sizeof (int)) + exit (0); + p = mmap (MAP_START, MAP_LEN, PROT_READ|PROT_WRITE, + MAP_ANON|MAP_FIXED|MAP_PRIVATE, dev_zero, 0); + if (p != (char *)-1) + { + p += OFFSET; + p[39] = 0; + f (0, p); + if (p[39] != (char)-2) + abort (); + p[39] = 0; + f (-1, p); + if (p[39] != 0) + abort (); + } +#endif + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-2f.x b/gcc/testsuite/gcc.c-torture/execute/loop-2f.x new file mode 100644 index 000000000..334ef9cfe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-2f.x @@ -0,0 +1,5 @@ +if [istarget "m68k-*-linux*"] { + # the executable is at the same position the test tries to remap + return 1 +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-2g.c b/gcc/testsuite/gcc.c-torture/execute/loop-2g.c new file mode 100644 index 000000000..8792dbf58 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-2g.c @@ -0,0 +1,63 @@ +#include + +#ifdef __unix__ /* ??? Is that good enough? */ +#include +#include +#include +#include +#ifndef MAP_ANON +#ifdef MAP_ANONYMOUS +#define MAP_ANON MAP_ANONYMOUS +#else +#define MAP_ANON MAP_FILE +#endif +#endif +#ifndef MAP_FILE +#define MAP_FILE 0 +#endif +#ifndef MAP_FIXED +#define MAP_FIXED 0 +#endif +#endif + +#define MAP_START (void *)0x7fff8000 +#define MAP_LEN 0x10000 + +#define OFFSET (MAP_LEN/2 - 2 * sizeof (char)); + +f (int s, char *p) +{ + int i; + for (i = s; &p[i] < &p[40] && i >= 0; i++) + { + p[i] = -2; + } +} + +main () +{ +#ifdef MAP_ANON + char *p; + int dev_zero; + + dev_zero = open ("/dev/zero", O_RDONLY); + /* -1 is OK when we have MAP_ANON; else mmap will flag an error. */ + if (INT_MAX != 0x7fffffffL || sizeof (char *) != sizeof (int)) + exit (0); + p = mmap (MAP_START, MAP_LEN, PROT_READ|PROT_WRITE, + MAP_ANON|MAP_FIXED|MAP_PRIVATE, dev_zero, 0); + if (p != (char *)-1) + { + p += OFFSET; + p[39] = 0; + f (0, p); + if (p[39] != (char)-2) + abort (); + p[39] = 0; + f (-1, p); + if (p[39] != 0) + abort (); + } +#endif + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-2g.x b/gcc/testsuite/gcc.c-torture/execute/loop-2g.x new file mode 100644 index 000000000..334ef9cfe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-2g.x @@ -0,0 +1,5 @@ +if [istarget "m68k-*-linux*"] { + # the executable is at the same position the test tries to remap + return 1 +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-3.c b/gcc/testsuite/gcc.c-torture/execute/loop-3.c new file mode 100644 index 000000000..e314a01b1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-3.c @@ -0,0 +1,27 @@ +#include + +int n = 0; + +g (i) +{ + n++; +} + +f (m) +{ + int i; + i = m; + do + { + g (i * INT_MAX / 2); + } + while (--i > 0); +} + +main () +{ + f (4); + if (n != 4) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-3b.c b/gcc/testsuite/gcc.c-torture/execute/loop-3b.c new file mode 100644 index 000000000..3de322cf1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-3b.c @@ -0,0 +1,28 @@ +#include + +int n = 0; + +g (i) +{ + n++; +} + +f (m) +{ + int i; + i = m; + do + { + g (i * 4); + i -= INT_MAX / 8; + } + while (i > 0); +} + +main () +{ + f (INT_MAX/8*4); + if (n != 4) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-3c.c b/gcc/testsuite/gcc.c-torture/execute/loop-3c.c new file mode 100644 index 000000000..bc74c2e6d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-3c.c @@ -0,0 +1,31 @@ +#include + +void * a[255]; + +f (m) +{ + int i; + int sh = 0x100; + i = m; + do + { + a[sh >>= 1] = ((unsigned)i << 3) + (char*)a; + i += 4; + } + while (i < INT_MAX/2 + 1 + 4 * 4); +} + +main () +{ + a[0x10] = 0; + a[0x08] = 0; + f (INT_MAX/2 + INT_MAX/4 + 2); + if (a[0x10] || a[0x08]) + abort (); + a[0x10] = 0; + a[0x08] = 0; + f (INT_MAX/2 + 1); + if (! a[0x10] || a[0x08]) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-4.c b/gcc/testsuite/gcc.c-torture/execute/loop-4.c new file mode 100644 index 000000000..b308aa276 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-4.c @@ -0,0 +1,16 @@ +int +f() +{ + int j = 1; + long i; + for (i = -0x70000000L; i < 0x60000000L; i += 0x10000000L) j <<= 1; + return j; +} + +int +main () +{ + if (f () != 8192) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-4b.c b/gcc/testsuite/gcc.c-torture/execute/loop-4b.c new file mode 100644 index 000000000..eaf7f30c4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-4b.c @@ -0,0 +1,21 @@ +int +f() +{ + int j = 1; + long i; + i = 0x60000000L; + do + { + j <<= 1; + i += 0x10000000L; + } while (i < -0x60000000L); + return j; +} + +int +main () +{ + if (f () != 2) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-5.c b/gcc/testsuite/gcc.c-torture/execute/loop-5.c new file mode 100644 index 000000000..44ece275b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-5.c @@ -0,0 +1,36 @@ +static int ap(int i); +static void testit(void){ + int ir[4] = {0,1,2,3}; + int ix,n,m; + n=1; m=3; + for (ix=1;ix<=4;ix++) { + if (n == 1) m = 4; + else m = n-1; + ap(ir[n-1]); + n = m; + } +} + +static int t = 0; +static int a[4]; + +static int ap(int i){ + if (t > 3) + abort(); + a[t++] = i; + return 1; +} + +int main(void) +{ + testit(); + if (a[0] != 0) + abort(); + if (a[1] != 3) + abort(); + if (a[2] != 2) + abort(); + if (a[3] != 1) + abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-6.c b/gcc/testsuite/gcc.c-torture/execute/loop-6.c new file mode 100644 index 000000000..42eb9e7d5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-6.c @@ -0,0 +1,15 @@ +main() +{ + char c; + char d; + int nbits; + c = -1; + for (nbits = 1 ; nbits < 100; nbits++) { + d = (1 << nbits) - 1; + if (d == c) + break; + } + if (nbits == 100) + abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-7.c b/gcc/testsuite/gcc.c-torture/execute/loop-7.c new file mode 100644 index 000000000..48a2599b2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-7.c @@ -0,0 +1,19 @@ +void foo (unsigned int n) +{ + int i, j = -1; + + for (i = 0; i < 10 && j < 0; i++) + { + if ((1UL << i) == n) + j = i; + } + + if (j < 0) + abort (); +} + +main() +{ + foo (64); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-8.c b/gcc/testsuite/gcc.c-torture/execute/loop-8.c new file mode 100644 index 000000000..e8d8cb5f0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-8.c @@ -0,0 +1,23 @@ +double a[3] = { 0.0, 1.0, 2.0 }; + +void bar (int x, double *y) +{ + if (x || *y != 1.0) + abort (); +} + +int main () +{ + double c; + int d; + for (d = 0; d < 3; d++) + { + c = a[d]; + if (c > 0.0) goto e; + } + bar(1, &c); + exit (1); +e: + bar(0, &c); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-9.c b/gcc/testsuite/gcc.c-torture/execute/loop-9.c new file mode 100644 index 000000000..523057593 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-9.c @@ -0,0 +1,21 @@ +/* Source: Neil Booth, from PR # 115. */ + +int false() +{ + return 0; +} + +extern void abort (void); + +int main (int argc,char *argv[]) +{ + int count = 0; + + while (false() || count < -123) + ++count; + + if (count) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-ivopts-1.c b/gcc/testsuite/gcc.c-torture/execute/loop-ivopts-1.c new file mode 100644 index 000000000..13396fbf0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-ivopts-1.c @@ -0,0 +1,30 @@ +/* From PR 18977. */ +void foo(float * x); + +int main() +{ + float x[4]; + foo (x); + return 0; +} + +void foo (float *x) +{ + int i,j,k; + float temp; + static float t16[16]={1.,2.,3.,4.,5.,6.,7.,8.,9., + 10.,11.,12.,13.,14.,15.,16.}; + static float tmp[4]={0.,0.,0.,0.}; + + for (i=0; i<4; i++) { + k = 3 - i; + temp = t16[5*k]; + for(j=k+1; j<4; j++) { + tmp[k] = t16[k+ j*4] * temp; + } + } + x[0] = tmp[0]; + x[1] = tmp[1]; + x[2] = tmp[2]; + x[3] = tmp[3]; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-ivopts-2.c b/gcc/testsuite/gcc.c-torture/execute/loop-ivopts-2.c new file mode 100644 index 000000000..737640bff --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/loop-ivopts-2.c @@ -0,0 +1,50 @@ +/* PR rtl-optimization/20290 */ + +/* We used to mis-optimize the second loop in main on at least ppc and + arm, because tree loop would change the loop to something like: + + ivtmp.65 = &l[i]; + ivtmp.16 = 113; + goto (); + +:; + *(ivtmp.65 + 4294967292B) = 9; + i = i + 1; + +:; + ivtmp.16 = ivtmp.16 - 1; + ivtmp.65 = ivtmp.65 + 4B; + if (ivtmp.16 != 0) goto ; + + We used to consider the increment of i as executed in every + iteration, so we'd miscompute the final value. */ + +extern void abort (void); + +void +check (unsigned int *l) +{ + int i; + for (i = 0; i < 288; i++) + if (l[i] != 7 + (i < 256 || i >= 280) + (i >= 144 && i < 256)) + abort (); +} + +int +main (void) +{ + int i; + unsigned int l[288]; + + for (i = 0; i < 144; i++) + l[i] = 8; + for (; i < 256; i++) + l[i] = 9; + for (; i < 280; i++) + l[i] = 7; + for (; i < 288; i++) + l[i] = 8; + check (l); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/lshrdi-1.c b/gcc/testsuite/gcc.c-torture/execute/lshrdi-1.c new file mode 100644 index 000000000..df53f8bd8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/lshrdi-1.c @@ -0,0 +1,221 @@ +#include + +extern void abort(void); +extern void exit(int); + +#if __LONG_LONG_MAX__ == 9223372036854775807LL +#define BITS 64 + +static unsigned long long const zext[64] = { + 0x87654321fedcba90ULL, + 0x43b2a190ff6e5d48ULL, + 0x21d950c87fb72ea4ULL, + 0x10eca8643fdb9752ULL, + 0x87654321fedcba9ULL, + 0x43b2a190ff6e5d4ULL, + 0x21d950c87fb72eaULL, + 0x10eca8643fdb975ULL, + 0x87654321fedcbaULL, + 0x43b2a190ff6e5dULL, + 0x21d950c87fb72eULL, + 0x10eca8643fdb97ULL, + 0x87654321fedcbULL, + 0x43b2a190ff6e5ULL, + 0x21d950c87fb72ULL, + 0x10eca8643fdb9ULL, + 0x87654321fedcULL, + 0x43b2a190ff6eULL, + 0x21d950c87fb7ULL, + 0x10eca8643fdbULL, + 0x87654321fedULL, + 0x43b2a190ff6ULL, + 0x21d950c87fbULL, + 0x10eca8643fdULL, + 0x87654321feULL, + 0x43b2a190ffULL, + 0x21d950c87fULL, + 0x10eca8643fULL, + 0x87654321fULL, + 0x43b2a190fULL, + 0x21d950c87ULL, + 0x10eca8643ULL, + 0x87654321ULL, + 0x43b2a190ULL, + 0x21d950c8ULL, + 0x10eca864ULL, + 0x8765432ULL, + 0x43b2a19ULL, + 0x21d950cULL, + 0x10eca86ULL, + 0x876543ULL, + 0x43b2a1ULL, + 0x21d950ULL, + 0x10eca8ULL, + 0x87654ULL, + 0x43b2aULL, + 0x21d95ULL, + 0x10ecaULL, + 0x8765ULL, + 0x43b2ULL, + 0x21d9ULL, + 0x10ecULL, + 0x876ULL, + 0x43bULL, + 0x21dULL, + 0x10eULL, + 0x87ULL, + 0x43ULL, + 0x21ULL, + 0x10ULL, + 0x8ULL, + 0x4ULL, + 0x2ULL, + 0x1ULL +}; + +#elif __LONG_LONG_MAX__ == 2147483647LL +#define BITS 32 + +static unsigned long long const zext[32] = { + 0x87654321ULL, + 0x43b2a190ULL, + 0x21d950c8ULL, + 0x10eca864ULL, + 0x8765432ULL, + 0x43b2a19ULL, + 0x21d950cULL, + 0x10eca86ULL, + 0x876543ULL, + 0x43b2a1ULL, + 0x21d950ULL, + 0x10eca8ULL, + 0x87654ULL, + 0x43b2aULL, + 0x21d95ULL, + 0x10ecaULL, + 0x8765ULL, + 0x43b2ULL, + 0x21d9ULL, + 0x10ecULL, + 0x876ULL, + 0x43bULL, + 0x21dULL, + 0x10eULL, + 0x87ULL, + 0x43ULL, + 0x21ULL, + 0x10ULL, + 0x8ULL, + 0x4ULL, + 0x2ULL, + 0x1ULL, +}; + +#else +#error "Update the test case." +#endif + +static unsigned long long +variable_shift(unsigned long long x, int i) +{ + return x >> i; +} + +static unsigned long long +constant_shift(unsigned long long x, int i) +{ + switch (i) + { + case 0: x = x >> 0; break; + case 1: x = x >> 1; break; + case 2: x = x >> 2; break; + case 3: x = x >> 3; break; + case 4: x = x >> 4; break; + case 5: x = x >> 5; break; + case 6: x = x >> 6; break; + case 7: x = x >> 7; break; + case 8: x = x >> 8; break; + case 9: x = x >> 9; break; + case 10: x = x >> 10; break; + case 11: x = x >> 11; break; + case 12: x = x >> 12; break; + case 13: x = x >> 13; break; + case 14: x = x >> 14; break; + case 15: x = x >> 15; break; + case 16: x = x >> 16; break; + case 17: x = x >> 17; break; + case 18: x = x >> 18; break; + case 19: x = x >> 19; break; + case 20: x = x >> 20; break; + case 21: x = x >> 21; break; + case 22: x = x >> 22; break; + case 23: x = x >> 23; break; + case 24: x = x >> 24; break; + case 25: x = x >> 25; break; + case 26: x = x >> 26; break; + case 27: x = x >> 27; break; + case 28: x = x >> 28; break; + case 29: x = x >> 29; break; + case 30: x = x >> 30; break; + case 31: x = x >> 31; break; +#if BITS > 32 + case 32: x = x >> 32; break; + case 33: x = x >> 33; break; + case 34: x = x >> 34; break; + case 35: x = x >> 35; break; + case 36: x = x >> 36; break; + case 37: x = x >> 37; break; + case 38: x = x >> 38; break; + case 39: x = x >> 39; break; + case 40: x = x >> 40; break; + case 41: x = x >> 41; break; + case 42: x = x >> 42; break; + case 43: x = x >> 43; break; + case 44: x = x >> 44; break; + case 45: x = x >> 45; break; + case 46: x = x >> 46; break; + case 47: x = x >> 47; break; + case 48: x = x >> 48; break; + case 49: x = x >> 49; break; + case 50: x = x >> 50; break; + case 51: x = x >> 51; break; + case 52: x = x >> 52; break; + case 53: x = x >> 53; break; + case 54: x = x >> 54; break; + case 55: x = x >> 55; break; + case 56: x = x >> 56; break; + case 57: x = x >> 57; break; + case 58: x = x >> 58; break; + case 59: x = x >> 59; break; + case 60: x = x >> 60; break; + case 61: x = x >> 61; break; + case 62: x = x >> 62; break; + case 63: x = x >> 63; break; +#endif + + default: + abort (); + } + return x; +} + +int +main() +{ + int i; + + for (i = 0; i < BITS; ++i) + { + unsigned long long y = variable_shift (zext[0], i); + if (y != zext[i]) + abort (); + } + for (i = 0; i < BITS; ++i) + { + unsigned long long y = constant_shift (zext[0], i); + if (y != zext[i]) + abort (); + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/mayalias-1.c b/gcc/testsuite/gcc.c-torture/execute/mayalias-1.c new file mode 100644 index 000000000..ba461cae1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/mayalias-1.c @@ -0,0 +1,21 @@ +/* Tests that the may_alias attribute works as expected. + Author: Osku Salerma Apr 2002. */ + +extern void abort(void); +extern void exit(int); + +typedef short __attribute__((__may_alias__)) short_a; + +int +main (void) +{ + int a = 0x12345678; + short_a *b = (short_a*) &a; + + b[1] = 0; + + if (a == 0x12345678) + abort(); + + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/mayalias-2.c b/gcc/testsuite/gcc.c-torture/execute/mayalias-2.c new file mode 100644 index 000000000..39c010d91 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/mayalias-2.c @@ -0,0 +1,16 @@ +typedef struct __attribute__((__may_alias__)) { short x; } test; + +int f() { + int a=10; + test *p=(test *)&a; + p->x = 1; + return a; +} + +int main() { + if (f() == 10) + __builtin_abort(); + return 0; +} + + diff --git a/gcc/testsuite/gcc.c-torture/execute/mayalias-3.c b/gcc/testsuite/gcc.c-torture/execute/mayalias-3.c new file mode 100644 index 000000000..53bd07ab1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/mayalias-3.c @@ -0,0 +1,26 @@ +typedef struct __attribute__((__may_alias__)) { short x; } test; + +test *p; + +int g(int *a) +{ + p = (test*)a; +} + +int f() +{ + int a; + g(&a); + a = 10; + test s={1}; + *p=s; + return a; +} + +int main() { + if (f() == 10) + __builtin_abort(); + return 0; +} + + diff --git a/gcc/testsuite/gcc.c-torture/execute/medce-1.c b/gcc/testsuite/gcc.c-torture/execute/medce-1.c new file mode 100644 index 000000000..0c0a77274 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/medce-1.c @@ -0,0 +1,33 @@ + +extern void abort (void); +extern void link_error (void); + +static int ok = 0; + +void bar (void) +{ + ok = 1; +} + +void foo(int x) +{ + switch (x) + { + case 0: + if (0) + { + link_error(); + case 1: + bar(); + } + } +} + +int main() +{ + foo (1); + if (!ok) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/memcpy-1.c b/gcc/testsuite/gcc.c-torture/execute/memcpy-1.c new file mode 100644 index 000000000..684854b66 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/memcpy-1.c @@ -0,0 +1,63 @@ +#include + +#if defined (STACK_SIZE) +#define MEMCPY_SIZE (STACK_SIZE / 3) +#else +#define MEMCPY_SIZE (1 << 17) +#endif + + +void *copy (void *o, const void *i, unsigned l) +{ + return memcpy (o, i, l); +} + +main () +{ + unsigned i; + unsigned char src[MEMCPY_SIZE]; + unsigned char dst[MEMCPY_SIZE]; + + for (i = 0; i < MEMCPY_SIZE; i++) + src[i] = (unsigned char) i, dst[i] = 0; + + (void) memcpy (dst, src, MEMCPY_SIZE / 128); + + for (i = 0; i < MEMCPY_SIZE / 128; i++) + if (dst[i] != (unsigned char) i) + abort (); + + (void) memset (dst, 1, MEMCPY_SIZE / 128); + + for (i = 0; i < MEMCPY_SIZE / 128; i++) + if (dst[i] != 1) + abort (); + + (void) memcpy (dst, src, MEMCPY_SIZE); + + for (i = 0; i < MEMCPY_SIZE; i++) + if (dst[i] != (unsigned char) i) + abort (); + + (void) memset (dst, 0, MEMCPY_SIZE); + + for (i = 0; i < MEMCPY_SIZE; i++) + if (dst[i] != 0) + abort (); + + (void) copy (dst, src, MEMCPY_SIZE / 128); + + for (i = 0; i < MEMCPY_SIZE / 128; i++) + if (dst[i] != (unsigned char) i) + abort (); + + (void) memset (dst, 0, MEMCPY_SIZE); + + (void) copy (dst, src, MEMCPY_SIZE); + + for (i = 0; i < MEMCPY_SIZE; i++) + if (dst[i] != (unsigned char) i) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/memcpy-2.c b/gcc/testsuite/gcc.c-torture/execute/memcpy-2.c new file mode 100644 index 000000000..f328b6477 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/memcpy-2.c @@ -0,0 +1,75 @@ +/* Copyright (C) 2002 Free Software Foundation. + + Test memcpy with various combinations of pointer alignments and lengths to + make sure any optimizations in the library are correct. + + Written by Michael Meissner, March 9, 2002. */ + +#include + +#ifndef MAX_OFFSET +#define MAX_OFFSET (sizeof (long long)) +#endif + +#ifndef MAX_COPY +#define MAX_COPY (10 * sizeof (long long)) +#endif + +#ifndef MAX_EXTRA +#define MAX_EXTRA (sizeof (long long)) +#endif + +#define MAX_LENGTH (MAX_OFFSET + MAX_COPY + MAX_EXTRA) + + +/* Use a sequence length that is not divisible by two, to make it more + likely to detect when words are mixed up. */ +#define SEQUENCE_LENGTH 31 + +static union { + char buf[MAX_LENGTH]; + long long align_int; + long double align_fp; +} u1, u2; + +main () +{ + int off1, off2, len, i; + char *p, *q, c; + + for (off1 = 0; off1 < MAX_OFFSET; off1++) + for (off2 = 0; off2 < MAX_OFFSET; off2++) + for (len = 1; len < MAX_COPY; len++) + { + for (i = 0, c = 'A'; i < MAX_LENGTH; i++, c++) + { + u1.buf[i] = 'a'; + if (c >= 'A' + SEQUENCE_LENGTH) + c = 'A'; + u2.buf[i] = c; + } + + p = memcpy (u1.buf + off1, u2.buf + off2, len); + if (p != u1.buf + off1) + abort (); + + q = u1.buf; + for (i = 0; i < off1; i++, q++) + if (*q != 'a') + abort (); + + for (i = 0, c = 'A' + off2; i < len; i++, q++, c++) + { + if (c >= 'A' + SEQUENCE_LENGTH) + c = 'A'; + if (*q != c) + abort (); + } + + for (i = 0; i < MAX_EXTRA; i++, q++) + if (*q != 'a') + abort (); + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/memcpy-bi.c b/gcc/testsuite/gcc.c-torture/execute/memcpy-bi.c new file mode 100644 index 000000000..40b103080 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/memcpy-bi.c @@ -0,0 +1,53 @@ +/* Test builtin-memcpy (which may emit different code for different N). */ +#include + +#define TESTSIZE 80 + +char src[TESTSIZE] __attribute__ ((aligned)); +char dst[TESTSIZE] __attribute__ ((aligned)); + +void +check (char *test, char *match, int n) +{ + if (memcmp (test, match, n)) + abort (); +} + +#define TN(n) \ +{ memset (dst, 0, n); memcpy (dst, src, n); check (dst, src, n); } +#define T(n) \ +TN (n) \ +TN ((n) + 1) \ +TN ((n) + 2) \ +TN ((n) + 3) + +main () +{ + int i,j; + + for (i = 0; i < sizeof (src); ++i) + src[i] = 'a' + i % 26; + + T (0); + T (4); + T (8); + T (12); + T (16); + T (20); + T (24); + T (28); + T (32); + T (36); + T (40); + T (44); + T (48); + T (52); + T (56); + T (60); + T (64); + T (68); + T (72); + T (76); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/memset-1.c b/gcc/testsuite/gcc.c-torture/execute/memset-1.c new file mode 100644 index 000000000..b0b70f3e6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/memset-1.c @@ -0,0 +1,96 @@ +/* Copyright (C) 2002 Free Software Foundation. + + Test memset with various combinations of pointer alignments and lengths to + make sure any optimizations in the library are correct. + + Written by Michael Meissner, March 9, 2002. */ + +#include + +#ifndef MAX_OFFSET +#define MAX_OFFSET (sizeof (long long)) +#endif + +#ifndef MAX_COPY +#define MAX_COPY (10 * sizeof (long long)) +#endif + +#ifndef MAX_EXTRA +#define MAX_EXTRA (sizeof (long long)) +#endif + +#define MAX_LENGTH (MAX_OFFSET + MAX_COPY + MAX_EXTRA) + +static union { + char buf[MAX_LENGTH]; + long long align_int; + long double align_fp; +} u; + +char A = 'A'; + +main () +{ + int off, len, i; + char *p, *q; + + for (off = 0; off < MAX_OFFSET; off++) + for (len = 1; len < MAX_COPY; len++) + { + for (i = 0; i < MAX_LENGTH; i++) + u.buf[i] = 'a'; + + p = memset (u.buf + off, '\0', len); + if (p != u.buf + off) + abort (); + + q = u.buf; + for (i = 0; i < off; i++, q++) + if (*q != 'a') + abort (); + + for (i = 0; i < len; i++, q++) + if (*q != '\0') + abort (); + + for (i = 0; i < MAX_EXTRA; i++, q++) + if (*q != 'a') + abort (); + + p = memset (u.buf + off, A, len); + if (p != u.buf + off) + abort (); + + q = u.buf; + for (i = 0; i < off; i++, q++) + if (*q != 'a') + abort (); + + for (i = 0; i < len; i++, q++) + if (*q != 'A') + abort (); + + for (i = 0; i < MAX_EXTRA; i++, q++) + if (*q != 'a') + abort (); + + p = memset (u.buf + off, 'B', len); + if (p != u.buf + off) + abort (); + + q = u.buf; + for (i = 0; i < off; i++, q++) + if (*q != 'a') + abort (); + + for (i = 0; i < len; i++, q++) + if (*q != 'B') + abort (); + + for (i = 0; i < MAX_EXTRA; i++, q++) + if (*q != 'a') + abort (); + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/memset-2.c b/gcc/testsuite/gcc.c-torture/execute/memset-2.c new file mode 100644 index 000000000..07c3db378 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/memset-2.c @@ -0,0 +1,334 @@ +/* Copyright (C) 2002 Free Software Foundation. + + Test memset with various combinations of pointer alignments and constant + lengths to make sure any optimizations in the compiler are correct. + + Written by Roger Sayle, April 22, 2002. */ + +#ifndef MAX_OFFSET +#define MAX_OFFSET (sizeof (long long)) +#endif + +#ifndef MAX_COPY +#define MAX_COPY 15 +#endif + +#ifndef MAX_EXTRA +#define MAX_EXTRA (sizeof (long long)) +#endif + +#define MAX_LENGTH (MAX_OFFSET + MAX_COPY + MAX_EXTRA) + +static union { + char buf[MAX_LENGTH]; + long long align_int; + long double align_fp; +} u; + +char A = 'A'; + +void reset () +{ + int i; + + for (i = 0; i < MAX_LENGTH; i++) + u.buf[i] = 'a'; +} + +void check (int off, int len, int ch) +{ + char *q; + int i; + + q = u.buf; + for (i = 0; i < off; i++, q++) + if (*q != 'a') + abort (); + + for (i = 0; i < len; i++, q++) + if (*q != ch) + abort (); + + for (i = 0; i < MAX_EXTRA; i++, q++) + if (*q != 'a') + abort (); +} + +int main () +{ + int off; + char *p; + + /* len == 1 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u.buf + off, '\0', 1); + if (p != u.buf + off) abort (); + check (off, 1, '\0'); + + p = memset (u.buf + off, A, 1); + if (p != u.buf + off) abort (); + check (off, 1, 'A'); + + p = memset (u.buf + off, 'B', 1); + if (p != u.buf + off) abort (); + check (off, 1, 'B'); + } + + /* len == 2 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u.buf + off, '\0', 2); + if (p != u.buf + off) abort (); + check (off, 2, '\0'); + + p = memset (u.buf + off, A, 2); + if (p != u.buf + off) abort (); + check (off, 2, 'A'); + + p = memset (u.buf + off, 'B', 2); + if (p != u.buf + off) abort (); + check (off, 2, 'B'); + } + + /* len == 3 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u.buf + off, '\0', 3); + if (p != u.buf + off) abort (); + check (off, 3, '\0'); + + p = memset (u.buf + off, A, 3); + if (p != u.buf + off) abort (); + check (off, 3, 'A'); + + p = memset (u.buf + off, 'B', 3); + if (p != u.buf + off) abort (); + check (off, 3, 'B'); + } + + /* len == 4 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u.buf + off, '\0', 4); + if (p != u.buf + off) abort (); + check (off, 4, '\0'); + + p = memset (u.buf + off, A, 4); + if (p != u.buf + off) abort (); + check (off, 4, 'A'); + + p = memset (u.buf + off, 'B', 4); + if (p != u.buf + off) abort (); + check (off, 4, 'B'); + } + + /* len == 5 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u.buf + off, '\0', 5); + if (p != u.buf + off) abort (); + check (off, 5, '\0'); + + p = memset (u.buf + off, A, 5); + if (p != u.buf + off) abort (); + check (off, 5, 'A'); + + p = memset (u.buf + off, 'B', 5); + if (p != u.buf + off) abort (); + check (off, 5, 'B'); + } + + /* len == 6 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u.buf + off, '\0', 6); + if (p != u.buf + off) abort (); + check (off, 6, '\0'); + + p = memset (u.buf + off, A, 6); + if (p != u.buf + off) abort (); + check (off, 6, 'A'); + + p = memset (u.buf + off, 'B', 6); + if (p != u.buf + off) abort (); + check (off, 6, 'B'); + } + + /* len == 7 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u.buf + off, '\0', 7); + if (p != u.buf + off) abort (); + check (off, 7, '\0'); + + p = memset (u.buf + off, A, 7); + if (p != u.buf + off) abort (); + check (off, 7, 'A'); + + p = memset (u.buf + off, 'B', 7); + if (p != u.buf + off) abort (); + check (off, 7, 'B'); + } + + /* len == 8 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u.buf + off, '\0', 8); + if (p != u.buf + off) abort (); + check (off, 8, '\0'); + + p = memset (u.buf + off, A, 8); + if (p != u.buf + off) abort (); + check (off, 8, 'A'); + + p = memset (u.buf + off, 'B', 8); + if (p != u.buf + off) abort (); + check (off, 8, 'B'); + } + + /* len == 9 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u.buf + off, '\0', 9); + if (p != u.buf + off) abort (); + check (off, 9, '\0'); + + p = memset (u.buf + off, A, 9); + if (p != u.buf + off) abort (); + check (off, 9, 'A'); + + p = memset (u.buf + off, 'B', 9); + if (p != u.buf + off) abort (); + check (off, 9, 'B'); + } + + /* len == 10 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u.buf + off, '\0', 10); + if (p != u.buf + off) abort (); + check (off, 10, '\0'); + + p = memset (u.buf + off, A, 10); + if (p != u.buf + off) abort (); + check (off, 10, 'A'); + + p = memset (u.buf + off, 'B', 10); + if (p != u.buf + off) abort (); + check (off, 10, 'B'); + } + + /* len == 11 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u.buf + off, '\0', 11); + if (p != u.buf + off) abort (); + check (off, 11, '\0'); + + p = memset (u.buf + off, A, 11); + if (p != u.buf + off) abort (); + check (off, 11, 'A'); + + p = memset (u.buf + off, 'B', 11); + if (p != u.buf + off) abort (); + check (off, 11, 'B'); + } + + /* len == 12 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u.buf + off, '\0', 12); + if (p != u.buf + off) abort (); + check (off, 12, '\0'); + + p = memset (u.buf + off, A, 12); + if (p != u.buf + off) abort (); + check (off, 12, 'A'); + + p = memset (u.buf + off, 'B', 12); + if (p != u.buf + off) abort (); + check (off, 12, 'B'); + } + + /* len == 13 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u.buf + off, '\0', 13); + if (p != u.buf + off) abort (); + check (off, 13, '\0'); + + p = memset (u.buf + off, A, 13); + if (p != u.buf + off) abort (); + check (off, 13, 'A'); + + p = memset (u.buf + off, 'B', 13); + if (p != u.buf + off) abort (); + check (off, 13, 'B'); + } + + /* len == 14 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u.buf + off, '\0', 14); + if (p != u.buf + off) abort (); + check (off, 14, '\0'); + + p = memset (u.buf + off, A, 14); + if (p != u.buf + off) abort (); + check (off, 14, 'A'); + + p = memset (u.buf + off, 'B', 14); + if (p != u.buf + off) abort (); + check (off, 14, 'B'); + } + + /* len == 15 */ + for (off = 0; off < MAX_OFFSET; off++) + { + reset (); + + p = memset (u.buf + off, '\0', 15); + if (p != u.buf + off) abort (); + check (off, 15, '\0'); + + p = memset (u.buf + off, A, 15); + if (p != u.buf + off) abort (); + check (off, 15, 'A'); + + p = memset (u.buf + off, 'B', 15); + if (p != u.buf + off) abort (); + check (off, 15, 'B'); + } + + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/memset-3.c b/gcc/testsuite/gcc.c-torture/execute/memset-3.c new file mode 100644 index 000000000..64032a775 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/memset-3.c @@ -0,0 +1,208 @@ +/* Copyright (C) 2002 Free Software Foundation. + + Test memset with various combinations of constant pointer alignments and + lengths to make sure any optimizations in the compiler are correct. + + Written by Roger Sayle, July 22, 2002. */ + +#ifndef MAX_OFFSET +#define MAX_OFFSET (sizeof (long long)) +#endif + +#ifndef MAX_COPY +#define MAX_COPY 15 +#endif + +#ifndef MAX_EXTRA +#define MAX_EXTRA (sizeof (long long)) +#endif + +#define MAX_LENGTH (MAX_OFFSET + MAX_COPY + MAX_EXTRA) + +static union { + char buf[MAX_LENGTH]; + long long align_int; + long double align_fp; +} u; + +char A = 'A'; + +void reset () +{ + int i; + + for (i = 0; i < MAX_LENGTH; i++) + u.buf[i] = 'a'; +} + +void check (int off, int len, int ch) +{ + char *q; + int i; + + q = u.buf; + for (i = 0; i < off; i++, q++) + if (*q != 'a') + abort (); + + for (i = 0; i < len; i++, q++) + if (*q != ch) + abort (); + + for (i = 0; i < MAX_EXTRA; i++, q++) + if (*q != 'a') + abort (); +} + +int main () +{ + int len; + char *p; + + /* off == 0 */ + for (len = 0; len < MAX_COPY; len++) + { + reset (); + + p = memset (u.buf, '\0', len); + if (p != u.buf) abort (); + check (0, len, '\0'); + + p = memset (u.buf, A, len); + if (p != u.buf) abort (); + check (0, len, 'A'); + + p = memset (u.buf, 'B', len); + if (p != u.buf) abort (); + check (0, len, 'B'); + } + + /* off == 1 */ + for (len = 0; len < MAX_COPY; len++) + { + reset (); + + p = memset (u.buf+1, '\0', len); + if (p != u.buf+1) abort (); + check (1, len, '\0'); + + p = memset (u.buf+1, A, len); + if (p != u.buf+1) abort (); + check (1, len, 'A'); + + p = memset (u.buf+1, 'B', len); + if (p != u.buf+1) abort (); + check (1, len, 'B'); + } + + /* off == 2 */ + for (len = 0; len < MAX_COPY; len++) + { + reset (); + + p = memset (u.buf+2, '\0', len); + if (p != u.buf+2) abort (); + check (2, len, '\0'); + + p = memset (u.buf+2, A, len); + if (p != u.buf+2) abort (); + check (2, len, 'A'); + + p = memset (u.buf+2, 'B', len); + if (p != u.buf+2) abort (); + check (2, len, 'B'); + } + + /* off == 3 */ + for (len = 0; len < MAX_COPY; len++) + { + reset (); + + p = memset (u.buf+3, '\0', len); + if (p != u.buf+3) abort (); + check (3, len, '\0'); + + p = memset (u.buf+3, A, len); + if (p != u.buf+3) abort (); + check (3, len, 'A'); + + p = memset (u.buf+3, 'B', len); + if (p != u.buf+3) abort (); + check (3, len, 'B'); + } + + /* off == 4 */ + for (len = 0; len < MAX_COPY; len++) + { + reset (); + + p = memset (u.buf+4, '\0', len); + if (p != u.buf+4) abort (); + check (4, len, '\0'); + + p = memset (u.buf+4, A, len); + if (p != u.buf+4) abort (); + check (4, len, 'A'); + + p = memset (u.buf+4, 'B', len); + if (p != u.buf+4) abort (); + check (4, len, 'B'); + } + + /* off == 5 */ + for (len = 0; len < MAX_COPY; len++) + { + reset (); + + p = memset (u.buf+5, '\0', len); + if (p != u.buf+5) abort (); + check (5, len, '\0'); + + p = memset (u.buf+5, A, len); + if (p != u.buf+5) abort (); + check (5, len, 'A'); + + p = memset (u.buf+5, 'B', len); + if (p != u.buf+5) abort (); + check (5, len, 'B'); + } + + /* off == 6 */ + for (len = 0; len < MAX_COPY; len++) + { + reset (); + + p = memset (u.buf+6, '\0', len); + if (p != u.buf+6) abort (); + check (6, len, '\0'); + + p = memset (u.buf+6, A, len); + if (p != u.buf+6) abort (); + check (6, len, 'A'); + + p = memset (u.buf+6, 'B', len); + if (p != u.buf+6) abort (); + check (6, len, 'B'); + } + + /* off == 7 */ + for (len = 0; len < MAX_COPY; len++) + { + reset (); + + p = memset (u.buf+7, '\0', len); + if (p != u.buf+7) abort (); + check (7, len, '\0'); + + p = memset (u.buf+7, A, len); + if (p != u.buf+7) abort (); + check (7, len, 'A'); + + p = memset (u.buf+7, 'B', len); + if (p != u.buf+7) abort (); + check (7, len, 'B'); + } + + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/mod-1.c b/gcc/testsuite/gcc.c-torture/execute/mod-1.c new file mode 100644 index 000000000..b460df5cd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/mod-1.c @@ -0,0 +1,11 @@ +f (x, y) +{ + if (x % y != 0) + abort (); +} + +main () +{ + f (-5, 5); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/mode-dependent-address.c b/gcc/testsuite/gcc.c-torture/execute/mode-dependent-address.c new file mode 100644 index 000000000..5bf840cf2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/mode-dependent-address.c @@ -0,0 +1,49 @@ +#include +#include +#include + +void f883b (int8_t * result, + int16_t * __restrict arg1, + uint32_t * __restrict arg2, + uint64_t * __restrict arg3, + uint8_t * __restrict arg4) +{ + int idx; + for (idx=0;idx<96;idx += 1) { + result[idx] = (((((((((((-27 + 2+1)>>1) || arg4[idx]) < arg1[idx]) + ? (((-27 + 2+1)>>1) || arg4[idx]) + : arg1[idx]) + >> (arg2[idx] & 31)) ^ 1) - -32)>>7) | -5) & arg3[idx]); + } +} + +int8_t result[96]; +int16_t arg1[96]; +uint32_t arg2[96]; +uint64_t arg3[96]; +uint8_t arg4[96]; + +int main (void) +{ + int i; + int correct[] = {0x0,0x1,0x2,0x3,0x0,0x1,0x2,0x3,0x8,0x9,0xa,0xb,0x8,0x9, + 0xa,0xb,0x10,0x11,0x12,0x13,0x10,0x11,0x12,0x13, + 0x18,0x19,0x1a,0x1b,0x18,0x19,0x1a,0x1b,0x20,0x21,0x22, + 0x23,0x20,0x21,0x22,0x23,0x28,0x29,0x2a, + 0x2b,0x28,0x29,0x2a,0x2b,0x30,0x31,0x32,0x33, + 0x30,0x31,0x32,0x33,0x38,0x39,0x3a,0x3b,0x38,0x39,0x3a, + 0x3b,0x40,0x41,0x42,0x43,0x40,0x41,0x42,0x43,0x48,0x49, + 0x4a,0x4b,0x48,0x49,0x4a,0x4b,0x50,0x51, + 0x52,0x53,0x50,0x51,0x52,0x53,0x58,0x59,0x5a,0x5b, + 0x58,0x59,0x5a,0x5b}; + + for (i=0; i < 96; i++) + arg3[i] = arg2[i] = arg1[i] = arg4[i] = i; + + f883b(result, arg1, arg2, arg3, arg4); + + for (i=0; i < 96; i++) + if (result[i] != correct[i]) abort(); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/mode-dependent-address.x b/gcc/testsuite/gcc.c-torture/execute/mode-dependent-address.x new file mode 100644 index 000000000..6622e71f3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/mode-dependent-address.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { ! [check_effective_target_stdint_types] } { + return 1 +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/multdi-1.c b/gcc/testsuite/gcc.c-torture/execute/multdi-1.c new file mode 100644 index 000000000..1ffcc578e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/multdi-1.c @@ -0,0 +1,20 @@ +/* PR target/9348 */ + +#define u_l_l unsigned long long +#define l_l long long + +l_l mpy_res; + +u_l_l mpy (long a, long b) +{ + return (u_l_l) a * (u_l_l) b; +} + +int main(void) +{ + mpy_res = mpy(1,-1); + if (mpy_res != -1LL) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/multi-ix.c b/gcc/testsuite/gcc.c-torture/execute/multi-ix.c new file mode 100644 index 000000000..377f08c11 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/multi-ix.c @@ -0,0 +1,203 @@ +/* Test for a reload bug: + if you have a memory reference using the indexed addressing + mode, and the base address is a pseudo containing an address in the frame + and this pseudo fails to get a hard register, we end up with a double PLUS, + so the frame address gets reloaded. Now, when the index got a hard register, + and it dies in this insn, push_reload will consider that hard register as + a reload register, and disregrad overlaps with rld[n_reloads].in . That is + fine as long as the add can be done with a single insn, but when the + constant is so large that it has to be reloaded into a register first, + that clobbers the index. */ + +#include + +#ifdef STACK_SIZE +/* We need to be careful that we don't blow our stack. Function f, in the + worst case, needs to fit on the stack: + + * 40 int[CHUNK] arrays; + * ~40 ints; + * ~40 pointers for stdarg passing. + + Subtract the last two off STACK_SIZE and figure out what the maximum + chunk size can be. We make the last bit conservative to account for + register saves and other processor-dependent saving. Limit the + chunk size to some sane values. */ + +#define MIN(X,Y) ((X) < (Y) ? (X) : (Y)) +#define MAX(X,Y) ((X) > (Y) ? (X) : (Y)) + +#define CHUNK \ + MIN (500, (MAX (1, (signed)(STACK_SIZE-40*sizeof(int)-256*sizeof(void *)) \ + / (signed)(40*sizeof(int))))) +#else +#define CHUNK 500 +#endif + +void s(int, ...); +void z(int, ...); +void c(int, ...); + +typedef int l[CHUNK]; + +void +f (int n) +{ + int i; + l a0, a1, a2, a3, a4, a5, a6, a7, a8, a9; + l a10, a11, a12, a13, a14, a15, a16, a17, a18, a19; + l a20, a21, a22, a23, a24, a25, a26, a27, a28, a29; + l a30, a31, a32, a33, a34, a35, a36, a37, a38, a39; + int i0, i1, i2, i3, i4, i5, i6, i7, i8, i9; + int i10, i11, i12, i13, i14, i15, i16, i17, i18, i19; + int i20, i21, i22, i23, i24, i25, i26, i27, i28, i29; + int i30, i31, i32, i33, i34, i35, i36, i37, i38, i39; + + for (i = 0; i < n; i++) + { + s (40, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, + a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, + a30, a31, a32, a33, a34, a35, a36, a37, a38, a39); + i0 = a0[0]; + i1 = a1[0]; + i2 = a2[0]; + i3 = a3[0]; + i4 = a4[0]; + i5 = a5[0]; + i6 = a6[0]; + i7 = a7[0]; + i8 = a8[0]; + i9 = a9[0]; + i10 = a10[0]; + i11 = a11[0]; + i12 = a12[0]; + i13 = a13[0]; + i14 = a14[0]; + i15 = a15[0]; + i16 = a16[0]; + i17 = a17[0]; + i18 = a18[0]; + i19 = a19[0]; + i20 = a20[0]; + i21 = a21[0]; + i22 = a22[0]; + i23 = a23[0]; + i24 = a24[0]; + i25 = a25[0]; + i26 = a26[0]; + i27 = a27[0]; + i28 = a28[0]; + i29 = a29[0]; + i30 = a30[0]; + i31 = a31[0]; + i32 = a32[0]; + i33 = a33[0]; + i34 = a34[0]; + i35 = a35[0]; + i36 = a36[0]; + i37 = a37[0]; + i38 = a38[0]; + i39 = a39[0]; + z (40, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, + a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, + a30, a31, a32, a33, a34, a35, a36, a37, a38, a39); + a0[i0] = i0; + a1[i1] = i1; + a2[i2] = i2; + a3[i3] = i3; + a4[i4] = i4; + a5[i5] = i5; + a6[i6] = i6; + a7[i7] = i7; + a8[i8] = i8; + a9[i9] = i9; + a10[i10] = i10; + a11[i11] = i11; + a12[i12] = i12; + a13[i13] = i13; + a14[i14] = i14; + a15[i15] = i15; + a16[i16] = i16; + a17[i17] = i17; + a18[i18] = i18; + a19[i19] = i19; + a20[i20] = i20; + a21[i21] = i21; + a22[i22] = i22; + a23[i23] = i23; + a24[i24] = i24; + a25[i25] = i25; + a26[i26] = i26; + a27[i27] = i27; + a28[i28] = i28; + a29[i29] = i29; + a30[i30] = i30; + a31[i31] = i31; + a32[i32] = i32; + a33[i33] = i33; + a34[i34] = i34; + a35[i35] = i35; + a36[i36] = i36; + a37[i37] = i37; + a38[i38] = i38; + a39[i39] = i39; + c (40, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, + a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, + a30, a31, a32, a33, a34, a35, a36, a37, a38, a39); + } +} + +int +main () +{ + /* CHUNK needs to be at least 40 to avoid stack corruption, + since index variable i0 in "a[i0] = i0" equals 39. */ + if (CHUNK < 40) + exit (0); + + f (1); + exit (0); +} + +void s(int n, ...) +{ + va_list list; + + va_start (list, n); + while (n--) + { + int *a = va_arg (list, int *); + a[0] = n; + } + va_end (list); +} + +void z(int n, ...) +{ + va_list list; + + va_start (list, n); + while (n--) + { + int *a = va_arg (list, int *); + __builtin_memset (a, 0, sizeof (l)); + } + va_end (list); +} + +void c(int n, ...) +{ + va_list list; + + va_start (list, n); + while (n--) + { + int *a = va_arg (list, int *); + if (a[n] != n) + abort (); + } + va_end (list); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/nest-align-1.c b/gcc/testsuite/gcc.c-torture/execute/nest-align-1.c new file mode 100644 index 000000000..548c8878d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/nest-align-1.c @@ -0,0 +1,40 @@ +/* Test for alignment handling when a variable is accessed by nested + function. */ +/* Origin: Joey Ye */ + +#include + +typedef int aligned __attribute__((aligned)); +extern void abort (void); + +void +check (int *i) +{ + *i = 20; + if ((((ptrdiff_t) i) & (__alignof__(aligned) - 1)) != 0) + abort (); +} + +void +foo (void) +{ + aligned jj; + void bar () + { + jj = -20; + } + jj = 0; + bar (); + if (jj != -20) + abort (); + check (&jj); + if (jj != 20) + abort (); +} + +int +main() +{ + foo (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/nest-stdar-1.c b/gcc/testsuite/gcc.c-torture/execute/nest-stdar-1.c new file mode 100644 index 000000000..492670b5a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/nest-stdar-1.c @@ -0,0 +1,19 @@ +#include + +main () +{ + double f (int x, ...) + { + va_list args; + double a; + + va_start (args, x); + a = va_arg (args, double); + va_end (args); + return a; + } + + if (f (1, (double)1) != 1.0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/nestfunc-1.c b/gcc/testsuite/gcc.c-torture/execute/nestfunc-1.c new file mode 100644 index 000000000..e34a56b3f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/nestfunc-1.c @@ -0,0 +1,28 @@ +int +g (int a, int b, int (*gi) (int, int)) +{ + if ((*gi) (a, b)) + return a; + else + return b; +} + +f () +{ +#ifndef NO_TRAMPOLINES + int i, j; + int f2 (int a, int b) + { + return a > b; + } + + if (g (1, 2, f2) != 2) + abort (); +#endif +} + +main () +{ + f (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/nestfunc-2.c b/gcc/testsuite/gcc.c-torture/execute/nestfunc-2.c new file mode 100644 index 000000000..030875560 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/nestfunc-2.c @@ -0,0 +1,49 @@ +extern int foo (int, int, int (*) (int, int, int, int, int, int, int)); + +int z; + +int +main (void) +{ +#ifndef NO_TRAMPOLINES + int sum = 0; + int i; + + int nested (int a, int b, int c, int d, int e, int f, int g) + { + z = c + d + e + f + g; + + if (a > 2 * b) + return a - b; + else + return b - a; + } + + for (i = 0; i < 10; ++i) + { + int j; + + for (j = 0; j < 10; ++j) + { + int k; + + for (k = 0; k < 10; ++k) + sum += foo (i, j > k ? j - k : k - j, nested); + } + } + + if (sum != 2300) + abort (); + + if (z != 0x1b) + abort (); +#endif + + exit (0); +} + +int +foo (int a, int b, int (* fp) (int, int, int, int, int, int, int)) +{ + return fp (a, b, a, b, a, b, a); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/nestfunc-3.c b/gcc/testsuite/gcc.c-torture/execute/nestfunc-3.c new file mode 100644 index 000000000..9d09b196d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/nestfunc-3.c @@ -0,0 +1,60 @@ + +extern long foo (long, long, long (*) (long, long)); +extern long use (long (*) (long, long), long, long); + +int +main (void) +{ +#ifndef NO_TRAMPOLINES + long sum = 0; + long i; + + long nested_0 (long a, long b) + { + if (a > 2 * b) + return a - b; + else + return b - a; + } + + long nested_1 (long a, long b) + { + return use (nested_0, b, a) + sum; + } + + long nested_2 (long a, long b) + { + return nested_1 (b, a); + } + + for (i = 0; i < 10; ++i) + { + long j; + + for (j = 0; j < 10; ++j) + { + long k; + + for (k = 0; k < 10; ++k) + sum += foo (i, j > k ? j - k : k - j, nested_2); + } + } + + if ((sum & 0xffffffff) != 0xbecfcbf5) + abort (); +#endif + + exit (0); +} + +long +use (long (* func)(long, long), long a, long b) +{ + return func (b, a); +} + +long +foo (long a, long b, long (* func) (long, long)) +{ + return func (a, b); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/nestfunc-4.c b/gcc/testsuite/gcc.c-torture/execute/nestfunc-4.c new file mode 100644 index 000000000..e028166b6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/nestfunc-4.c @@ -0,0 +1,37 @@ +/* Origin: hp@bitrange.com + Test that return values come out right from a 1000-level call chain to + functions without parameters that each need at least one "long" + preserved. Exposed problems related to the MMIX port. */ + +long level = 0; +extern long foo (void); +extern long bar (void); + +#ifdef STACK_SIZE +#define DEPTH ((STACK_SIZE) / 512 + 1) +#else +#define DEPTH 500 +#endif + +int +main (void) +{ + if (foo () == -42) + exit (0); + + abort (); +} + +long +foo (void) +{ + long tmp = ++level; + return bar () + tmp; +} + +long +bar (void) +{ + long tmp = level; + return tmp > DEPTH - 1 ? -42 - tmp : foo () - tmp; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/nestfunc-5.c b/gcc/testsuite/gcc.c-torture/execute/nestfunc-5.c new file mode 100644 index 000000000..88e74cc90 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/nestfunc-5.c @@ -0,0 +1,36 @@ +extern void abort (void); +extern void exit (int); + +#ifndef NO_TRAMPOLINES +static void recursive (int n, void (*proc) (void)) +{ + __label__ l1; + + void do_goto (void) + { + goto l1; + } + + if (n == 3) + recursive (n - 1, do_goto); + else if (n > 0) + recursive (n - 1, proc); + else + (*proc) (); + return; + +l1: + if (n == 3) + exit (0); + else + abort (); +} + +int main () +{ + recursive (10, abort); + abort (); +} +#else +int main () { return 0; } +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/nestfunc-6.c b/gcc/testsuite/gcc.c-torture/execute/nestfunc-6.c new file mode 100644 index 000000000..c8e82435a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/nestfunc-6.c @@ -0,0 +1,29 @@ +/* Test that the GP gets properly restored, either by the nonlocal + receiver or the nested function. */ + +#ifndef NO_TRAMPOLINES + +typedef __SIZE_TYPE__ size_t; +extern void abort (void); +extern void exit (int); +extern void qsort(void *, size_t, size_t, int (*)(const void *, const void *)); + +int main () +{ + __label__ nonlocal; + int compare (const void *a, const void *b) + { + goto nonlocal; + } + + char array[3]; + qsort (array, 3, 1, compare); + abort (); + + nonlocal: + exit (0); +} + +#else +int main() { return 0; } +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/nestfunc-7.c b/gcc/testsuite/gcc.c-torture/execute/nestfunc-7.c new file mode 100644 index 000000000..5b3d34b8d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/nestfunc-7.c @@ -0,0 +1,44 @@ +struct A +{ + int one; + int two; + int three; + int four; + int five; + int six; +}; + +static int test (void) +{ + int base; + + struct A Foo (void) + { + struct A a; + + a.one = base + 1; + a.two = base + 2; + a.three = base + 3; + a.four = base + 4; + a.five = base + 5; + a.six = base + 6; + + return a; + } + + base = 10; + struct A a = Foo (); + + return (a.one == 11 + && a.two == 12 + && a.three == 13 + && a.four == 14 + && a.five == 15 + && a.six == 16); +} + +int main (void) +{ + return !test (); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/p18298.c b/gcc/testsuite/gcc.c-torture/execute/p18298.c new file mode 100644 index 000000000..5aff51f5f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/p18298.c @@ -0,0 +1,18 @@ +#include +#include +int strcmp (const char*, const char*); +char s[2048] = "a"; +inline bool foo(const char *str) { + return !strcmp(s,str); +} +int main() { +int i = 0; + while(!(foo(""))) { + i ++; + s[0] = '\0'; + if (i>2) + abort (); + } + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/packed-1.c b/gcc/testsuite/gcc.c-torture/execute/packed-1.c new file mode 100644 index 000000000..9b226aeab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/packed-1.c @@ -0,0 +1,19 @@ +short x1 = 17; + +struct +{ + short i __attribute__ ((packed)); +} t; + +f () +{ + t.i = x1; + if (t.i != 17) + abort (); +} + +main () +{ + f (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/packed-2.c b/gcc/testsuite/gcc.c-torture/execute/packed-2.c new file mode 100644 index 000000000..6c5790088 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/packed-2.c @@ -0,0 +1,12 @@ +typedef struct s { + unsigned short a; + unsigned long b __attribute__ ((packed)); +} s; + +s t; + +int main() +{ + t.b = 0; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pending-4.c b/gcc/testsuite/gcc.c-torture/execute/pending-4.c new file mode 100644 index 000000000..8000621e6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pending-4.c @@ -0,0 +1,33 @@ + +void dummy (x, y) + int *x; + int y; +{} + +int +main (argc, argv) + int argc; + char **argv; +{ + int number_columns=9; + int cnt0 = 0; + int cnt1 = 0; + int i,A1; + + for (i = number_columns-1; i != 0; i--) + { + if (i == 1) + { + dummy(&A1, i); + cnt0++; + } + else + { + dummy(&A1, i-1); + cnt1++; + } + } + if (cnt0 != 1 || cnt1 != 7) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/postmod-1.c b/gcc/testsuite/gcc.c-torture/execute/postmod-1.c new file mode 100644 index 000000000..b56454f41 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/postmod-1.c @@ -0,0 +1,62 @@ +#define DECLARE_ARRAY(A) array##A[0x10] +#define DECLARE_COUNTER(A) counter##A = 0 +#define DECLARE_POINTER(A) *pointer##A = array##A + x +/* Create a loop that allows post-modification of pointerA, followed by + a use of the post-modified address. */ +#define BEFORE(A) counter##A += *pointer##A, pointer##A += 3 +#define AFTER(A) counter##A += pointer##A[x] + +/* Set up the arrays so that one iteration of the loop sets the counter + to 3.0f. */ +#define INIT_ARRAY(A) array##A[1] = 1.0f, array##A[5] = 2.0f + +/* Check that the loop worked correctly for all values. */ +#define CHECK_ARRAY(A) exit_code |= (counter##A != 3.0f) + +/* Having 6 copies triggered the bug for ARM and Thumb. */ +#define MANY(A) A (0), A (1), A (2), A (3), A (4), A (5) + +/* Each addendA should be allocated a register. */ +#define INIT_VOLATILE(A) addend##A = vol +#define ADD_VOLATILE(A) vol += addend##A + +/* Having 5 copies triggered the bug for ARM and Thumb. */ +#define MANY2(A) A (0), A (1), A (2), A (3), A (4) + +float MANY (DECLARE_ARRAY); +float MANY (DECLARE_COUNTER); + +volatile int stop = 1; +volatile int vol; + +void __attribute__((noinline)) +foo (int x) +{ + float MANY (DECLARE_POINTER); + int i; + + do + { + MANY (BEFORE); + MANY (AFTER); + /* Create an inner loop that should ensure the code above + has registers free for reload inheritance. */ + { + int MANY2 (INIT_VOLATILE); + for (i = 0; i < 10; i++) + MANY2 (ADD_VOLATILE); + } + } + while (!stop); +} + +int +main (void) +{ + int exit_code = 0; + + MANY (INIT_ARRAY); + foo (1); + MANY (CHECK_ARRAY); + return exit_code; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr15262-1.c b/gcc/testsuite/gcc.c-torture/execute/pr15262-1.c new file mode 100644 index 000000000..f6a6fe40b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr15262-1.c @@ -0,0 +1,47 @@ +/* PR 15262. + The alias analyzer only considers relations between pointers and + symbols. If two pointers P and Q point to the same symbol S, then + their respective memory tags will either be the same or they will + have S in their alias set. + + However, if there are no common symbols between P and Q, TBAA will + currently miss their alias relationship altogether. */ +struct A +{ + int t; + int i; +}; + +int foo () { return 3; } + +main () +{ + struct A loc, *locp; + float f, g, *p; + int T355, *T356; + + /* Avoid the partial hack in TBAA that would consider memory tags if + the program had no addressable symbols. */ + f = 3; + g = 2; + p = foo () ? &g : &f; + if (*p > 0.0) + g = 1; + + /* Store into *locp and cache its current value. */ + locp = malloc (sizeof (*locp)); + locp->i = 10; + T355 = locp->i; + + /* Take the address of one of locp's fields and write to it. */ + T356 = &locp->i; + *T356 = 1; + + /* Read the recently stored value. If TBAA fails, this will appear + as a redundant load that will be replaced with '10'. */ + T355 = locp->i; + if (T355 != 1) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr15262-2.c b/gcc/testsuite/gcc.c-torture/execute/pr15262-2.c new file mode 100644 index 000000000..82e8aabd1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr15262-2.c @@ -0,0 +1,37 @@ +/* PR 15262. Similar to pr15262-1.c but with no obvious addresses + being taken in function foo(). Without IPA, by only looking inside + foo() we cannot tell for certain whether 'q' and 'b' alias each + other. */ +struct A +{ + int t; + int i; +}; + +struct B +{ + int *p; + float b; +}; + +float X; + +foo (struct B b, struct A *q, float *h) +{ + X += *h; + *(b.p) = 3; + q->t = 2; + return *(b.p); +} + +main() +{ + struct A a; + struct B b; + + b.p = &a.t; + if (foo (b, &a, &X) == 3) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr15262.c b/gcc/testsuite/gcc.c-torture/execute/pr15262.c new file mode 100644 index 000000000..2110f33a0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr15262.c @@ -0,0 +1,48 @@ +/* We used to mis-compile this testcase as we did not know that + &a+offsetof(b,a) was the same as &a.b */ +struct A +{ + int t; + int i; +}; + +void +bar (float *p) +{ + *p = 5.2; +} + +int +foo(struct A *locp, int i, int str) +{ + float f, g, *p; + int T355; + int *T356; + /* Currently, the alias analyzer has limited support for handling + aliases of structure fields when no other variables are aliased. + Introduce additional aliases to confuse it. */ + p = i ? &g : &f; + bar (p); + if (*p > 0.0) + str = 1; + + T355 = locp->i; + T356 = &locp->i; + *T356 = str; + T355 = locp->i; + + return T355; +} + +main () +{ + struct A loc; + int str; + + loc.i = 2; + str = foo (&loc, 10, 3); + if (str!=1) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr15296.c b/gcc/testsuite/gcc.c-torture/execute/pr15296.c new file mode 100644 index 000000000..d2468e425 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr15296.c @@ -0,0 +1,73 @@ +/* PR optimization/15296. The delayed-branch scheduler caused code that + SEGV:d for CRIS; a register was set to -1 in a delay-slot for the + fall-through code, while that register held a pointer used in code at + the branch target. */ + +typedef int __attribute__ ((mode (__pointer__))) intptr_t; +typedef intptr_t W; +union u0 +{ + union u0 *r; + W i; +}; +struct s1 +{ + union u0 **m0; + union u0 m1[4]; +}; + +void f (void *, struct s1 *, const union u0 *, W, W, W) + __attribute__ ((__noinline__)); +void g (void *, char *) __attribute__ ((__noinline__)); + +void +f (void *a, struct s1 *b, const union u0 *h, W v0, W v1, W v4) +{ + union u0 *e = 0; + union u0 *k = 0; + union u0 **v5 = b->m0; + union u0 *c = b->m1; + union u0 **d = &v5[0]; +l0:; + if (v0 < v1) + goto l0; + if (v0 == 0) + goto l3; + v0 = v4; + if (v0 != 0) + goto l3; + c[0].r = *d; + v1 = -1; + e = c[0].r; + if (e != 0) + g (a, ""); + k = e + 3; + k->i = v1; + goto l4; +l3:; + c[0].i = v0; + e = c[1].r; + if (e != 0) + g (a, ""); + e = c[0].r; + if (e == 0) + g (a, ""); + k = e + 2; + k->r = c[1].r; +l4:; +} + +void g (void *a, char *b) { abort (); } + +int +main () +{ + union u0 uv[] = {{ .i = 111 }, { .i = 222 }, { .i = 333 }, { .i = 444 }}; + struct s1 s = { 0, {{ .i = 555 }, { .i = 0 }, { .i = 999 }, { .i = 777 }}}; + f (0, &s, 0, 20000, 10000, (W) uv); + if (s.m1[0].i != (W) uv || s.m1[1].i != 0 || s.m1[2].i != 999 + || s.m1[3].i != 777 || uv[0].i != 111 || uv[1].i != 222 + || uv[2].i != 0 || uv[3].i != 444) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr16790-1.c b/gcc/testsuite/gcc.c-torture/execute/pr16790-1.c new file mode 100644 index 000000000..dc6a77404 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr16790-1.c @@ -0,0 +1,41 @@ +/* PR middle-end/16790. */ + +extern void abort (); + +static void test1(unsigned int u1) +{ + unsigned int y_final_1; + signed short y_middle; + unsigned int y_final_2; + + y_final_1 = (unsigned int)( (signed short)(u1 * 2) * 3 ); + y_middle = (signed short)(u1 * 2); + y_final_2 = (unsigned int)( y_middle * 3 ); + + if (y_final_1 != y_final_2) + abort (); +} + + +static void test2(unsigned int u1) +{ + unsigned int y_final_1; + signed short y_middle; + unsigned int y_final_2; + + y_final_1 = (unsigned int)( (signed short)(u1 << 1) * 3 ); + y_middle = (signed short)(u1 << 1); + y_final_2 = (unsigned int)( y_middle * 3 ); + + if (y_final_1 != y_final_2) + abort (); +} + + +int main() +{ + test1(0x4000U); + test2(0x4000U); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr17078-1.c b/gcc/testsuite/gcc.c-torture/execute/pr17078-1.c new file mode 100644 index 000000000..9380bf485 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr17078-1.c @@ -0,0 +1,25 @@ +extern void abort(void); + +void test(int *ptr) +{ + int i = 1; + goto useless; + if (0) + { + useless: + i = 0; + } + else + i = 1; + *ptr = i; +} + +int main() +{ + int i = 1; + test(&i); + if (i) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr17133.c b/gcc/testsuite/gcc.c-torture/execute/pr17133.c new file mode 100644 index 000000000..63352c07a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr17133.c @@ -0,0 +1,27 @@ +extern void abort (void); + +int foo = 0; +void *bar = 0; +unsigned int baz = 100; + +void *pure_alloc () +{ + void *res; + + while (1) + { + res = (void *) ((((unsigned int) (foo + bar))) & ~1); + foo += 2; + if (foo < baz) + return res; + foo = 0; + } +} + +int main () +{ + pure_alloc (); + if (!foo) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr17252.c b/gcc/testsuite/gcc.c-torture/execute/pr17252.c new file mode 100644 index 000000000..bd1b6b99e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr17252.c @@ -0,0 +1,21 @@ +/* PR 17252. When a char * pointer P takes its own address, storing + into *P changes P itself. */ + +char *a; + +main () +{ + /* Make 'a' point to itself. */ + a = (char *)&a; + + /* Change what 'a' is pointing to. */ + a[0]++; + + /* If a's memory tag does not contain 'a' in its alias set, we will + think that this predicate is superfluous and change it to + 'if (1)'. */ + if (a == (char *)&a) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr17377.c b/gcc/testsuite/gcc.c-torture/execute/pr17377.c new file mode 100644 index 000000000..87d23c5cc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr17377.c @@ -0,0 +1,59 @@ +/* PR target/17377 + Bug in code emitted by "return" pattern on CRIS: missing pop of + forced return address on stack. */ +int calls = 0; + +void *f (int) __attribute__ ((__noinline__)); +void * +f (int i) +{ + /* The code does a little brittle song and dance to trig the "return" + pattern instead of the function epilogue. This must still be a + leaf function for the bug to be exposed. */ + + if (calls++ == 0) + return __builtin_return_address (0); + + switch (i) + { + case 1: + return f; + case 0: + return __builtin_return_address (0); + } + return 0; +} + +int x; + +void *y (int i) __attribute__ ((__noinline__,__noclone__)); +void * +y (int i) +{ + x = 0; + + /* This must not be a sibling call: the return address must appear + constant for different calls to this function. Postincrementing x + catches otherwise unidentified multiple returns (e.g. through the + return-address register and then this epilogue popping the address + stored on stack in "f"). */ + return (char *) f (i) + x++; +} + +int +main (void) +{ + void *v = y (4); + if (y (1) != f + /* Can't reasonably check the validity of the return address + above, but it's not that important: the test-case will probably + crash on the first call to f with the bug present, or it will + run wild including returning early (in y or here), so we also + try and check the number of calls. */ + || y (0) != v + || y (3) != 0 + || y (-1) != 0 + || calls != 5) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr19005.c b/gcc/testsuite/gcc.c-torture/execute/pr19005.c new file mode 100644 index 000000000..c36b38814 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr19005.c @@ -0,0 +1,38 @@ +/* PR target/19005 */ +extern void abort (void); + +int v, s; + +void +bar (int a, int b) +{ + unsigned char x = v; + + if (!s) + { + if (a != x || b != (unsigned char) (x + 1)) + abort (); + } + else if (a != (unsigned char) (x + 1) || b != x) + abort (); + s ^= 1; +} + +int +foo (int x) +{ + unsigned char a = x, b = x + 1; + + bar (a, b); + a ^= b; b ^= a; a ^= b; + bar (a, b); + return 0; +} + +int +main (void) +{ + for (v = -10; v < 266; v++) + foo (v); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr19515.c b/gcc/testsuite/gcc.c-torture/execute/pr19515.c new file mode 100644 index 000000000..df0e10721 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr19515.c @@ -0,0 +1,17 @@ +/* PR 19515 */ + +typedef union { + char a2[8]; +}aun; + +void abort (void); + +int main(void) +{ + aun a = {{0}}; + + if (a.a2[2] != 0) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr19606.c b/gcc/testsuite/gcc.c-torture/execute/pr19606.c new file mode 100644 index 000000000..d1e836fa0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr19606.c @@ -0,0 +1,34 @@ +/* PR c/19606 + The C front end used to shorten the type of a division to a type + that does not preserve the semantics of the original computation. + Make sure that won't happen. */ + +signed char a = -4; + +int +foo (void) +{ + return ((unsigned int) (signed int) a) / 2LL; +} + +int +bar (void) +{ + return ((unsigned int) (signed int) a) % 5LL; +} + +int +main (void) +{ + int r; + + r = foo (); + if (r != ((unsigned int) (signed int) (signed char) -4) / 2LL) + abort (); + + r = bar (); + if (r != ((unsigned int) (signed int) (signed char) -4) % 5LL) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr19687.c b/gcc/testsuite/gcc.c-torture/execute/pr19687.c new file mode 100644 index 000000000..c300ab48c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr19687.c @@ -0,0 +1,18 @@ +extern void abort (void); + +union U +{ + int i, j[4]; +}; + +int main () +{ + union U t = {}; + int i; + + for (i = 0; i < 4; ++i) + if (t.j[i] != 0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr19689.c b/gcc/testsuite/gcc.c-torture/execute/pr19689.c new file mode 100644 index 000000000..608415f36 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr19689.c @@ -0,0 +1,19 @@ +extern void abort (void); + +struct +{ + int b : 29; +} f; + +void foo (short j) +{ + f.b = j; +} + +int main() +{ + foo (-55); + if (f.b != -55) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr19689.x b/gcc/testsuite/gcc.c-torture/execute/pr19689.x new file mode 100644 index 000000000..121fcfecc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr19689.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_int16] } { + return 1 +} + +return 0; diff --git a/gcc/testsuite/gcc.c-torture/execute/pr20100-1.c b/gcc/testsuite/gcc.c-torture/execute/pr20100-1.c new file mode 100644 index 000000000..8782edcd8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr20100-1.c @@ -0,0 +1,76 @@ +/* PR tree-optimization/20100 + Pure function being treated as const. + Author: Hans-Peter Nilsson. */ + +static unsigned short g = 0; +static unsigned short p = 0; +unsigned char e; + +static unsigned short +next_g (void) +{ + return g == e - 1 ? 0 : g + 1; +} + +static unsigned short +curr_p (void) +{ + return p; +} + +static unsigned short +inc_g (void) +{ + return g = next_g (); +} + +static unsigned short +curr_g (void) +{ + return g; +} + +static char +ring_empty (void) +{ + if (curr_p () == curr_g ()) + return 1; + else + return 0; +} + +char +frob (unsigned short a, unsigned short b) +{ + g = a; + p = b; + inc_g (); + return ring_empty (); +} + +unsigned short +get_n (void) +{ + unsigned short n = 0; + unsigned short org_g; + org_g = curr_g (); + while (!ring_empty () && n < 5) + { + inc_g (); + n++; + } + + return n; +} + +void abort (void); +void exit (int); +int main (void) +{ + e = 3; + if (frob (0, 2) != 0 || g != 1 || p != 2 || e != 3 + || get_n () != 1 + || g != 2 || p != 2) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr20187-1.c b/gcc/testsuite/gcc.c-torture/execute/pr20187-1.c new file mode 100644 index 000000000..a1f0a091c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr20187-1.c @@ -0,0 +1,15 @@ +int a = 0x101; +int b = 0x100; + +int +test (void) +{ + return (((unsigned char) (unsigned long long) ((a ? a : 1) & (a * b))) + ? 0 : 1); +} + +int +main (void) +{ + return 1 - test (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr20466-1.c b/gcc/testsuite/gcc.c-torture/execute/pr20466-1.c new file mode 100644 index 000000000..fb4787f8c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr20466-1.c @@ -0,0 +1,26 @@ +int f (int **, int *, int *, int **, int **) __attribute__ ((__noinline__)); +int +f (int **ipp, int *i1p, int *i2p, int **i3, int **i4) +{ + **ipp = *i1p; + *ipp = i2p; + *i3 = *i4; + **ipp = 99; + return 3; +} + +extern void exit (int); +extern void abort (void); + +int main (void) +{ + int i = 42, i1 = 66, i2 = 1, i3 = -1, i4 = 55; + int *ip = &i; + int *i3p = &i3; + int *i4p = &i4; + + f (&ip, &i1, &i2, &i3p, &i4p); + if (i != 66 || ip != &i2 || i2 != 99 || i3 != -1 || i3p != i4p || i4 != 55) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr20527-1.c b/gcc/testsuite/gcc.c-torture/execute/pr20527-1.c new file mode 100644 index 000000000..81162dfeb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr20527-1.c @@ -0,0 +1,81 @@ +/* PR rtl-optimization/20527 + Mishandled postincrement. This test-case is derived from the + function BZ2_hbCreateDecodeTables in the file huffman.c from + bzip2-1.0.2, hence requiring the following disclaimer copied here: */ + +/*-- + This file is a part of bzip2 and/or libbzip2, a program and + library for lossless, block-sorting data compression. + + Copyright (C) 1996-2002 Julian R Seward. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product + documentation would be appreciated but is not required. + + 3. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + + 4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + Julian Seward, Cambridge, UK. + jseward@acm.org + bzip2/libbzip2 version 1.0 of 21 March 2000 + + This program is based on (at least) the work of: + Mike Burrows + David Wheeler + Peter Fenwick + Alistair Moffat + Radford Neal + Ian H. Witten + Robert Sedgewick + Jon L. Bentley + + For more information on these sources, see the manual. +--*/ + +void f (long *limit, long *base, long minLen, long maxLen) __attribute__ ((__noinline__)); +void f (long *limit, long *base, long minLen, long maxLen) +{ + long i; + long vec; + vec = 0; + for (i = minLen; i <= maxLen; i++) { + vec += (base[i+1] - base[i]); + limit[i] = vec-1; + } +} +extern void abort (void); +extern void exit (int); +long b[] = {1, 5, 11, 23}; +int main (void) +{ + long l[3]; + f (l, b, 0, 2); + if (l[0] != 3 || l[1] != 9 || l[2] != 21) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr20601-1.c b/gcc/testsuite/gcc.c-torture/execute/pr20601-1.c new file mode 100644 index 000000000..7c13c9138 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr20601-1.c @@ -0,0 +1,122 @@ +/* PR tree-optimization/20601 */ +extern void abort (void); +extern void exit (int); + +struct T +{ + char *t1; + char t2[4096]; + char **t3; +}; + +int a[5]; +int b; +char **c; +int d; +char **e; +struct T t; +char *f[16]; +char *g[] = { "a", "-u", "b", "c" }; + +__attribute__ ((__noreturn__)) void +foo (void) +{ + while (1); +} + +__attribute__ ((noinline)) char * +bar (char *x, unsigned int y) +{ + return 0; +} + +static inline char * +baz (char *x, unsigned int y) +{ + if (sizeof (t.t2) != (unsigned int) -1 && y > sizeof (t.t2)) + foo (); + return bar (x, y); +} + +static inline int +setup1 (int x) +{ + char *p; + int rval; + + if (!baz (t.t2, sizeof (t.t2))) + baz (t.t2, sizeof (t.t2)); + + if (x & 0x200) + { + char **h, **i = e; + + ++d; + e = f; + if (t.t1 && *t.t1) + e[0] = t.t1; + else + abort (); + + for (h = e + 1; (*h = *i); ++i, ++h) + ; + } + return 1; +} + +static inline int +setup2 (void) +{ + int j = 1; + + e = c + 1; + d = b - 1; + while (d > 0 && e[0][0] == '-') + { + if (e[0][1] != '\0' && e[0][2] != '\0') + abort (); + + switch (e[0][1]) + { + case 'u': + if (!e[1]) + abort (); + + t.t3 = &e[1]; + d--; + e++; + break; + case 'P': + j |= 0x1000; + break; + case '-': + d--; + e++; + if (j == 1) + j |= 0x600; + return j; + } + d--; + e++; + } + + if (d > 0 && !(j & 1)) + abort (); + + return j; +} + +int +main (void) +{ + int x; + c = g; + b = 4; + x = setup2 (); + t.t1 = "/bin/sh"; + setup1 (x); + /* PRE shouldn't transform x into the constant 0x601 here, it's not legal. */ + if ((x & 0x400) && !a[4]) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr20621-1.c b/gcc/testsuite/gcc.c-torture/execute/pr20621-1.c new file mode 100644 index 000000000..79901871d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr20621-1.c @@ -0,0 +1,6 @@ +/* When generating o32 MIPS PIC, main's $gp save slot was out of range + of a single load instruction. */ +struct big { int i[sizeof (int) >= 4 && sizeof (void *) >= 4 ? 0x4000 : 4]; }; +struct big gb; +int foo (struct big b, int x) { return b.i[x]; } +int main (void) { return foo (gb, 0) + foo (gb, 1); } diff --git a/gcc/testsuite/gcc.c-torture/execute/pr21173.c b/gcc/testsuite/gcc.c-torture/execute/pr21173.c new file mode 100644 index 000000000..61459bca7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr21173.c @@ -0,0 +1,21 @@ +void abort (void); + +char q; +void *a[2]; + +void foo (char *p) +{ + int i; + for (i = 0; i < 2; i++) + a[i] += p - &q; +} + +int main (void) +{ + int i; + foo (&q); + for (i = 0; i < 2; i ++) + if (a[i]) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr21331.c b/gcc/testsuite/gcc.c-torture/execute/pr21331.c new file mode 100644 index 000000000..4d95878e6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr21331.c @@ -0,0 +1,15 @@ +void abort (void); + +int bar (void) { return -1; } + +unsigned long +foo () +{ unsigned long retval; + retval = bar (); + if (retval == -1) return 0; + return 3; } + +main () +{ if (foo () != 0) abort (); + return 0; } + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr21964-1.c b/gcc/testsuite/gcc.c-torture/execute/pr21964-1.c new file mode 100644 index 000000000..b7e1e0dba --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr21964-1.c @@ -0,0 +1,16 @@ +void +foo (int n, int m) +{ + if (m == 0) + exit (0); + else if (n != 0) + abort (); + else + foo (n++, m - 1); +} + +int +main (void) +{ + foo (0, 4); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr22061-1.c b/gcc/testsuite/gcc.c-torture/execute/pr22061-1.c new file mode 100644 index 000000000..65375fecb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr22061-1.c @@ -0,0 +1,16 @@ +int N = 1; +void foo() {} /* Necessary to trigger the original ICE. */ +void bar (char a[2][N]) { a[1][0] = N; } +int +main (void) +{ + void *x; + + N = 4; + x = alloca (2 * N); + memset (x, 0, 2 * N); + bar (x); + if (N[(char *) x] != N) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr22061-2.c b/gcc/testsuite/gcc.c-torture/execute/pr22061-2.c new file mode 100644 index 000000000..4e1be8f0e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr22061-2.c @@ -0,0 +1,7 @@ +int *x; +static void bar (char a[2][(*x)++]) {} +int +main (void) +{ + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr22061-3.c b/gcc/testsuite/gcc.c-torture/execute/pr22061-3.c new file mode 100644 index 000000000..a80594818 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr22061-3.c @@ -0,0 +1,18 @@ +void +bar (int N) +{ + int foo (char a[2][++N]) { N += 4; return sizeof (a[0]); } + if (foo (0) != 2) + abort (); + if (foo (0) != 7) + abort (); + if (N != 11) + abort (); +} + +int +main() +{ + bar (1); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr22061-4.c b/gcc/testsuite/gcc.c-torture/execute/pr22061-4.c new file mode 100644 index 000000000..38ce3e8c5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr22061-4.c @@ -0,0 +1,22 @@ +void +bar (int N) +{ + void foo (int a[2][N++]) {} + int a[2][N]; + foo (a); + int b[2][N]; + foo (b); + if (sizeof (a) != sizeof (int) * 2 * 1) + abort (); + if (sizeof (b) != sizeof (int) * 2 * 2) + abort (); + if (N != 3) + abort (); +} + +int +main (void) +{ + bar (1); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr22098-1.c b/gcc/testsuite/gcc.c-torture/execute/pr22098-1.c new file mode 100644 index 000000000..142530f62 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr22098-1.c @@ -0,0 +1,14 @@ +extern void abort (void); +extern void exit (int); +typedef __SIZE_TYPE__ size_t; +int +main (void) +{ + int a = 0; + int *p; + size_t b; + b = (size_t)(p = &(int []){0, 1, 2}[++a]); + if (a != 1 || *p != 1 || *(int *)b != 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr22098-2.c b/gcc/testsuite/gcc.c-torture/execute/pr22098-2.c new file mode 100644 index 000000000..249647dc5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr22098-2.c @@ -0,0 +1,14 @@ +extern void abort (void); +extern void exit (int); +typedef __SIZE_TYPE__ size_t; +int +main (void) +{ + int a = 0; + int *p; + size_t b; + b = (size_t)(p = &(int []){0, 1, 2}[1]); + if (*p != 1 || *(int *)b != 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr22098-3.c b/gcc/testsuite/gcc.c-torture/execute/pr22098-3.c new file mode 100644 index 000000000..4c8a1c62c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr22098-3.c @@ -0,0 +1,16 @@ +extern void abort (void); +extern void exit (int); +typedef __SIZE_TYPE__ size_t; +int n = 0; +int f (void) { return ++n; } +int +main (void) +{ + int a = 0; + int *p; + size_t b; + b = (size_t)(p = &(int []){0, f(), 2}[1]); + if (*p != 1 || *(int *)b != 1 || n != 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr22348.c b/gcc/testsuite/gcc.c-torture/execute/pr22348.c new file mode 100644 index 000000000..9192d5130 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr22348.c @@ -0,0 +1,15 @@ +void abort (void); +void f(int i) +{ + if (i>4 + 3 * 16) + abort(); +} + +int main() +{ + unsigned int buflen, i; + buflen = 4 + 3 * 16; + for (i = 4; i < buflen; i+= 3) + f(i); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr22429.c b/gcc/testsuite/gcc.c-torture/execute/pr22429.c new file mode 100644 index 000000000..aa55b6e88 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr22429.c @@ -0,0 +1,17 @@ +extern void abort (void); + +#define N (1 << (sizeof(int) * __CHAR_BIT__ - 2)) + +int f(int n) +{ + if (-N <= n && n <= N-1) + return 1; + return 0; +} + +int main () +{ + if (f (N)) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr22493-1.c b/gcc/testsuite/gcc.c-torture/execute/pr22493-1.c new file mode 100644 index 000000000..bc0ff785a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr22493-1.c @@ -0,0 +1,18 @@ +#include +extern void abort (); +extern void exit (int); +void f(int i) +{ + if (i>0) + abort(); + i = -i; + if (i<0) + return; + abort (); +} + +int main(int argc, char *argv[]) +{ + f(INT_MIN); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr22493-1.x b/gcc/testsuite/gcc.c-torture/execute/pr22493-1.x new file mode 100644 index 000000000..36a583950 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr22493-1.x @@ -0,0 +1,2 @@ +set additional_flags "-fwrapv" +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr22630.c b/gcc/testsuite/gcc.c-torture/execute/pr22630.c new file mode 100644 index 000000000..d3a564999 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr22630.c @@ -0,0 +1,23 @@ +void abort (void); + +int j; + +void bla (int *r) +{ + int *p, *q; + + p = q = r; + if (!p) + p = &j; + + if (p != q) + j = 1; +} + +int main (void) +{ + bla (0); + if (!j) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr23047.c b/gcc/testsuite/gcc.c-torture/execute/pr23047.c new file mode 100644 index 000000000..7557fc2be --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr23047.c @@ -0,0 +1,16 @@ +#include +extern void abort (); +extern void exit (int); +void f(int i) +{ + i = i > 0 ? i : -i; + if (i<0) + return; + abort (); +} + +int main(int argc, char *argv[]) +{ + f(INT_MIN); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr23047.x b/gcc/testsuite/gcc.c-torture/execute/pr23047.x new file mode 100644 index 000000000..36a583950 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr23047.x @@ -0,0 +1,2 @@ +set additional_flags "-fwrapv" +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr23135.c b/gcc/testsuite/gcc.c-torture/execute/pr23135.c new file mode 100644 index 000000000..57b5f7cfa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr23135.c @@ -0,0 +1,134 @@ +/* Based on execute/simd-1.c, modified by joern.rennecke@st.com to + trigger a reload bug. Verified for gcc mainline from 20050722 13:00 UTC + for sh-elf -m4 -O2. */ +#ifndef STACK_SIZE +#define STACK_SIZE (256*1024) +#endif + +typedef struct { char c[STACK_SIZE/2]; } big_t; + +typedef int __attribute__((mode(SI))) __attribute__((vector_size (8))) vecint; +typedef int __attribute__((mode(SI))) siint; + +vecint i = { 150, 100 }; +vecint j = { 10, 13 }; +vecint k; + +union { + vecint v; + siint i[2]; +} res; + +void +verify (siint a1, siint a2, siint b1, siint b2, big_t big) +{ + if (a1 != b1 + || a2 != b2) + abort (); +} + +int +main () +{ + big_t big; + vecint k0, k1, k2, k3, k4, k5, k6, k7; + + k0 = i + j; + res.v = k0; + + verify (res.i[0], res.i[1], 160, 113, big); + + k1 = i * j; + res.v = k1; + + verify (res.i[0], res.i[1], 1500, 1300, big); + + k2 = i / j; +/* This is the observed failure - reload 0 has the wrong type and thus the + conflict with reload 1 is missed: + +(insn:HI 94 92 96 1 pr23135.c:46 (parallel [ + (set (subreg:SI (reg:DI 253) 0) + (div:SI (reg:SI 4 r4) + (reg:SI 5 r5))) + (clobber (reg:SI 146 pr)) + (clobber (reg:DF 64 fr0)) + (clobber (reg:DF 66 fr2)) + (use (reg:PSI 151 )) + (use (reg/f:SI 256)) + ]) 60 {divsi3_i4} (insn_list:REG_DEP_TRUE 90 (insn_list:REG_DEP_TRUE 89 +(insn_list:REG_DEP_TRUE 42 (insn_list:REG_DEP_TRUE 83 (insn_list:REG_DEP_TRUE 92 + (insn_list:REG_DEP_TRUE 91 (nil))))))) + (expr_list:REG_DEAD (reg:SI 4 r4) + (expr_list:REG_DEAD (reg:SI 5 r5) + (expr_list:REG_UNUSED (reg:DF 66 fr2) + (expr_list:REG_UNUSED (reg:DF 64 fr0) + (expr_list:REG_UNUSED (reg:SI 146 pr) + (insn_list:REG_RETVAL 91 (nil)))))))) + +Reloads for insn # 94 +Reload 0: reload_in (SI) = (plus:SI (reg/f:SI 14 r14) + (const_int 64 [0x40])) + GENERAL_REGS, RELOAD_FOR_OUTADDR_ADDRESS (opnum = 0) + reload_in_reg: (plus:SI (reg/f:SI 14 r14) + (const_int 64 [0x40])) + reload_reg_rtx: (reg:SI 3 r3) +Reload 1: GENERAL_REGS, RELOAD_FOR_OUTPUT_ADDRESS (opnum = 0), can't combine, se +condary_reload_p + reload_reg_rtx: (reg:SI 3 r3) +Reload 2: reload_out (SI) = (mem:SI (plus:SI (plus:SI (reg/f:SI 14 r14) + (const_int 64 [0x40])) + (const_int 28 [0x1c])) [ 16 S8 A32]) + FPUL_REGS, RELOAD_FOR_OUTPUT (opnum = 0) + reload_out_reg: (subreg:SI (reg:DI 253) 0) + reload_reg_rtx: (reg:SI 150 fpul) + secondary_out_reload = 1 + +Reload 3: reload_in (SI) = (symbol_ref:SI ("__sdivsi3_i4") [flags 0x1]) + GENERAL_REGS, RELOAD_FOR_INPUT (opnum = 1), can't combine + reload_in_reg: (reg/f:SI 256) + reload_reg_rtx: (reg:SI 3 r3) + */ + + + res.v = k2; + + verify (res.i[0], res.i[1], 15, 7, big); + + k3 = i & j; + res.v = k3; + + verify (res.i[0], res.i[1], 2, 4, big); + + k4 = i | j; + res.v = k4; + + verify (res.i[0], res.i[1], 158, 109, big); + + k5 = i ^ j; + res.v = k5; + + verify (res.i[0], res.i[1], 156, 105, big); + + k6 = -i; + res.v = k6; + verify (res.i[0], res.i[1], -150, -100, big); + + k7 = ~i; + res.v = k7; + verify (res.i[0], res.i[1], -151, -101, big); + + k = k0 + k1 + k3 + k4 + k5 + k6 + k7; + res.v = k; + verify (res.i[0], res.i[1], 1675, 1430, big); + + k = k0 * k1 * k3 * k4 * k5 * k6 * k7; + res.v = k; + verify (res.i[0], res.i[1], 1456467968, -1579586240, big); + + k = k0 / k1 / k2 / k3 / k4 / k5 / k6 / k7; + res.v = k; + verify (res.i[0], res.i[1], 0, 0, big); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr23324.c b/gcc/testsuite/gcc.c-torture/execute/pr23324.c new file mode 100644 index 000000000..c5f88f7de --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr23324.c @@ -0,0 +1,133 @@ +extern void abort (void); +#define A(x) if (!(x)) abort () + +static union at6 {} vv6 = {}; +static struct et6 +{ + struct bt6 + { + signed av6:6; + signed bv6:7; + signed cv6:6; + signed dv6:5; + unsigned char ev6; + unsigned int fv6; + long int gv6; + } mv6; + unsigned long int nv6; + signed ov6:12; + signed pv6:3; + signed qv6:2; + signed rv6:10; + union ct6 { long int hv6; float iv6; float jv6; } sv6; + int *tv6; + union dt6 { double kv6; float lv6; } uv6; +} wv6 = { + { 8, 9, 2, 4, '\x10', 67426805U, 1047191860L }, + 1366022414UL, 858, 1, 1, 305, + { 1069379046L }, (int *) 358273621U, + { 3318.041978 } +}; +static double xv6 = 19239.101269; +static long long int yv6 = 1207859169L; +static int zv6 = 660195606; + +static union at6 +callee_af6 (struct et6 ap6, double bp6, long long int cp6, int dp6) +{ + A (wv6.mv6.av6 == ap6.mv6.av6); + A (wv6.mv6.bv6 == ap6.mv6.bv6); + A (wv6.mv6.cv6 == ap6.mv6.cv6); + A (wv6.mv6.dv6 == ap6.mv6.dv6); + A (wv6.mv6.ev6 == ap6.mv6.ev6); + A (wv6.mv6.fv6 == ap6.mv6.fv6); + A (wv6.mv6.gv6 == ap6.mv6.gv6); + A (wv6.nv6 == ap6.nv6); + A (wv6.ov6 == ap6.ov6); + A (wv6.pv6 == ap6.pv6); + A (wv6.qv6 == ap6.qv6); + A (wv6.rv6 == ap6.rv6); + A (wv6.sv6.hv6 == ap6.sv6.hv6); + A (wv6.tv6 == ap6.tv6); + A (wv6.uv6.kv6 == ap6.uv6.kv6); + A (xv6 == bp6); + A (yv6 == cp6); + A (zv6 == dp6); + return vv6; +} + +static void +caller_bf6 (void) +{ + union at6 bav6; + bav6 = callee_af6 (wv6, xv6, yv6, zv6); +} + +static unsigned char uv7 = '\x46'; +static float vv7 = 96636.982442; +static double wv7 = 28450.711801; +static union ct7 {} xv7 = {}; +static struct et7 +{ + struct dt7 + { + float iv7; + unsigned short int jv7; + } kv7; + float lv7[0]; + signed mv7:9; + short int nv7; + double ov7; + float pv7; +} yv7 = { + { 30135.996213, 42435 }, + {}, 170, 22116, 26479.628148, 4082.960685 +}; +static union ft7 +{ + float qv7; + float *rv7; + unsigned int *sv7; +} zv7 = { 5042.227886 }; +static int bav7 = 1345451862; +static struct gt7 { double tv7; } bbv7 = { 47875.491954 }; +static long int bcv7[1] = { 1732133482L }; +static long long int bdv7 = 381678602L; + +static unsigned char +callee_af7 (float ap7, double bp7, union ct7 cp7, struct et7 dp7, + union ft7 ep7, int fp7, struct gt7 gp7, long int hp7[1], + long long int ip7) +{ + A (vv7 == ap7); + A (wv7 == bp7); + A (yv7.kv7.iv7 == dp7.kv7.iv7); + A (yv7.kv7.jv7 == dp7.kv7.jv7); + A (yv7.mv7 == dp7.mv7); + A (yv7.nv7 == dp7.nv7); + A (yv7.ov7 == dp7.ov7); + A (yv7.pv7 == dp7.pv7); + A (zv7.qv7 == ep7.qv7); + A (bav7 == fp7); + A (bbv7.tv7 == gp7.tv7); + A (bcv7[0] == hp7[0]); + A (bdv7 == ip7); + return uv7; +} + +static void +caller_bf7 (void) +{ + unsigned char bev7; + + bev7 = callee_af7 (vv7, wv7, xv7, yv7, zv7, bav7, bbv7, bcv7, bdv7); + A (uv7 == bev7); +} + +int +main () +{ + caller_bf6 (); + caller_bf7 (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr23467.c b/gcc/testsuite/gcc.c-torture/execute/pr23467.c new file mode 100644 index 000000000..71ec3da42 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr23467.c @@ -0,0 +1,18 @@ +struct s1 +{ + int __attribute__ ((aligned (8))) a; +}; + +struct +{ + char c; + struct s1 m; +} v; + +int +main (void) +{ + if ((int)&v.m & 7) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr23604.c b/gcc/testsuite/gcc.c-torture/execute/pr23604.c new file mode 100644 index 000000000..4c2b80d56 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr23604.c @@ -0,0 +1,22 @@ +extern void abort (void); + +int g(int i, int j) +{ + if (i>-1) + if (i<2) + { + if (i != j) + { + if (j != 0) + return 0; + } + } + return 1; +} + +int main(void) +{ + if (!g(1, 0)) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr23941.c b/gcc/testsuite/gcc.c-torture/execute/pr23941.c new file mode 100644 index 000000000..4dfd6451c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr23941.c @@ -0,0 +1,9 @@ +extern void abort (void); +double d = __FLT_MIN__ / 2.0; +int main() +{ + double x = __FLT_MIN__ / 2.0; + if (x != d) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr24135.c b/gcc/testsuite/gcc.c-torture/execute/pr24135.c new file mode 100644 index 000000000..fdeda1640 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr24135.c @@ -0,0 +1,46 @@ +#ifndef NO_TRAMPOLINES +extern void abort (void); + +int x(int a, int b) +{ + __label__ xlab; + __label__ xlab2; + + void y(int b) + { + switch (b) + { + case 1: goto xlab; + case 2: goto xlab; + } + } + + a = a + 2; + y (b); + + xlab: + return a; + + xlab2: + a++; + return a; + +} + +int main () +{ + int i, j; + + for (j = 1; j <= 2; ++j) + for (i = 1; i <= 2; ++i) + { + int a = x (j, i); + if (a != 2 + j) + abort (); + } + + return 0; +} +#else +int main() { return 0; } +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/pr24141.c b/gcc/testsuite/gcc.c-torture/execute/pr24141.c new file mode 100644 index 000000000..301296206 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr24141.c @@ -0,0 +1,33 @@ +// reduced testcase, compile with -O2. Also, with --disable-checking +// gcc produces wrong code. + +void abort (void); +int i; + +void g (void) +{ + i = 1; +} + +void f (int a, int b) +{ + int c = 0; + if (a == 0) + c = 1; + if (c) + return; + if (c == 1) + c = 0; + if (b == 0) + c = 1; + if (c) + g (); +} + +int main (void) +{ + f (1, 0); + if (i != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr24142.c b/gcc/testsuite/gcc.c-torture/execute/pr24142.c new file mode 100644 index 000000000..eed3e8bc6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr24142.c @@ -0,0 +1,19 @@ +void abort (void); + +int f (int a, int b) +{ + if (a == 1) + a = 0; + if (b == 0) + a = 1; + if (a != 0) + return 0; + return 1; +} + +int main (void) +{ + if (f (1, 1) != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr24716.c b/gcc/testsuite/gcc.c-torture/execute/pr24716.c new file mode 100644 index 000000000..c2473f84c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr24716.c @@ -0,0 +1,59 @@ +/* PR24716, scalar evolution returning the wrong result + for pdest. */ + +int Link[] = { -1 }; +int W[] = { 2 }; + +extern void abort (void); + +int f (int k, int p) +{ + int pdest, j, D1361; + j = 0; + pdest = 0; + for (;;) { + if (pdest > 2) + do + j--, pdest++; + while (j > 2); + + if (j == 1) + break; + + while (pdest > p) + if (j == p) + pdest++; + + do + { + D1361 = W[k]; + do + if (D1361 != 0) + pdest = 1, W[k] = D1361 = 0; + while (p < 1); + } while (k > 0); + + do + { + p = 0; + k = Link[k]; + while (p < j) + if (k != -1) + pdest++, p++; + } + while (k != -1); + j = 1; + } + + /* The correct return value should be pdest (1 in the call from main). + DOM3 is mistaken and propagates a 0 here. */ + return pdest; +} + +int main () +{ + if (!f (0, 2)) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr24851.c b/gcc/testsuite/gcc.c-torture/execute/pr24851.c new file mode 100644 index 000000000..55a87e001 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr24851.c @@ -0,0 +1,17 @@ +/* We used to handle pointer addition wrongly + at the time of recombining to an ARRAY_REF + in the case of + p + -4B + where -4B is represented as unsigned. */ + +void abort(void); +int main() +{ + int a[10], *p, *q; + q = &a[1]; + p = &q[-1]; + if (p >= &a[9]) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr25125.c b/gcc/testsuite/gcc.c-torture/execute/pr25125.c new file mode 100644 index 000000000..f08ebe74a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr25125.c @@ -0,0 +1,27 @@ +extern void exit (int); +extern void abort (void); +extern unsigned short f (short a) __attribute__((__noinline__)); + +unsigned short +f (short a) +{ + short b; + + if (a > 0) + return 0; + b = ((int) a) + - (int) 32768; + return b; +} + +int +main (void) +{ + if (sizeof (short) < 2 + || sizeof (short) >= sizeof (int)) + exit (0); + + if (f (-32767) != 1) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr25737.c b/gcc/testsuite/gcc.c-torture/execute/pr25737.c new file mode 100644 index 000000000..9da63adce --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr25737.c @@ -0,0 +1,23 @@ +extern void abort (void); + +struct delay_block { + struct delay_block *succ; +}; + +static struct delay_block Timer_Queue; + +struct delay_block* time_enqueue (struct delay_block *d) +{ + struct delay_block *q = Timer_Queue.succ; + d->succ = (void *)0; + return Timer_Queue.succ; +} + +int main(void) +{ + Timer_Queue.succ = &Timer_Queue; + if (time_enqueue (&Timer_Queue) != (void*)0) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr27073.c b/gcc/testsuite/gcc.c-torture/execute/pr27073.c new file mode 100644 index 000000000..a58e9acae --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr27073.c @@ -0,0 +1,25 @@ +void __attribute__((noinline)) +foo (int *p, int d1, int d2, int d3, + short count, int s1, int s2, int s3, int s4, int s5) +{ + int n = count; + while (n--) + { + *p++ = s1; + *p++ = s2; + *p++ = s3; + *p++ = s4; + *p++ = s5; + } +} + +int main() +{ + int x[10], i; + + foo (x, 0, 0, 0, 2, 100, 200, 300, 400, 500); + for (i = 0; i < 10; i++) + if (x[i] != (i % 5 + 1) * 100) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr27260.c b/gcc/testsuite/gcc.c-torture/execute/pr27260.c new file mode 100644 index 000000000..daec0c336 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr27260.c @@ -0,0 +1,33 @@ +/* PR middle-end/27260 */ + +extern void abort (void); +extern void *memset (void *, int, __SIZE_TYPE__); + +char buf[65]; + +void +foo (int x) +{ + memset (buf, x != 2 ? 1 : 0, 64); +} + +int +main (void) +{ + int i; + buf[64] = 2; + for (i = 0; i < 64; i++) + if (buf[i] != 0) + abort (); + foo (0); + for (i = 0; i < 64; i++) + if (buf[i] != 1) + abort (); + foo (2); + for (i = 0; i < 64; i++) + if (buf[i] != 0) + abort (); + if (buf[64] != 2) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr27285.c b/gcc/testsuite/gcc.c-torture/execute/pr27285.c new file mode 100644 index 000000000..44a6aaf0f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr27285.c @@ -0,0 +1,46 @@ +/* PR tree-optimization/27285 */ + +extern void abort (void); + +struct S { unsigned char a, b, c, d[16]; }; + +void __attribute__ ((noinline)) +foo (struct S *x, struct S *y) +{ + int a, b; + unsigned char c, *d, *e; + + b = x->b; + d = x->d; + e = y->d; + a = 0; + while (b) + { + if (b >= 8) + { + c = 0xff; + b -= 8; + } + else + { + c = 0xff << (8 - b); + b = 0; + } + + e[a] = d[a] & c; + a++; + } +} + +int +main (void) +{ + struct S x = { 0, 25, 0, { 0xaa, 0xbb, 0xcc, 0xdd }}; + struct S y = { 0, 0, 0, { 0 }}; + + foo (&x, &y); + if (x.d[0] != y.d[0] || x.d[1] != y.d[1] + || x.d[2] != y.d[2] || (x.d[3] & 0x80) != y.d[3]) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr27364.c b/gcc/testsuite/gcc.c-torture/execute/pr27364.c new file mode 100644 index 000000000..aa608b2a2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr27364.c @@ -0,0 +1,13 @@ +int f(unsigned number_of_digits_to_use) +{ + if (number_of_digits_to_use >1294) + return 0; + return (number_of_digits_to_use * 3321928 / 1000000 + 1) /16; +} + +int main(void) +{ + if (f(11) != 2) + __builtin_abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr27671-1.c b/gcc/testsuite/gcc.c-torture/execute/pr27671-1.c new file mode 100644 index 000000000..dd2982cc8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr27671-1.c @@ -0,0 +1,21 @@ +/* PR rtl-optimization/27671. + The combiner used to simplify "a ^ b == a" to "a" via + simplify_relational_operation_1 in simplify-rtx.c. */ + +extern void abort (void) __attribute__ ((noreturn)); +extern void exit (int) __attribute__ ((noreturn)); + +static int __attribute__((noinline)) +foo (int a, int b) +{ + int c = a ^ b; + if (c == a) + abort (); +} + +int +main (void) +{ + foo (0, 1); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr28289.c b/gcc/testsuite/gcc.c-torture/execute/pr28289.c new file mode 100644 index 000000000..93e922cbb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr28289.c @@ -0,0 +1,33 @@ +extern int ok (int); +extern void exit (); +static int gen_x86_64_shrd (int); +static int +gen_x86_64_shrd(int a __attribute__ ((__unused__))) +{ + return 0; +} + +extern int gen_x86_shrd_1 (int); +extern void ix86_split_ashr (int); + +void +ix86_split_ashr (int mode) +{ + (mode != 0 + ? ok + : gen_x86_64_shrd) (0); +} + +volatile int one = 1; +int +main (void) +{ + ix86_split_ashr (one); + return 1; +} + +int +ok (int i) +{ + exit (i); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr28403.c b/gcc/testsuite/gcc.c-torture/execute/pr28403.c new file mode 100644 index 000000000..8f85ea085 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr28403.c @@ -0,0 +1,23 @@ +typedef unsigned long long ull; +int global; + +int __attribute__((noinline)) +foo (int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8) +{ + global = x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8; +} + +ull __attribute__((noinline)) +bar (ull x) +{ + foo (1, 2, 1, 3, 1, 4, 1, 5); + return x >> global; +} + +int +main (void) +{ + if (bar (0x123456789abcdefULL) != (0x123456789abcdefULL >> 18)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr28651.c b/gcc/testsuite/gcc.c-torture/execute/pr28651.c new file mode 100644 index 000000000..74656fd01 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr28651.c @@ -0,0 +1,19 @@ +#include + +extern void abort (void); +int __attribute__((noinline)) +foo (unsigned int u) +{ + return (int)(u + 4) < (int)u; +} + +int +main (int argc, char *argv[]) +{ + unsigned int u = INT_MAX; + + if (foo (u) == 0) + abort(); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr28778.c b/gcc/testsuite/gcc.c-torture/execute/pr28778.c new file mode 100644 index 000000000..f96a66cd3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr28778.c @@ -0,0 +1,33 @@ +extern void abort(void); +typedef long GLint; +void aglChoosePixelFormat (const GLint *); + +void +find (const int *alistp) +{ + const int *blist; + int list[32]; + if (alistp) + blist = alistp; + else + { + list[3] = 42; + blist = list; + } + aglChoosePixelFormat ((GLint *) blist); +} + +void +aglChoosePixelFormat (const GLint * a) +{ + int *b = (int *) a; + if (b[3] != 42) + abort (); +} + +int +main (void) +{ + find (0); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr28982a.c b/gcc/testsuite/gcc.c-torture/execute/pr28982a.c new file mode 100644 index 000000000..5660a8d3a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr28982a.c @@ -0,0 +1,65 @@ +/* PR rtl-optimization/28982. Function foo() does the equivalent of: + + float tmp_results[NVARS]; + for (int i = 0; i < NVARS; i++) + { + int inc = incs[i]; + float *ptr = ptrs[i], result = 0; + for (int j = 0; j < n; j++) + result += *ptr, ptr += inc; + tmp_results[i] = result; + } + memcpy (results, tmp_results, sizeof (results)); + + but without the outermost loop. The idea is to create high register + pressure and ensure that some INC and PTR variables are spilled. + + On ARM targets, sequences like "result += *ptr, ptr += inc" can + usually be implemented using (mem (post_modify ...)), and we do + indeed create such MEMs before reload for this testcase. However, + (post_modify ...) is not a valid address for coprocessor loads, so + for -mfloat-abi=softfp, reload reloads the POST_MODIFY into a base + register. GCC did not deal correctly with cases where the base and + index of the POST_MODIFY are themselves reloaded. */ +#define NITER 4 +#define NVARS 20 +#define MULTI(X) \ + X( 0), X( 1), X( 2), X( 3), X( 4), X( 5), X( 6), X( 7), X( 8), X( 9), \ + X(10), X(11), X(12), X(13), X(14), X(15), X(16), X(17), X(18), X(19) + +#define DECLAREI(INDEX) inc##INDEX = incs[INDEX] +#define DECLAREF(INDEX) *ptr##INDEX = ptrs[INDEX], result##INDEX = 0 +#define LOOP(INDEX) result##INDEX += *ptr##INDEX, ptr##INDEX += inc##INDEX +#define COPYOUT(INDEX) results[INDEX] = result##INDEX + +float *ptrs[NVARS]; +float results[NVARS]; +int incs[NVARS]; + +void __attribute__((noinline)) +foo (int n) +{ + int MULTI (DECLAREI); + float MULTI (DECLAREF); + while (n--) + MULTI (LOOP); + MULTI (COPYOUT); +} + +float input[NITER * NVARS]; + +int +main (void) +{ + int i; + + for (i = 0; i < NVARS; i++) + ptrs[i] = input + i, incs[i] = i; + for (i = 0; i < NITER * NVARS; i++) + input[i] = i; + foo (NITER); + for (i = 0; i < NVARS; i++) + if (results[i] != i * NITER * (NITER + 1) / 2) + return 1; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr28982b.c b/gcc/testsuite/gcc.c-torture/execute/pr28982b.c new file mode 100644 index 000000000..3f9f5bafc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr28982b.c @@ -0,0 +1,58 @@ +/* Like pr28982a.c, but with the spill slots outside the range of + a single sp-based load on ARM. This test tests for cases where + the addresses in the base and index reloads require further reloads. */ +#if defined(STACK_SIZE) && STACK_SIZE <= 0x80100 +int main (void) { return 0; } +#else +#define NITER 4 +#define NVARS 20 +#define MULTI(X) \ + X( 0), X( 1), X( 2), X( 3), X( 4), X( 5), X( 6), X( 7), X( 8), X( 9), \ + X(10), X(11), X(12), X(13), X(14), X(15), X(16), X(17), X(18), X(19) + +#define DECLAREI(INDEX) inc##INDEX = incs[INDEX] +#define DECLAREF(INDEX) *ptr##INDEX = ptrs[INDEX], result##INDEX = 0 +#define LOOP(INDEX) result##INDEX += *ptr##INDEX, ptr##INDEX += inc##INDEX +#define COPYOUT(INDEX) results[INDEX] = result##INDEX + +float *ptrs[NVARS]; +float results[NVARS]; +int incs[NVARS]; + +struct big { int i[0x10000]; }; +void __attribute__((noinline)) +bar (struct big b) +{ + incs[0] += b.i[0]; +} + +void __attribute__((noinline)) +foo (int n) +{ + struct big b = {}; + int MULTI (DECLAREI); + float MULTI (DECLAREF); + while (n--) + MULTI (LOOP); + MULTI (COPYOUT); + bar (b); +} + +float input[NITER * NVARS]; + +int +main (void) +{ + int i; + + for (i = 0; i < NVARS; i++) + ptrs[i] = input + i, incs[i] = i; + for (i = 0; i < NITER * NVARS; i++) + input[i] = i; + foo (NITER); + for (i = 0; i < NVARS; i++) + if (results[i] != i * NITER * (NITER + 1) / 2) + return 1; + return 0; +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/pr29006.c b/gcc/testsuite/gcc.c-torture/execute/pr29006.c new file mode 100644 index 000000000..4d1f13884 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr29006.c @@ -0,0 +1,3 @@ +struct __attribute__((__packed__)) s { char c; unsigned long long x; }; +void __attribute__((__noinline__)) foo (struct s *s) { s->x = 0; } +int main (void) { struct s s = { 1, ~0ULL }; foo (&s); return s.x != 0; } diff --git a/gcc/testsuite/gcc.c-torture/execute/pr29156.c b/gcc/testsuite/gcc.c-torture/execute/pr29156.c new file mode 100644 index 000000000..20f5f9979 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr29156.c @@ -0,0 +1,32 @@ +extern void abort(void); +struct test1 +{ + int a; + int b; +}; +struct test2 +{ + float d; + struct test1 sub; +}; + +int global; + +int bla(struct test1 *xa, struct test2 *xb) +{ + global = 1; + xb->sub.a = 1; + xa->a = 8; + return xb->sub.a; +} + +int main(void) +{ + struct test2 pom; + + if (bla (&pom.sub, &pom) != 8) + abort (); + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr29695-1.c b/gcc/testsuite/gcc.c-torture/execute/pr29695-1.c new file mode 100644 index 000000000..9ecb31425 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr29695-1.c @@ -0,0 +1,83 @@ +/* PR middle-end/29695 */ + +extern void abort (void); + +int +f1 (void) +{ + int a = 128; + return (a & 0x80) ? 0x80 : 0; +} + +int +f2 (void) +{ + unsigned char a = 128; + return (a & 0x80) ? 0x80 : 0; +} + +int +f3 (void) +{ + unsigned char a = 128; + return (a & 0x80) ? 0x380 : 0; +} + +int +f4 (void) +{ + unsigned char a = 128; + return (a & 0x80) ? -128 : 0; +} + +long long +f5 (void) +{ + long long a = 0x80000000LL; + return (a & 0x80000000) ? 0x80000000LL : 0LL; +} + +long long +f6 (void) +{ + unsigned int a = 0x80000000; + return (a & 0x80000000) ? 0x80000000LL : 0LL; +} + +long long +f7 (void) +{ + unsigned int a = 0x80000000; + return (a & 0x80000000) ? 0x380000000LL : 0LL; +} + +long long +f8 (void) +{ + unsigned int a = 0x80000000; + return (a & 0x80000000) ? -2147483648LL : 0LL; +} + +int +main (void) +{ + if ((char) 128 != -128 || (int) 0x80000000 != -2147483648) + return 0; + if (f1 () != 128) + abort (); + if (f2 () != 128) + abort (); + if (f3 () != 896) + abort (); + if (f4 () != -128) + abort (); + if (f5 () != 0x80000000LL) + abort (); + if (f6 () != 0x80000000LL) + abort (); + if (f7 () != 0x380000000LL) + abort (); + if (f8 () != -2147483648LL) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr29695-2.c b/gcc/testsuite/gcc.c-torture/execute/pr29695-2.c new file mode 100644 index 000000000..339428e32 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr29695-2.c @@ -0,0 +1,80 @@ +/* PR middle-end/29695 */ + +extern void abort (void); + +int a = 128; +unsigned char b = 128; +long long c = 0x80000000LL; +unsigned int d = 0x80000000; + +int +f1 (void) +{ + return (a & 0x80) ? 0x80 : 0; +} + +int +f2 (void) +{ + return (b & 0x80) ? 0x80 : 0; +} + +int +f3 (void) +{ + return (b & 0x80) ? 0x380 : 0; +} + +int +f4 (void) +{ + return (b & 0x80) ? -128 : 0; +} + +long long +f5 (void) +{ + return (c & 0x80000000) ? 0x80000000LL : 0LL; +} + +long long +f6 (void) +{ + return (d & 0x80000000) ? 0x80000000LL : 0LL; +} + +long long +f7 (void) +{ + return (d & 0x80000000) ? 0x380000000LL : 0LL; +} + +long long +f8 (void) +{ + return (d & 0x80000000) ? -2147483648LL : 0LL; +} + +int +main (void) +{ + if ((char) 128 != -128 || (int) 0x80000000 != -2147483648) + return 0; + if (f1 () != 128) + abort (); + if (f2 () != 128) + abort (); + if (f3 () != 896) + abort (); + if (f4 () != -128) + abort (); + if (f5 () != 0x80000000LL) + abort (); + if (f6 () != 0x80000000LL) + abort (); + if (f7 () != 0x380000000LL) + abort (); + if (f8 () != -2147483648LL) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr29797-1.c b/gcc/testsuite/gcc.c-torture/execute/pr29797-1.c new file mode 100644 index 000000000..9bcc2a9c5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr29797-1.c @@ -0,0 +1,14 @@ +extern void abort(void); + +unsigned int bar(void) { return 32768; } + +int main() +{ + unsigned int nStyle = bar (); + if (nStyle & 32768) + nStyle |= 65536; + if (nStyle != (32768 | 65536)) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr29797-1.x b/gcc/testsuite/gcc.c-torture/execute/pr29797-1.x new file mode 100644 index 000000000..4efed4c32 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr29797-1.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_int32plus] } { + return 0 +} + +return 1; diff --git a/gcc/testsuite/gcc.c-torture/execute/pr29797-2.c b/gcc/testsuite/gcc.c-torture/execute/pr29797-2.c new file mode 100644 index 000000000..9313bf4c6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr29797-2.c @@ -0,0 +1,14 @@ +extern void abort(void); + +unsigned long bar(void) { return 32768; } + +int main() +{ + unsigned long nStyle = bar (); + if (nStyle & 32768) + nStyle |= 65536; + if (nStyle != (32768 | 65536)) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr29798.c b/gcc/testsuite/gcc.c-torture/execute/pr29798.c new file mode 100644 index 000000000..f7b90da02 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr29798.c @@ -0,0 +1,26 @@ +extern void abort (); + +int +main () +{ + int i; + double oldrho; + double beta = 0.0; + double work = 1.0; + for (i = 1; i <= 2; i++) + { + double rho = work * work; + if (i != 1) + beta = rho / oldrho; + if (beta == 1.0) + abort (); + + /* All targets even remotely likely to ever get supported + use at least an even base, so there will never be any + floating-point rounding. All computation in this test + case is exact for even bases. */ + work /= 2.0; + oldrho = rho; + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr30185.c b/gcc/testsuite/gcc.c-torture/execute/pr30185.c new file mode 100644 index 000000000..3e974ce57 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr30185.c @@ -0,0 +1,28 @@ +/* PR target/30185 */ + +extern void abort (void); + +typedef struct S { char a; long long b; } S; + +S +foo (S x, S y) +{ + S z; + z.b = x.b / y.b; + return z; +} + +int +main (void) +{ + S a, b; + a.b = 32LL; + b.b = 4LL; + if (foo (a, b).b != 8LL) + abort (); + a.b = -8LL; + b.b = -2LL; + if (foo (a, b).b != 4LL) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr30778.c b/gcc/testsuite/gcc.c-torture/execute/pr30778.c new file mode 100644 index 000000000..1b05189f4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr30778.c @@ -0,0 +1,34 @@ +extern void *memset (void *, int, unsigned long); +extern void abort (void); + +struct reg_stat { + void *last_death; + void *last_set; + void *last_set_value; + int last_set_label; + char last_set_sign_bit_copies; + int last_set_mode : 8; + char last_set_invalid; + char sign_bit_copies; + long nonzero_bits; +}; + +static struct reg_stat *reg_stat; + +void __attribute__((noinline)) +init_reg_last (void) +{ + memset (reg_stat, 0, __builtin_offsetof (struct reg_stat, sign_bit_copies)); +} + +int main (void) +{ + struct reg_stat r; + + reg_stat = &r; + r.nonzero_bits = -1; + init_reg_last (); + if (r.nonzero_bits != -1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr31072.c b/gcc/testsuite/gcc.c-torture/execute/pr31072.c new file mode 100644 index 000000000..beb4b558e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr31072.c @@ -0,0 +1,10 @@ +extern volatile int ReadyFlag_NotProperlyInitialized; + +volatile int ReadyFlag_NotProperlyInitialized=1; + +int main(void) +{ + if (ReadyFlag_NotProperlyInitialized != 1) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr31136.c b/gcc/testsuite/gcc.c-torture/execute/pr31136.c new file mode 100644 index 000000000..66c202c8f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr31136.c @@ -0,0 +1,17 @@ +extern void abort (void); + +struct S { + unsigned b4:4; + unsigned b6:6; +} s; + +int main() +{ + s.b6 = 31; + s.b4 = s.b6; + s.b6 = s.b4; + if (s.b6 != 15) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr31169.c b/gcc/testsuite/gcc.c-torture/execute/pr31169.c new file mode 100644 index 000000000..447dd4588 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr31169.c @@ -0,0 +1,51 @@ +extern void abort(); + +#define HOST_WIDE_INT long +#define HOST_BITS_PER_WIDE_INT (sizeof(long)*8) + +struct tree_type +{ + unsigned int precision : 9; +}; + +int +sign_bit_p (struct tree_type *t, HOST_WIDE_INT val_hi, unsigned HOST_WIDE_INT val_lo) +{ + unsigned HOST_WIDE_INT mask_lo, lo; + HOST_WIDE_INT mask_hi, hi; + int width = t->precision; + + if (width > HOST_BITS_PER_WIDE_INT) + { + hi = (unsigned HOST_WIDE_INT) 1 << (width - HOST_BITS_PER_WIDE_INT - 1); + lo = 0; + + mask_hi = ((unsigned HOST_WIDE_INT) -1 + >> (2 * HOST_BITS_PER_WIDE_INT - width)); + mask_lo = -1; + } + else + { + hi = 0; + lo = (unsigned HOST_WIDE_INT) 1 << (width - 1); + + mask_hi = 0; + mask_lo = ((unsigned HOST_WIDE_INT) -1 + >> (HOST_BITS_PER_WIDE_INT - width)); + } + + if ((val_hi & mask_hi) == hi + && (val_lo & mask_lo) == lo) + return 1; + + return 0; +} + +int main() +{ + struct tree_type t; + t.precision = 1; + if (!sign_bit_p (&t, 0, -1)) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr31448-2.c b/gcc/testsuite/gcc.c-torture/execute/pr31448-2.c new file mode 100644 index 000000000..ad920c9d0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr31448-2.c @@ -0,0 +1,36 @@ +/* PR middle-end/31448, this used to ICE during expand because + reduce_to_bit_field_precision was not ready to handle constants. */ + +typedef struct _st { + long int iIndex : 24; + long int iIndex1 : 24; +} st; +st *next; +void g(void) +{ + st *next = 0; + int nIndx; + const static int constreg[] = { 0,}; + nIndx = 0; + next->iIndex = constreg[nIndx]; +} +void f(void) +{ + int nIndx; + const static long int constreg[] = { 0xFEFEFEFE,}; + nIndx = 0; + next->iIndex = constreg[nIndx]; + next->iIndex1 = constreg[nIndx]; +} +int main(void) +{ + st a; + next = &a; + f(); + if (next->iIndex != 0xFFFEFEFE) + __builtin_abort (); + if (next->iIndex1 != 0xFFFEFEFE) + __builtin_abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr31448.c b/gcc/testsuite/gcc.c-torture/execute/pr31448.c new file mode 100644 index 000000000..720ba926e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr31448.c @@ -0,0 +1,36 @@ +/* PR middle-end/31448, this used to ICE during expand because + reduce_to_bit_field_precision was not ready to handle constants. */ + +typedef struct _st { + int iIndex : 24; + int iIndex1 : 24; +} st; +st *next; +void g(void) +{ + st *next = 0; + int nIndx; + const static int constreg[] = { 0,}; + nIndx = 0; + next->iIndex = constreg[nIndx]; +} +void f(void) +{ + int nIndx; + const static int constreg[] = { 0xFEFEFEFE,}; + nIndx = 0; + next->iIndex = constreg[nIndx]; + next->iIndex1 = constreg[nIndx]; +} +int main(void) +{ + st a; + next = &a; + f(); + if (next->iIndex != 0xFFFEFEFE) + __builtin_abort (); + if (next->iIndex1 != 0xFFFEFEFE) + __builtin_abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr31448.x b/gcc/testsuite/gcc.c-torture/execute/pr31448.x new file mode 100644 index 000000000..4efed4c32 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr31448.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_int32plus] } { + return 0 +} + +return 1; diff --git a/gcc/testsuite/gcc.c-torture/execute/pr31605.c b/gcc/testsuite/gcc.c-torture/execute/pr31605.c new file mode 100644 index 000000000..12a57ac1e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr31605.c @@ -0,0 +1,13 @@ +void put_field (unsigned int start, unsigned int len) +{ + int cur_bitshift = ((start + len) % 8) - 8; + if (cur_bitshift > -8) + exit (0); +} + +int +main () +{ + put_field (0, 1); + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr32244-1.c b/gcc/testsuite/gcc.c-torture/execute/pr32244-1.c new file mode 100644 index 000000000..afad25650 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr32244-1.c @@ -0,0 +1,20 @@ +struct foo +{ + unsigned long long b:40; +} x; + +extern void abort (void); + +void test1(unsigned long long res) +{ + /* The shift is carried out in 40 bit precision. */ + if (x.b<<32 != res) + abort (); +} + +int main() +{ + x.b = 0x0100; + test1(0); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr32500.c b/gcc/testsuite/gcc.c-torture/execute/pr32500.c new file mode 100644 index 000000000..41c455e45 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr32500.c @@ -0,0 +1,26 @@ +extern void abort(void); +extern void exit(int); +void foo(int) __attribute__((noinline)); +void bar(void) __attribute__((noinline)); + +/* Make sure foo is not inlined or considered pure/const. */ +int x; +void foo(int i) { x = i; } +void bar(void) { exit(0); } + +int +main(int argc, char *argv[]) +{ + int i; + int numbers[4] = { 0xdead, 0xbeef, 0x1337, 0x4242 }; + + for (i = 1; i <= 12; i++) { + if (i <= 4) + foo(numbers[i-1]); + else if (i >= 7 && i <= 9) + bar(); + } + + abort(); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr33142.c b/gcc/testsuite/gcc.c-torture/execute/pr33142.c new file mode 100644 index 000000000..7bfc5b584 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr33142.c @@ -0,0 +1,16 @@ +int abs(int j); +extern void abort(void); + +__attribute__((noinline)) int lisp_atan2(long dy, long dx) { + if (dx <= 0) + if (dy > 0) + return abs(dx) <= abs(dy); + return 0; +} + +int main() { + volatile long dy = 63, dx = -77; + if (lisp_atan2(dy, dx)) + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr33382.c b/gcc/testsuite/gcc.c-torture/execute/pr33382.c new file mode 100644 index 000000000..ee539643a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr33382.c @@ -0,0 +1,21 @@ +struct Foo { + int i; + int j[]; +}; + +struct Foo x = { 1, { 2, 0, 2, 3 } }; + +int foo(void) +{ + x.j[0] = 1; + return x.j[1]; +} + +extern void abort(void); + +int main() +{ + if (foo() != 0) + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr33631.c b/gcc/testsuite/gcc.c-torture/execute/pr33631.c new file mode 100644 index 000000000..840fd0dc4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr33631.c @@ -0,0 +1,14 @@ +typedef union +{ + int __lock; +} pthread_mutex_t; + +extern void abort (void); + +int main() +{ + struct { int c; pthread_mutex_t m; } r = { .m = 0 }; + if (r.c != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr33669.c b/gcc/testsuite/gcc.c-torture/execute/pr33669.c new file mode 100644 index 000000000..69d86258d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr33669.c @@ -0,0 +1,40 @@ +extern void abort (void); + +typedef struct foo_t +{ + unsigned int blksz; + unsigned int bf_cnt; +} foo_t; + +#define _RNDUP(x, unit) ((((x) + (unit) - 1) / (unit)) * (unit)) +#define _RNDDOWN(x, unit) ((x) - ((x)%(unit))) + +long long +foo (foo_t *const pxp, long long offset, unsigned int extent) +{ + long long blkoffset = _RNDDOWN(offset, (long long )pxp->blksz); + unsigned int diff = (unsigned int)(offset - blkoffset); + unsigned int blkextent = _RNDUP(diff + extent, pxp->blksz); + + if (pxp->blksz < blkextent) + return -1LL; + + if (pxp->bf_cnt > pxp->blksz) + pxp->bf_cnt = pxp->blksz; + + return blkoffset; +} + +int +main () +{ + foo_t x; + long long xx; + + x.blksz = 8192; + x.bf_cnt = 0; + xx = foo (&x, 0, 4096); + if (xx != 0LL) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr33779-1.c b/gcc/testsuite/gcc.c-torture/execute/pr33779-1.c new file mode 100644 index 000000000..da08e013a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr33779-1.c @@ -0,0 +1,14 @@ +int foo(int i) +{ + if (((unsigned)(i + 1)) * 4 == 0) + return 1; + return 0; +} + +extern void abort(void); +int main() +{ + if (foo(0x3fffffff) == 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr33779-2.c b/gcc/testsuite/gcc.c-torture/execute/pr33779-2.c new file mode 100644 index 000000000..16c34b63c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr33779-2.c @@ -0,0 +1,12 @@ +int foo(int i) +{ + return ((int)((unsigned)(i + 1) * 4)) / 4; +} + +extern void abort(void); +int main() +{ + if (foo(0x3fffffff) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr33870-1.c b/gcc/testsuite/gcc.c-torture/execute/pr33870-1.c new file mode 100644 index 000000000..af5a40db6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr33870-1.c @@ -0,0 +1,94 @@ +extern void abort (void); + +typedef struct PgHdr PgHdr; +typedef unsigned char u8; +struct PgHdr { +int y; +struct { + unsigned int pgno; + PgHdr *pNextHash, *pPrevHash; + PgHdr *pNextFree, *pPrevFree; + PgHdr *pNextAll; + u8 inJournal; + short int nRef; + PgHdr *pDirty, *pPrevDirty; + unsigned int notUsed; +} x; +}; +PgHdr **xx; +volatile int vx; +static inline PgHdr *merge_pagelist(PgHdr *pA, PgHdr *pB) +{ + PgHdr result; + PgHdr *pTail; + xx = &result.x.pDirty; + pTail = &result; + while( pA && pB ){ + if( pA->x.pgnox.pgno ){ + pTail->x.pDirty = pA; + pTail = pA; + pA = pA->x.pDirty; + }else{ + pTail->x.pDirty = pB; + pTail = pB; + pB = pB->x.pDirty; + } + vx = (*xx)->y; + } + if( pA ){ + pTail->x.pDirty = pA; + }else if( pB ){ + pTail->x.pDirty = pB; + }else{ + pTail->x.pDirty = 0; + } + return result.x.pDirty; +} + +PgHdr * __attribute__((noinline)) sort_pagelist(PgHdr *pIn) +{ + PgHdr *a[25], *p; + int i; + __builtin_memset (a, 0, sizeof (a)); + while( pIn ){ + p = pIn; + pIn = p->x.pDirty; + p->x.pDirty = 0; + for(i=0; i<25 -1; i++){ + if( a[i]==0 ){ + a[i] = p; + break; + }else{ + p = merge_pagelist(a[i], p); + a[i] = 0; + a[i] = 0; + } + } + if( i==25 -1 ){ + a[i] = merge_pagelist(a[i], p); + } + } + p = a[0]; + for(i=1; i<25; i++){ + p = merge_pagelist (p, a[i]); + } + return p; +} + +int main() +{ + PgHdr a[5]; + PgHdr *p; + a[0].x.pgno = 5; + a[0].x.pDirty = &a[1]; + a[1].x.pgno = 4; + a[1].x.pDirty = &a[2]; + a[2].x.pgno = 1; + a[2].x.pDirty = &a[3]; + a[3].x.pgno = 3; + a[3].x.pDirty = 0; + p = sort_pagelist (&a[0]); + if (p->x.pDirty == p) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr33870.c b/gcc/testsuite/gcc.c-torture/execute/pr33870.c new file mode 100644 index 000000000..9189b4a90 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr33870.c @@ -0,0 +1,87 @@ +extern void abort (void); + +typedef struct PgHdr PgHdr; +typedef unsigned char u8; +struct PgHdr { + unsigned int pgno; + PgHdr *pNextHash, *pPrevHash; + PgHdr *pNextFree, *pPrevFree; + PgHdr *pNextAll; + u8 inJournal; + short int nRef; + PgHdr *pDirty, *pPrevDirty; + unsigned int notUsed; +}; + +static inline PgHdr *merge_pagelist(PgHdr *pA, PgHdr *pB) +{ + PgHdr result; + PgHdr *pTail; + pTail = &result; + while( pA && pB ){ + if( pA->pgnopgno ){ + pTail->pDirty = pA; + pTail = pA; + pA = pA->pDirty; + }else{ + pTail->pDirty = pB; + pTail = pB; + pB = pB->pDirty; + } + } + if( pA ){ + pTail->pDirty = pA; + }else if( pB ){ + pTail->pDirty = pB; + }else{ + pTail->pDirty = 0; + } + return result.pDirty; +} + +PgHdr * __attribute__((noinline)) sort_pagelist(PgHdr *pIn) +{ + PgHdr *a[25], *p; + int i; + __builtin_memset (a, 0, sizeof (a)); + while( pIn ){ + p = pIn; + pIn = p->pDirty; + p->pDirty = 0; + for(i=0; i<25 -1; i++){ + if( a[i]==0 ){ + a[i] = p; + break; + }else{ + p = merge_pagelist(a[i], p); + a[i] = 0; + } + } + if( i==25 -1 ){ + a[i] = merge_pagelist(a[i], p); + } + } + p = a[0]; + for(i=1; i<25; i++){ + p = merge_pagelist (p, a[i]); + } + return p; +} + +int main() +{ + PgHdr a[5]; + PgHdr *p; + a[0].pgno = 5; + a[0].pDirty = &a[1]; + a[1].pgno = 4; + a[1].pDirty = &a[2]; + a[2].pgno = 1; + a[2].pDirty = &a[3]; + a[3].pgno = 3; + a[3].pDirty = 0; + p = sort_pagelist (&a[0]); + if (p->pDirty == p) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr33992.c b/gcc/testsuite/gcc.c-torture/execute/pr33992.c new file mode 100644 index 000000000..743361061 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr33992.c @@ -0,0 +1,37 @@ +extern void abort (); + +void __attribute__((noinline)) +bar (unsigned long long i) +{ + if (i) + abort (); +} + +void __attribute__((always_inline)) +foo (unsigned long long *r) +{ + int i; + + for (i = 0; ; i++) + if (*r & ((unsigned long long)1 << (63 - i))) + break; + + bar (i); +} + +void __attribute__((noinline)) +do_test (unsigned long long *r) +{ + int i; + + for (i = 0; i < 2; ++i) + foo (r); +} + +int main() +{ + unsigned long long r = 0x8000000000000001ull; + + do_test (&r); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr34070-1.c b/gcc/testsuite/gcc.c-torture/execute/pr34070-1.c new file mode 100644 index 000000000..6589bb0c0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr34070-1.c @@ -0,0 +1,13 @@ +extern void abort (void); + +int f(unsigned int x) +{ + return ((int)x) % 4; +} + +int main() +{ + if (f(-1) != -1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr34070-2.c b/gcc/testsuite/gcc.c-torture/execute/pr34070-2.c new file mode 100644 index 000000000..4c1ce7b02 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr34070-2.c @@ -0,0 +1,13 @@ +extern void abort (void); + +int f(unsigned int x, int n) +{ + return ((int)x) / (1 << n); +} + +int main() +{ + if (f(-1, 1) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr34099-2.c b/gcc/testsuite/gcc.c-torture/execute/pr34099-2.c new file mode 100644 index 000000000..d335673e3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr34099-2.c @@ -0,0 +1,47 @@ +int test1 (int b, int c) +{ + char x; + if (b) + return x / c; + else + return 1; +} +int test2 (int b, int c) +{ + int x; + if (b) + return x * c; + else + return 1; +} +int test3 (int b, int c) +{ + int x; + if (b) + return x % c; + else + return 1; +} +int test4 (int b, int c) +{ + char x; + if (b) + return x == c; + else + return 1; +} + +extern void abort (void); +int main() +{ + if (test1(1, 1000) != 0) + abort (); + if (test2(1, 0) != 0) + abort (); + if (test3(1, 1) != 0) + abort (); + if (test4(1, 1000) != 0) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr34099.c b/gcc/testsuite/gcc.c-torture/execute/pr34099.c new file mode 100644 index 000000000..d6f5ad1f6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr34099.c @@ -0,0 +1,16 @@ +int foo (int b, int c) +{ + int x; + if (b) + return x & c; + else + return 1; +} +extern void abort (void); +int main() +{ + if (foo(1, 0) != 0) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr34130.c b/gcc/testsuite/gcc.c-torture/execute/pr34130.c new file mode 100644 index 000000000..b528ff22b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr34130.c @@ -0,0 +1,12 @@ +extern void abort (void); +int foo (int i) +{ + return -2 * __builtin_abs(i - 2); +} +int main() +{ + if (foo(1) != -2 + || foo(3) != -2) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr34154.c b/gcc/testsuite/gcc.c-torture/execute/pr34154.c new file mode 100644 index 000000000..cd7bfc6b0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr34154.c @@ -0,0 +1,16 @@ +int foo( unsigned long long aLL ) +{ + switch( aLL ) + { + case 1000000000000000000ULL ... 9999999999999999999ULL : return 19 ; + default : return 20 ; + }; +}; +extern void abort (void); +int main() +{ + unsigned long long aLL = 1000000000000000000ULL; + if (foo (aLL) != 19) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr34176.c b/gcc/testsuite/gcc.c-torture/execute/pr34176.c new file mode 100644 index 000000000..3bbdb22c7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr34176.c @@ -0,0 +1,68 @@ + +typedef __SIZE_TYPE__ size_t; +typedef unsigned int index_ty; +typedef index_ty *index_list_ty; + +struct mult_index +{ + index_ty index; + unsigned int count; +}; + +struct mult_index_list +{ + struct mult_index *item; + size_t nitems; + size_t nitems_max; + + struct mult_index *item2; + size_t nitems2_max; +}; + +int __attribute__((noinline)) +hash_find_entry (size_t *result) +{ + *result = 2; + return 0; +} + +extern void abort (void); +struct mult_index * __attribute__((noinline)) +foo (size_t n) +{ + static count = 0; + if (count++ > 0) + abort (); + return 0; +} + +int +main (void) +{ + size_t nitems = 0; + + for (;;) + { + size_t list; + + hash_find_entry (&list); + { + size_t len2 = list; + struct mult_index *destptr; + struct mult_index *dest; + size_t new_max = nitems + len2; + + if (new_max != len2) + break; + dest = foo (new_max); + + destptr = dest; + while (len2--) + destptr++; + + nitems = destptr - dest; + } + } + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr34415.c b/gcc/testsuite/gcc.c-torture/execute/pr34415.c new file mode 100644 index 000000000..ec75394af --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr34415.c @@ -0,0 +1,34 @@ +const char *__attribute__((noinline)) +foo (const char *p) +{ + const char *end; + int len = 1; + for (;;) + { + int c = *p; + c = (c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c); + if (c == 'B') + end = p; + else if (c == 'A') + { + end = p; + do + p++; + while (*p == '+'); + } + else + break; + p++; + len++; + } + if (len > 2 && *p == ':') + p = end; + return p; +} + +int +main (void) +{ + const char *input = "Bbb:"; + return foo (input) != input + 2; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr34456.c b/gcc/testsuite/gcc.c-torture/execute/pr34456.c new file mode 100644 index 000000000..526c954e5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr34456.c @@ -0,0 +1,30 @@ +#include + +int __attribute__ ((noinline)) debug (void) { return 1; } +int errors; + +struct s { int elt; int (*compare) (int); }; + +static int +compare (const void *x, const void *y) +{ + const struct s *s1 = x, *s2 = y; + int (*compare1) (int); + int elt2; + + compare1 = s1->compare; + elt2 = s2->elt; + if (elt2 != 0 && debug () && compare1 (s1->elt) != 0) + errors++; + return compare1 (elt2); +} + +int bad_compare (int x) { return -x; } +struct s array[2] = { { 1, bad_compare }, { -1, bad_compare } }; + +int +main (void) +{ + qsort (array, 2, sizeof (struct s), compare); + return errors == 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr34768-1.c b/gcc/testsuite/gcc.c-torture/execute/pr34768-1.c new file mode 100644 index 000000000..eb16adbf1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr34768-1.c @@ -0,0 +1,26 @@ +int x; + +void __attribute__((noinline)) foo (void) +{ + x = -x; +} +void __attribute__((const,noinline)) bar (void) +{ +} + +int __attribute__((noinline)) +test (int c) +{ + int tmp = x; + (c ? foo : bar) (); + return tmp + x; +} + +extern void abort (void); +int main() +{ + x = 1; + if (test (1) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr34768-2.c b/gcc/testsuite/gcc.c-torture/execute/pr34768-2.c new file mode 100644 index 000000000..917bf9e2b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr34768-2.c @@ -0,0 +1,28 @@ +int x; + +int __attribute__((noinline)) foo (void) +{ + x = -x; + return 0; +} +int __attribute__((const,noinline)) bar (void) +{ + return 0; +} + +int __attribute__((noinline)) +test (int c) +{ + int tmp = x; + int res = (c ? foo : bar) (); + return tmp + x + res; +} + +extern void abort (void); +int main() +{ + x = 1; + if (test (1) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr34971.c b/gcc/testsuite/gcc.c-torture/execute/pr34971.c new file mode 100644 index 000000000..3299aee22 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr34971.c @@ -0,0 +1,22 @@ +struct foo +{ + unsigned long long b:40; +} x; + +extern void abort (void); + +void test1(unsigned long long res) +{ + /* Build a rotate expression on a 40 bit argument. */ + if ((x.b<<8) + (x.b>>32) != res) + abort (); +} + +int main() +{ + x.b = 0x0100000001; + test1(0x0000000101); + x.b = 0x0100000000; + test1(0x0000000001); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr34982.c b/gcc/testsuite/gcc.c-torture/execute/pr34982.c new file mode 100644 index 000000000..1500847d0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr34982.c @@ -0,0 +1,15 @@ +extern void abort (void); + +static void something(); + +int main() +{ + something(-1); + return 0; +} + +static void something(int i) +{ + if (i != -1) + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr35163.c b/gcc/testsuite/gcc.c-torture/execute/pr35163.c new file mode 100644 index 000000000..93b180d5d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr35163.c @@ -0,0 +1,15 @@ +extern void abort(void); + +int main() +{ + signed char a = -30; + signed char b = -31; + #if(__SIZEOF_INT__ >= 4) + if (a > (unsigned short)b) +#else + if ((long) a > (unsigned short)b) +#endif + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr35231.c b/gcc/testsuite/gcc.c-torture/execute/pr35231.c new file mode 100644 index 000000000..e0327eb5f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr35231.c @@ -0,0 +1,16 @@ +extern void abort(void); + +int __attribute__((noinline)) +foo(int bits_per_pixel, int depth) +{ + if ((bits_per_pixel | depth) == 1) + abort (); + return bits_per_pixel; +} + +int main() +{ + if (foo(2, 0) != 2) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr35390.c b/gcc/testsuite/gcc.c-torture/execute/pr35390.c new file mode 100644 index 000000000..7103a9b54 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr35390.c @@ -0,0 +1,13 @@ +extern void abort (void); + +unsigned int foo (int n) +{ + return ~((unsigned int)~n); +} + +int main() +{ + if (foo(0) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr35456.c b/gcc/testsuite/gcc.c-torture/execute/pr35456.c new file mode 100644 index 000000000..175a0b2ab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr35456.c @@ -0,0 +1,21 @@ +extern void abort (void); + +double +__attribute__ ((noinline)) +not_fabs (double x) +{ + return x >= 0.0 ? x : -x; +} + +int main() +{ + double x = -0.0; + double y; + + y = not_fabs (x); + + if (!__builtin_signbit (y)) + abort(); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr35456.x b/gcc/testsuite/gcc.c-torture/execute/pr35456.x new file mode 100644 index 000000000..73b18fb74 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr35456.x @@ -0,0 +1,3 @@ +# VAX does not support signed zero. +if [istarget "vax-*-*"] { return 1 } +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr35472.c b/gcc/testsuite/gcc.c-torture/execute/pr35472.c new file mode 100644 index 000000000..c8678e268 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr35472.c @@ -0,0 +1,22 @@ +extern void abort (void); +extern void *memset (void *s, int c, __SIZE_TYPE__ n); +struct S { int i[16]; }; +struct S *p; +void __attribute__((noinline)) +foo(struct S *a, struct S *b) { a->i[0] = -1; p = b; } +void test (void) +{ + struct S a, b; + memset (&a.i[0], '\0', sizeof (a.i)); + memset (&b.i[0], '\0', sizeof (b.i)); + foo (&a, &b); + *p = a; + *p = b; + if (b.i[0] != -1) + abort (); +} +int main() +{ + test(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr35800.c b/gcc/testsuite/gcc.c-torture/execute/pr35800.c new file mode 100644 index 000000000..22b36f0b3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr35800.c @@ -0,0 +1,103 @@ +extern void abort (void); + +int stab_xcoff_builtin_type (int typenum) +{ + const char *name; + if (typenum >= 0 || typenum < -34) + { + return 0; + } + switch (-typenum) + { + case 1: + name = "int"; + break; + case 2: + name = "char"; + case 3: + name = "short"; + break; + case 4: + name = "long"; + case 5: + name = "unsigned char"; + case 6: + name = "signed char"; + case 7: + name = "unsigned short"; + case 8: + name = "unsigned int"; + case 9: + name = "unsigned"; + case 10: + name = "unsigned long"; + case 11: + name = "void"; + case 12: + name = "float"; + case 13: + name = "double"; + case 14: + name = "long double"; + case 15: + name = "integer"; + case 16: + name = "boolean"; + case 17: + name = "short real"; + case 18: + name = "real"; + case 19: + name = "stringptr"; + case 20: + name = "character"; + case 21: + name = "logical*1"; + case 22: + name = "logical*2"; + case 23: + name = "logical*4"; + case 24: + name = "logical"; + case 25: + name = "complex"; + case 26: + name = "double complex"; + case 27: + name = "integer*1"; + case 28: + name = "integer*2"; + case 29: + name = "integer*4"; + case 30: + name = "wchar"; + case 31: + name = "long long"; + case 32: + name = "unsigned long long"; + case 33: + name = "logical*8"; + case 34: + name = "integer*8"; + } + return name[0]; +} + +int main() +{ + int i; + if (stab_xcoff_builtin_type(0) != 0) + abort (); + if (stab_xcoff_builtin_type(-1) != 'i') + abort (); + if (stab_xcoff_builtin_type(-2) != 's') + abort (); + if (stab_xcoff_builtin_type(-3) != 's') + abort (); + for (i = -4; i >= -34; --i) + if (stab_xcoff_builtin_type(i) != 'i') + abort (); + if (stab_xcoff_builtin_type(-35) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr36034-1.c b/gcc/testsuite/gcc.c-torture/execute/pr36034-1.c new file mode 100644 index 000000000..eddec57cd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr36034-1.c @@ -0,0 +1,32 @@ +double x[5][10] = { { 10, 11, 12, 13, 14, 15, -1, -1, -1, -1 }, + { 21, 22, 23, 24, 25, 26, -1, -1, -1, -1 }, + { 32, 33, 34, 35, 36, 37, -1, -1, -1, -1 }, + { 43, 44, 45, 46, 47, 48, -1, -1, -1, -1 }, + { 54, 55, 56, 57, 58, 59, -1, -1, -1, -1 } }; +double tmp[5][6]; + +void __attribute__((noinline)) +test (void) +{ + int i, j; + for (i = 0; i < 5; ++i) + { + tmp[i][0] = x[i][0]; + tmp[i][1] = x[i][1]; + tmp[i][2] = x[i][2]; + tmp[i][3] = x[i][3]; + tmp[i][4] = x[i][4]; + tmp[i][5] = x[i][5]; + } +} +extern void abort (void); +int main() +{ + int i, j; + test(); + for (i = 0; i < 5; ++i) + for (j = 0; j < 6; ++j) + if (tmp[i][j] == -1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr36034-2.c b/gcc/testsuite/gcc.c-torture/execute/pr36034-2.c new file mode 100644 index 000000000..10abb791b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr36034-2.c @@ -0,0 +1,32 @@ +double x[50] = { 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, + 21, 22, 23, 24, 25, 26, -1, -1, -1, -1, + 32, 33, 34, 35, 36, 37, -1, -1, -1, -1, + 43, 44, 45, 46, 47, 48, -1, -1, -1, -1, + 54, 55, 56, 57, 58, 59, -1, -1, -1, -1 }; +double tmp[30]; + +void __attribute__((noinline)) +test (void) +{ + int i, j; + for (i = 0; i < 5; ++i) + { + tmp[i*6] = x[i*10]; + tmp[i*6+1] = x[i*10+1]; + tmp[i*6+2] = x[i*10+2]; + tmp[i*6+3] = x[i*10+3]; + tmp[i*6+4] = x[i*10+4]; + tmp[i*6+5] = x[i*10+5]; + } +} +extern void abort (void); +int main() +{ + int i, j; + test(); + for (i = 0; i < 5; ++i) + for (j = 0; j < 6; ++j) + if (tmp[i*6+j] == -1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr36038.c b/gcc/testsuite/gcc.c-torture/execute/pr36038.c new file mode 100644 index 000000000..de4bef3d4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr36038.c @@ -0,0 +1,43 @@ +/* PR tree-optimization/36038 */ + +long long list[10]; +long long expect[10] = { 0, 1, 2, 3, 4, 4, 5, 6, 7, 9 }; +long long *stack_base; +int indices[10]; +int *markstack_ptr; + +void +doit (void) +{ + long long *src; + long long *dst; + long long *sp = stack_base + 5; + int diff = 2; + int shift; + int count; + + shift = diff - (markstack_ptr[-1] - markstack_ptr[-2]); + count = (sp - stack_base) - markstack_ptr[-1] + 2; + src = sp; + dst = (sp += shift); + while (--count) + *dst-- = *src--; +} + +int +main () +{ + int i; + for (i = 0; i < 10; i++) + list[i] = i; + + markstack_ptr = indices + 9; + markstack_ptr[-1] = 2; + markstack_ptr[-2] = 1; + + stack_base = list + 2; + doit (); + if (__builtin_memcmp (expect, list, sizeof (list))) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr36077.c b/gcc/testsuite/gcc.c-torture/execute/pr36077.c new file mode 100644 index 000000000..09636a102 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr36077.c @@ -0,0 +1,13 @@ +extern void abort (void); + +unsigned int test (unsigned int x) +{ + return x / 0x80000001U / 0x00000002U; +} + +int main() +{ + if (test(2) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr36093.c b/gcc/testsuite/gcc.c-torture/execute/pr36093.c new file mode 100644 index 000000000..9549bc306 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr36093.c @@ -0,0 +1,28 @@ +extern void abort (void); + +typedef struct Bar { + char c[129]; +} Bar __attribute__((__aligned__(128))); + +typedef struct Foo { + Bar bar[4]; +} Foo; + +Foo foo[4]; + +int main() +{ + int i, j; + Foo *foop = &foo[0]; + + for (i=0; i < 4; i++) { + Bar *bar = &foop->bar[i]; + for (j=0; j < 129; j++) { + bar->c[j] = 'a' + i; + } + } + + if (foo[0].bar[3].c[128] != 'd') + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr36321.c b/gcc/testsuite/gcc.c-torture/execute/pr36321.c new file mode 100644 index 000000000..1edf8e415 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr36321.c @@ -0,0 +1,26 @@ +extern void abort (void); + +extern __SIZE_TYPE__ strlen (const char *); +void foo(char *str) +{ + int len2 = strlen (str); + char *a = (char *) __builtin_alloca (0); + char *b = (char *) __builtin_alloca (len2*3); + + if ((int) (a-b) < (len2*3)) + { +#ifdef _WIN32 + abort (); +#endif + return; + } +} + +static char * volatile argp = "pr36321.x"; + +int main(int argc, char **argv) +{ + foo (argp); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr36339.c b/gcc/testsuite/gcc.c-torture/execute/pr36339.c new file mode 100644 index 000000000..c4f36ddca --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr36339.c @@ -0,0 +1,32 @@ +extern void abort (void); + +typedef unsigned long my_uintptr_t; + +int check_a(my_uintptr_t tagged_ptr); + +int __attribute__((noinline)) try_a(my_uintptr_t x) +{ + my_uintptr_t heap[2]; + my_uintptr_t *hp = heap; + + hp[0] = x; + hp[1] = 0; + return check_a((my_uintptr_t)(void*)((char*)hp + 1)); +} + +int __attribute__((noinline)) check_a(my_uintptr_t tagged_ptr) +{ + my_uintptr_t *hp = (my_uintptr_t*)(void*)((char*)tagged_ptr - 1); + + if (hp[0] == 42 && hp[1] == 0) + return 0; + return -1; +} + +int main(void) +{ + if (try_a(42) < 0) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr36343.c b/gcc/testsuite/gcc.c-torture/execute/pr36343.c new file mode 100644 index 000000000..44b9fb340 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr36343.c @@ -0,0 +1,32 @@ +extern void abort (void); + +void __attribute__((noinline)) +bar (int **p) +{ + float *q = (float *)p; + *q = 0.0; +} + +float __attribute__((noinline)) +foo (int b) +{ + int *i = 0; + float f = 1.0; + int **p; + if (b) + p = &i; + else + p = (int **)&f; + bar (p); + if (b) + return **p; + return f; +} + +int main() +{ + if (foo(0) != 0.0) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr36691.c b/gcc/testsuite/gcc.c-torture/execute/pr36691.c new file mode 100644 index 000000000..81fe6fd55 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr36691.c @@ -0,0 +1,17 @@ +unsigned char g_5; + +void func_1 (void) +{ + for (g_5 = 9; g_5 >= 4; g_5 -= 5) + ; +} + +extern void abort (void); +int main (void) +{ + func_1 (); + if (g_5 != 0) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr36765.c b/gcc/testsuite/gcc.c-torture/execute/pr36765.c new file mode 100644 index 000000000..6883b0cfd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr36765.c @@ -0,0 +1,15 @@ +int __attribute__((noinline)) +foo(int i) +{ + int *p = __builtin_malloc (4 * sizeof(int)); + *p = 0; + p[i] = 1; + return *p; +} +extern void abort (void); +int main() +{ + if (foo(0) != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr37102.c b/gcc/testsuite/gcc.c-torture/execute/pr37102.c new file mode 100644 index 000000000..32c18ba88 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr37102.c @@ -0,0 +1,25 @@ +extern void abort (void); + +unsigned int a, b = 1, c; + +void __attribute__ ((noinline)) +foo (int x) +{ + if (x != 5) + abort (); +} + +int +main () +{ + unsigned int d, e; + for (d = 1; d < 5; d++) + if (c) + a = b; + a = b; + e = a << 1; + if (e) + e = (e << 1) ^ 1; + foo (e); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr37125.c b/gcc/testsuite/gcc.c-torture/execute/pr37125.c new file mode 100644 index 000000000..f29209eb7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr37125.c @@ -0,0 +1,23 @@ +extern void abort (void); + +static inline unsigned int +mod_rhs(int rhs) +{ + if (rhs == 0) return 1; + return rhs; +} + +void func_44 (unsigned int p_45); +void func_44 (unsigned int p_45) +{ + if (!((p_45 * -9) % mod_rhs (-9))) { + abort(); + } +} + +int main (void) +{ + func_44 (2); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr37573.c b/gcc/testsuite/gcc.c-torture/execute/pr37573.c new file mode 100644 index 000000000..589191035 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr37573.c @@ -0,0 +1,65 @@ +/* PR tree-optimization/37573 */ + +struct S +{ + unsigned int *a; + unsigned int b; + unsigned int c[624]; +}; + +static unsigned char __attribute__((noinline)) +foo (struct S *s) +{ + unsigned int r; + if (!--s->b) + { + unsigned int *c = s->c; + unsigned int i; + s->a = c; + for (i = 0; i < 227; i++) + c[i] = ((((c[i] ^ c[i + 1]) & 0x7ffffffe) ^ c[i]) >> 1) + ^ ((0 - (c[i + 1] & 1)) & 0x9908b0df) ^ c[i + 397]; + } + r = *(s->a++); + r ^= (r >> 11); + r ^= ((r & 0xff3a58ad) << 7); + r ^= ((r & 0xffffdf8c) << 15); + r ^= (r >> 18); + return (unsigned char) (r >> 1); +} + +static void __attribute__((noinline)) +bar (unsigned char *p, unsigned int q, unsigned int r) +{ + struct S s; + unsigned int i; + unsigned int *c = s.c; + *c = r; + for (i = 1; i < 624; i++) + c[i] = i + 0x6c078965 * ((c[i - 1] >> 30) ^ c[i - 1]); + s.b = 1; + while (q--) + *p++ ^= foo (&s); +}; + +static unsigned char p[23] = { + 0xc0, 0x49, 0x17, 0x32, 0x62, 0x1e, 0x2e, 0xd5, 0x4c, 0x19, 0x28, 0x49, + 0x91, 0xe4, 0x72, 0x83, 0x91, 0x3d, 0x93, 0x83, 0xb3, 0x61, 0x38 +}; + +static unsigned char q[23] = { + 0x3e, 0x41, 0x55, 0x54, 0x4f, 0x49, 0x54, 0x20, 0x55, 0x4e, 0x49, 0x43, + 0x4f, 0x44, 0x45, 0x20, 0x53, 0x43, 0x52, 0x49, 0x50, 0x54, 0x3c +}; + +int +main (void) +{ + unsigned int s; + s = 23; + bar (p, s, s + 0xa25e); + if (__builtin_memcmp (p, q, s) != 0) + __builtin_abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr37573.x b/gcc/testsuite/gcc.c-torture/execute/pr37573.x new file mode 100644 index 000000000..7378270cd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr37573.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_int16] } { + return 1 +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr37882.c b/gcc/testsuite/gcc.c-torture/execute/pr37882.c new file mode 100644 index 000000000..d90e1ee34 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr37882.c @@ -0,0 +1,15 @@ +/* PR middle-end/37882 */ + +struct S +{ + unsigned char b : 3; +} s; + +int +main () +{ + s.b = 4; + if (s.b > 0 && s.b < 4) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr37924.c b/gcc/testsuite/gcc.c-torture/execute/pr37924.c new file mode 100644 index 000000000..ec098ff55 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr37924.c @@ -0,0 +1,50 @@ +/* PR c/37924 */ + +extern void abort (void); + +signed char a; +unsigned char b; + +int +test1 (void) +{ + int c = -1; + return ((unsigned int) (a ^ c)) >> 9; +} + +int +test2 (void) +{ + int c = -1; + return ((unsigned int) (b ^ c)) >> 9; +} + +int +main (void) +{ + a = 0; + if (test1 () != (-1U >> 9)) + abort (); + a = 0x40; + if (test1 () != (-1U >> 9)) + abort (); + a = 0x80; + if (test1 () != (a < 0) ? 0 : (-1U >> 9)) + abort (); + a = 0xff; + if (test1 () != (a < 0) ? 0 : (-1U >> 9)) + abort (); + b = 0; + if (test2 () != (-1U >> 9)) + abort (); + b = 0x40; + if (test2 () != (-1U >> 9)) + abort (); + b = 0x80; + if (test2 () != (-1U >> 9)) + abort (); + b = 0xff; + if (test2 () != (-1U >> 9)) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr37931.c b/gcc/testsuite/gcc.c-torture/execute/pr37931.c new file mode 100644 index 000000000..0077a21ba --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr37931.c @@ -0,0 +1,23 @@ +/* PR middle-end/37931 */ + +extern void abort (void); + +int +foo (int a, unsigned int b) +{ + return (a | 1) & (b | 1); +} + +int +main (void) +{ + if (foo (6, 0xc6) != 7) + abort (); + if (foo (0x80, 0xc1) != 0x81) + abort (); + if (foo (4, 4) != 5) + abort (); + if (foo (5, 4) != 5) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr38048-1.c b/gcc/testsuite/gcc.c-torture/execute/pr38048-1.c new file mode 100644 index 000000000..b87363f64 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr38048-1.c @@ -0,0 +1,22 @@ +extern void abort(void); + +int foo () +{ + int mat[2][1]; + int (*a)[1] = mat; + int det = 0; + int i; + mat[0][0] = 1; + mat[1][0] = 2; + for (i = 0; i < 2; ++i) + det += a[i][0]; + return det; +} + +int main() +{ + if (foo () != 3) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr38048-2.c b/gcc/testsuite/gcc.c-torture/execute/pr38048-2.c new file mode 100644 index 000000000..f4fe40cac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr38048-2.c @@ -0,0 +1,28 @@ +extern void abort (void); + +static int inv_J(int a[][2]) +{ + int i, j; + int det = 0.0; + for (j=0; j<2; ++j) + det += a[j][0] + a[j][1]; + return det; +} + +int foo() +{ + int mat[2][2]; + mat[0][0] = 1; + mat[0][1] = 2; + mat[1][0] = 4; + mat[1][1] = 8; + return inv_J(mat); +} + +int main() +{ + if (foo () != 15) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr38051.c b/gcc/testsuite/gcc.c-torture/execute/pr38051.c new file mode 100644 index 000000000..e3b6dd99c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr38051.c @@ -0,0 +1,215 @@ +typedef __SIZE_TYPE__ size_t; +static int mymemcmp1 (unsigned long int, unsigned long int) + __attribute__ ((__nothrow__)); + +__inline static int +mymemcmp1 (unsigned long int a, unsigned long int b) +{ + long int srcp1 = (long int) &a; + long int srcp2 = (long int) &b; + unsigned long int a0, b0; + do + { + a0 = ((unsigned char *) srcp1)[0]; + b0 = ((unsigned char *) srcp2)[0]; + srcp1 += 1; + srcp2 += 1; + } + while (a0 == b0); + return a0 - b0; +} + +static int mymemcmp2 (long, long, size_t) __attribute__ ((__nothrow__)); + +static int +mymemcmp2 (long int srcp1, long int srcp2, size_t len) +{ + unsigned long int a0, a1; + unsigned long int b0, b1; + switch (len % 4) + { + default: + case 2: + a0 = ((unsigned long int *) srcp1)[0]; + b0 = ((unsigned long int *) srcp2)[0]; + srcp1 -= 2 * (sizeof (unsigned long int)); + srcp2 -= 2 * (sizeof (unsigned long int)); + len += 2; + goto do1; + case 3: + a1 = ((unsigned long int *) srcp1)[0]; + b1 = ((unsigned long int *) srcp2)[0]; + srcp1 -= (sizeof (unsigned long int)); + srcp2 -= (sizeof (unsigned long int)); + len += 1; + goto do2; + case 0: + if (16 <= 3 * (sizeof (unsigned long int)) && len == 0) + return 0; + a0 = ((unsigned long int *) srcp1)[0]; + b0 = ((unsigned long int *) srcp2)[0]; + goto do3; + case 1: + a1 = ((unsigned long int *) srcp1)[0]; + b1 = ((unsigned long int *) srcp2)[0]; + srcp1 += (sizeof (unsigned long int)); + srcp2 += (sizeof (unsigned long int)); + len -= 1; + if (16 <= 3 * (sizeof (unsigned long int)) && len == 0) + goto do0; + } + do + { + a0 = ((unsigned long int *) srcp1)[0]; + b0 = ((unsigned long int *) srcp2)[0]; + if (a1 != b1) + return mymemcmp1 ((a1), (b1)); + do3: + a1 = ((unsigned long int *) srcp1)[1]; + b1 = ((unsigned long int *) srcp2)[1]; + if (a0 != b0) + return mymemcmp1 ((a0), (b0)); + do2: + a0 = ((unsigned long int *) srcp1)[2]; + b0 = ((unsigned long int *) srcp2)[2]; + if (a1 != b1) + return mymemcmp1 ((a1), (b1)); + do1: + a1 = ((unsigned long int *) srcp1)[3]; + b1 = ((unsigned long int *) srcp2)[3]; + if (a0 != b0) + return mymemcmp1 ((a0), (b0)); + srcp1 += 4 * (sizeof (unsigned long int)); + srcp2 += 4 * (sizeof (unsigned long int)); + len -= 4; + } + while (len != 0); +do0: + if (a1 != b1) + return mymemcmp1 ((a1), (b1)); + return 0; +} + +static int mymemcmp3 (long, long, size_t) __attribute__ ((__nothrow__)); + +static int +mymemcmp3 (long int srcp1, long int srcp2, size_t len) +{ + unsigned long int a0, a1, a2, a3; + unsigned long int b0, b1, b2, b3; + unsigned long int x; + int shl, shr; + shl = 8 * (srcp1 % (sizeof (unsigned long int))); + shr = 8 * (sizeof (unsigned long int)) - shl; + srcp1 &= -(sizeof (unsigned long int)); + switch (len % 4) + { + default: + case 2: + a1 = ((unsigned long int *) srcp1)[0]; + a2 = ((unsigned long int *) srcp1)[1]; + b2 = ((unsigned long int *) srcp2)[0]; + srcp1 -= 1 * (sizeof (unsigned long int)); + srcp2 -= 2 * (sizeof (unsigned long int)); + len += 2; + goto do1; + case 3: + a0 = ((unsigned long int *) srcp1)[0]; + a1 = ((unsigned long int *) srcp1)[1]; + b1 = ((unsigned long int *) srcp2)[0]; + srcp2 -= 1 * (sizeof (unsigned long int)); + len += 1; + goto do2; + case 0: + if (16 <= 3 * (sizeof (unsigned long int)) && len == 0) + return 0; + a3 = ((unsigned long int *) srcp1)[0]; + a0 = ((unsigned long int *) srcp1)[1]; + b0 = ((unsigned long int *) srcp2)[0]; + srcp1 += 1 * (sizeof (unsigned long int)); + goto do3; + case 1: + a2 = ((unsigned long int *) srcp1)[0]; + a3 = ((unsigned long int *) srcp1)[1]; + b3 = ((unsigned long int *) srcp2)[0]; + srcp1 += 2 * (sizeof (unsigned long int)); + srcp2 += 1 * (sizeof (unsigned long int)); + len -= 1; + if (16 <= 3 * (sizeof (unsigned long int)) && len == 0) + goto do0; + } + do + { + a0 = ((unsigned long int *) srcp1)[0]; + b0 = ((unsigned long int *) srcp2)[0]; + x = (((a2) >> (shl)) | ((a3) << (shr))); + if (x != b3) + return mymemcmp1 ((x), (b3)); + do3: + a1 = ((unsigned long int *) srcp1)[1]; + b1 = ((unsigned long int *) srcp2)[1]; + x = (((a3) >> (shl)) | ((a0) << (shr))); + if (x != b0) + return mymemcmp1 ((x), (b0)); + do2: + a2 = ((unsigned long int *) srcp1)[2]; + b2 = ((unsigned long int *) srcp2)[2]; + x = (((a0) >> (shl)) | ((a1) << (shr))); + if (x != b1) + return mymemcmp1 ((x), (b1)); + do1: + a3 = ((unsigned long int *) srcp1)[3]; + b3 = ((unsigned long int *) srcp2)[3]; + x = (((a1) >> (shl)) | ((a2) << (shr))); + if (x != b2) + return mymemcmp1 ((x), (b2)); + srcp1 += 4 * (sizeof (unsigned long int)); + srcp2 += 4 * (sizeof (unsigned long int)); + len -= 4; + } + while (len != 0); +do0: + x = (((a2) >> (shl)) | ((a3) << (shr))); + if (x != b3) + return mymemcmp1 ((x), (b3)); + return 0; +} + +__attribute__ ((noinline)) +int mymemcmp (const void *s1, const void *s2, size_t len) +{ + unsigned long int a0; + unsigned long int b0; + long int srcp1 = (long int) s1; + long int srcp2 = (long int) s2; + if (srcp1 % (sizeof (unsigned long int)) == 0) + return mymemcmp2 (srcp1, srcp2, len / (sizeof (unsigned long int))); + else + return mymemcmp3 (srcp1, srcp2, len / (sizeof (unsigned long int))); +} + +char buf[256]; + +int +main (void) +{ + char *p; + union { long int l; char c[sizeof (long int)]; } u; + + /* The test above assumes little endian and long being the same size + as pointer. */ + if (sizeof (long int) != sizeof (void *) || sizeof (long int) < 4) + return 0; + u.l = 0x12345678L; + if (u.c[0] != 0x78 || u.c[1] != 0x56 || u.c[2] != 0x34 || u.c[3] != 0x12) + return 0; + + p = buf + 16 - (((long int) buf) & 15); + __builtin_memcpy (p + 9, +"\x1\x37\x82\xa7\x55\x49\x9d\xbf\xf8\x44\xb6\x55\x17\x8e\xf9", 15); + __builtin_memcpy (p + 128 + 24, +"\x1\x37\x82\xa7\x55\x49\xd0\xf3\xb7\x2a\x6d\x23\x71\x49\x6a", 15); + if (mymemcmp (p + 9, p + 128 + 24, 33) != -51) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr38151.c b/gcc/testsuite/gcc.c-torture/execute/pr38151.c new file mode 100644 index 000000000..113a255b1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr38151.c @@ -0,0 +1,46 @@ +void abort (void); + +struct S2848 +{ + unsigned int a; + _Complex int b; + struct + { + } __attribute__ ((aligned)) c; +}; + +struct S2848 s2848; + +int fails; + +void __attribute__((noinline)) +check2848va (int z, ...) +{ + struct S2848 arg; + __builtin_va_list ap; + + __builtin_va_start (ap, z); + + arg = __builtin_va_arg (ap, struct S2848); + + if (s2848.a != arg.a) + ++fails; + if (s2848.b != arg.b) + ++fails; + + __builtin_va_end (ap); +} + +int main (void) +{ + s2848.a = 4027477739U; + s2848.b = (723419448 + -218144346 * __extension__ 1i); + + check2848va (1, s2848); + + if (fails) + abort (); + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr38151.x b/gcc/testsuite/gcc.c-torture/execute/pr38151.x new file mode 100644 index 000000000..cb7b119b8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr38151.x @@ -0,0 +1,2 @@ +set additional_flags "-Wno-psabi" +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr38212.c b/gcc/testsuite/gcc.c-torture/execute/pr38212.c new file mode 100644 index 000000000..867d4c174 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr38212.c @@ -0,0 +1,22 @@ +int __attribute__((noinline)) +foo (int *__restrict p, int i) +{ + int *__restrict q; + int *__restrict r; + int v, w; + q = p + 1; + r = q - i; + v = *r; + *p = 1; + w = *r; + return v + w; +} +extern void abort (void); +int main() +{ + int i = 0; + if (foo (&i, 1) != 1) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr38236.c b/gcc/testsuite/gcc.c-torture/execute/pr38236.c new file mode 100644 index 000000000..d781542c7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr38236.c @@ -0,0 +1,22 @@ +struct X { int i; }; + +int __attribute__((noinline)) +foo (struct X *p, int *q, int a, int b) +{ + struct X x, y; + if (a) + p = &x; + if (b) + q = &x.i; + else + q = &y.i; + *q = 1; + return p->i; +} +extern void abort (void); +int main() +{ + if (foo((void *)0, (void *)0, 1, 1) != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr38422.c b/gcc/testsuite/gcc.c-torture/execute/pr38422.c new file mode 100644 index 000000000..e36879d7f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr38422.c @@ -0,0 +1,24 @@ +/* PR middle-end/38422 */ + +extern void abort (void); + +struct S +{ + int s : (sizeof (int) * __CHAR_BIT__ - 2); +} s; + +void +foo (void) +{ + s.s *= 2; +} + +int +main () +{ + s.s = 24; + foo (); + if (s.s != 48) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr38533.c b/gcc/testsuite/gcc.c-torture/execute/pr38533.c new file mode 100644 index 000000000..44eb5b87d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr38533.c @@ -0,0 +1,21 @@ +/* PR middle-end/38533 */ + +#define A asm volatile ("" : "=r" (f) : "0" (0)); e |= f; +#define B A A A A A A A A A A A +#define C B B B B B B B B B B B + +int +foo (void) +{ + int e = 0, f; + C C B B B B B A A A A A A + return e; +} + +int +main (void) +{ + if (foo ()) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr38819.c b/gcc/testsuite/gcc.c-torture/execute/pr38819.c new file mode 100644 index 000000000..91ae7d82b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr38819.c @@ -0,0 +1,29 @@ +extern void exit (int); +extern void abort (void); + +volatile int a = 1; +volatile int b = 0; +volatile int x = 2; +volatile signed int r = 8; + +void __attribute__((noinline)) +foo (void) +{ + exit (0); +} + +int +main (void) +{ + int si1 = a; + int si2 = b; + int i; + + for (i = 0; i < 100; ++i) { + foo (); + if (x == 8) + i++; + r += i + si1 % si2; + } + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr38969.c b/gcc/testsuite/gcc.c-torture/execute/pr38969.c new file mode 100644 index 000000000..328bdf447 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr38969.c @@ -0,0 +1,25 @@ +__complex__ float +__attribute__ ((noinline)) foo (__complex__ float x) +{ + return x; +} + +__complex__ float +__attribute__ ((noinline)) bar (__complex__ float x) +{ + return foo (x); +} + +int main() +{ + __complex__ float a, b; + __real__ a = 9; + __imag__ a = 42; + + b = bar (a); + + if (a != b) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr39100.c b/gcc/testsuite/gcc.c-torture/execute/pr39100.c new file mode 100644 index 000000000..5cb9e25d4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr39100.c @@ -0,0 +1,65 @@ +/* Bad PTA results (incorrect store handling) was causing us to delete + *na = 0 store. */ + +typedef struct E +{ + int p; + struct E *n; +} *EP; + +typedef struct C +{ + EP x; + short cn, cp; +} *CP; + +__attribute__((noinline)) CP +foo (CP h, EP x) +{ + EP pl = 0, *pa = &pl; + EP nl = 0, *na = &nl; + EP n; + + while (x) + { + n = x->n; + if ((x->p & 1) == 1) + { + h->cp++; + *pa = x; + pa = &((*pa)->n); + } + else + { + h->cn++; + *na = x; + na = &((*na)->n); + } + x = n; + } + *pa = nl; + *na = 0; + h->x = pl; + return h; +} + +int +main (void) +{ + struct C c = { 0, 0, 0 }; + struct E e[2] = { { 0, &e[1] }, { 1, 0 } }; + EP p; + + foo (&c, &e[0]); + if (c.cn != 1 || c.cp != 1) + __builtin_abort (); + if (c.x != &e[1]) + __builtin_abort (); + if (e[1].n != &e[0]) + __builtin_abort (); + if (e[0].n) + __builtin_abort (); + return 0; +} + + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr39120.c b/gcc/testsuite/gcc.c-torture/execute/pr39120.c new file mode 100644 index 000000000..885984800 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr39120.c @@ -0,0 +1,18 @@ +struct X { int *p; } x; + +struct X __attribute__((noinline)) +foo(int *p) { struct X x; x.p = p; return x; } + +void __attribute((noinline)) +bar() { *x.p = 1; } + +extern void abort (void); +int main() +{ + int i = 0; + x = foo(&i); + bar(); + if (i != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr39228.c b/gcc/testsuite/gcc.c-torture/execute/pr39228.c new file mode 100644 index 000000000..06d8efd1a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr39228.c @@ -0,0 +1,36 @@ +extern void abort (void); + +static int __attribute__((always_inline)) testf (float b) +{ + float c = 1.01f * b; + + return __builtin_isinff (c); +} + +static int __attribute__((always_inline)) test (double b) +{ + double c = 1.01 * b; + + return __builtin_isinf (c); +} + +static int __attribute__((always_inline)) testl (long double b) +{ + long double c = 1.01L * b; + + return __builtin_isinfl (c); +} + +int main() +{ + if (testf (__FLT_MAX__) < 1) + abort (); + + if (test (__DBL_MAX__) < 1) + abort (); + + if (testl (__LDBL_MAX__) < 1) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr39228.x b/gcc/testsuite/gcc.c-torture/execute/pr39228.x new file mode 100644 index 000000000..a7d8a821e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr39228.x @@ -0,0 +1,10 @@ +if { [istarget "alpha*-*-*"] || [istarget "sh*-*-*"] } { + # alpha and SH require -mieee for this test. + set additional_flags "-mieee" +} +if [istarget "spu-*-*"] { + # No Inf/NaN support on SPU. + return 1 +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr39233.c b/gcc/testsuite/gcc.c-torture/execute/pr39233.c new file mode 100644 index 000000000..29f722395 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr39233.c @@ -0,0 +1,18 @@ +extern void abort (void); + +__attribute__((noinline)) void +foo (void *p) +{ + long l = (long) p; + if (l < 0 || l > 6) + abort (); +} + +int +main () +{ + short i; + for (i = 6; i >= 0; i--) + foo ((void *) (long) i); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr39240.c b/gcc/testsuite/gcc.c-torture/execute/pr39240.c new file mode 100644 index 000000000..de5e2ee70 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr39240.c @@ -0,0 +1,105 @@ +/* PR target/39240 */ + +extern void abort (void); + +__attribute__ ((noinline)) +static int foo1 (int x) +{ + return x; +} + +__attribute__ ((noinline)) +unsigned int bar1 (int x) +{ + return foo1 (x + 6); +} + +volatile unsigned long l1 = (unsigned int) -4; + +__attribute__ ((noinline)) +static short int foo2 (int x) +{ + return x; +} + +__attribute__ ((noinline)) +unsigned short int bar2 (int x) +{ + return foo2 (x + 6); +} + +volatile unsigned long l2 = (unsigned short int) -4; + +__attribute__ ((noinline)) +static signed char foo3 (int x) +{ + return x; +} + +__attribute__ ((noinline)) +unsigned char bar3 (int x) +{ + return foo3 (x + 6); +} + +volatile unsigned long l3 = (unsigned char) -4; + +__attribute__ ((noinline)) +static unsigned int foo4 (int x) +{ + return x; +} + +__attribute__ ((noinline)) +int bar4 (int x) +{ + return foo4 (x + 6); +} + +volatile unsigned long l4 = (int) -4; + +__attribute__ ((noinline)) +static unsigned short int foo5 (int x) +{ + return x; +} + +__attribute__ ((noinline)) +short int bar5 (int x) +{ + return foo5 (x + 6); +} + +volatile unsigned long l5 = (short int) -4; + +__attribute__ ((noinline)) +static unsigned char foo6 (int x) +{ + return x; +} + +__attribute__ ((noinline)) +signed char bar6 (int x) +{ + return foo6 (x + 6); +} + +volatile unsigned long l6 = (signed char) -4; + +int +main (void) +{ + if (bar1 (-10) != l1) + abort (); + if (bar2 (-10) != l2) + abort (); + if (bar3 (-10) != l3) + abort (); + if (bar4 (-10) != l4) + abort (); + if (bar5 (-10) != l5) + abort (); + if (bar6 (-10) != l6) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr39339.c b/gcc/testsuite/gcc.c-torture/execute/pr39339.c new file mode 100644 index 000000000..6c1b9e72e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr39339.c @@ -0,0 +1,81 @@ +struct C +{ + unsigned int c; + struct D + { + unsigned int columns : 4; + unsigned int fore : 12; + unsigned int back : 6; + unsigned int fragment : 1; + unsigned int standout : 1; + unsigned int underline : 1; + unsigned int strikethrough : 1; + unsigned int reverse : 1; + unsigned int blink : 1; + unsigned int half : 1; + unsigned int bold : 1; + unsigned int invisible : 1; + unsigned int pad : 1; + } attr; +}; + +struct A +{ + struct C *data; + unsigned int len; +}; + +struct B +{ + struct A *cells; + unsigned char soft_wrapped : 1; +}; + +struct E +{ + long row, col; + struct C defaults; +}; + +__attribute__ ((noinline)) +void foo (struct E *screen, unsigned int c, int columns, struct B *row) +{ + struct D attr; + long col; + int i; + col = screen->col; + attr = screen->defaults.attr; + attr.columns = columns; + row->cells->data[col].c = c; + row->cells->data[col].attr = attr; + col++; + attr.fragment = 1; + for (i = 1; i < columns; i++) + { + row->cells->data[col].c = c; + row->cells->data[col].attr = attr; + col++; + } +} + +int +main (void) +{ + struct E e = {.row = 5,.col = 0,.defaults = + {6, {-1, -1, -1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0}} }; + struct C c[4]; + struct A a = { c, 4 }; + struct B b = { &a, 1 }; + struct D d; + __builtin_memset (&c, 0, sizeof c); + foo (&e, 65, 2, &b); + d = e.defaults.attr; + d.columns = 2; + if (__builtin_memcmp (&d, &c[0].attr, sizeof d)) + __builtin_abort (); + d.fragment = 1; + if (__builtin_memcmp (&d, &c[1].attr, sizeof d)) + __builtin_abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr39501.c b/gcc/testsuite/gcc.c-torture/execute/pr39501.c new file mode 100644 index 000000000..3749d6e78 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr39501.c @@ -0,0 +1,83 @@ +/* { dg-options "-ffast-math" } */ +#define min1(a,b) ((a) < (b) ? (a) : (b)) +#define max1(a,b) ((a) > (b) ? (a) : (b)) + +#define min2(a,b) ((a) <= (b) ? (a) : (b)) +#define max2(a,b) ((a) >= (b) ? (a) : (b)) + +#define F(type,n) \ + type __attribute__((noinline)) type##_##n(type a, type b) \ + { \ + return n(a, b); \ + } + +F(float,min1) +F(float,min2) +F(float,max1) +F(float,max2) + +F(double,min1) +F(double,min2) +F(double,max1) +F(double,max2) + +int main() +{ + if (float_min1(0.f, -1.f) != -1.f) abort(); + if (float_min1(-1.f, 0.f) != -1.f) abort(); + if (float_min1(0.f, 1.f) != 0.f) abort(); + if (float_min1(1.f, 0.f) != 0.f) abort(); + if (float_min1(-1.f, 1.f) != -1.f) abort(); + if (float_min1(1.f, -1.f) != -1.f) abort(); + + if (float_max1(0.f, -1.f) != 0.f) abort(); + if (float_max1(-1.f, 0.f) != 0.f) abort(); + if (float_max1(0.f, 1.f) != 1.f) abort(); + if (float_max1(1.f, 0.f) != 1.f) abort(); + if (float_max1(-1.f, 1.f) != 1.f) abort(); + if (float_max1(1.f, -1.f) != 1.f) abort(); + + if (float_min2(0.f, -1.f) != -1.f) abort(); + if (float_min2(-1.f, 0.f) != -1.f) abort(); + if (float_min2(0.f, 1.f) != 0.f) abort(); + if (float_min2(1.f, 0.f) != 0.f) abort(); + if (float_min2(-1.f, 1.f) != -1.f) abort(); + if (float_min2(1.f, -1.f) != -1.f) abort(); + + if (float_max2(0.f, -1.f) != 0.f) abort(); + if (float_max2(-1.f, 0.f) != 0.f) abort(); + if (float_max2(0.f, 1.f) != 1.f) abort(); + if (float_max2(1.f, 0.f) != 1.f) abort(); + if (float_max2(-1.f, 1.f) != 1.f) abort(); + if (float_max2(1.f, -1.f) != 1.f) abort(); + + if (double_min1(0., -1.) != -1.) abort(); + if (double_min1(-1., 0.) != -1.) abort(); + if (double_min1(0., 1.) != 0.) abort(); + if (double_min1(1., 0.) != 0.) abort(); + if (double_min1(-1., 1.) != -1.) abort(); + if (double_min1(1., -1.) != -1.) abort(); + + if (double_max1(0., -1.) != 0.) abort(); + if (double_max1(-1., 0.) != 0.) abort(); + if (double_max1(0., 1.) != 1.) abort(); + if (double_max1(1., 0.) != 1.) abort(); + if (double_max1(-1., 1.) != 1.) abort(); + if (double_max1(1., -1.) != 1.) abort(); + + if (double_min2(0., -1.) != -1.) abort(); + if (double_min2(-1., 0.) != -1.) abort(); + if (double_min2(0., 1.) != 0.) abort(); + if (double_min2(1., 0.) != 0.) abort(); + if (double_min2(-1., 1.) != -1.) abort(); + if (double_min2(1., -1.) != -1.) abort(); + + if (double_max2(0., -1.) != 0.) abort(); + if (double_max2(-1., 0.) != 0.) abort(); + if (double_max2(0., 1.) != 1.) abort(); + if (double_max2(1., 0.) != 1.) abort(); + if (double_max2(-1., 1.) != 1.) abort(); + if (double_max2(1., -1.) != 1.) abort(); + + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr39501.x b/gcc/testsuite/gcc.c-torture/execute/pr39501.x new file mode 100644 index 000000000..72527d7b4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr39501.x @@ -0,0 +1,2 @@ +set additional_flags "-ffast-math" +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr40022.c b/gcc/testsuite/gcc.c-torture/execute/pr40022.c new file mode 100644 index 000000000..1e8f728ab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr40022.c @@ -0,0 +1,51 @@ +extern void abort (void); + +struct A +{ + struct A *a; +}; + +struct B +{ + struct A *b; +}; + +__attribute__((noinline)) +struct A * +foo (struct A *x) +{ + asm volatile ("" : : "g" (x) : "memory"); + return x; +} + +__attribute__((noinline)) +void +bar (struct B *w, struct A *x, struct A *y, struct A *z) +{ + struct A **c; + c = &w->b; + *c = foo (x); + while (*c) + c = &(*c)->a; + *c = foo (y); + while (*c) + c = &(*c)->a; + *c = foo (z); +} + +struct B d; +struct A e, f, g; + +int +main (void) +{ + f.a = &g; + bar (&d, &e, &f, 0); + if (d.b == 0 + || d.b->a == 0 + || d.b->a->a == 0 + || d.b->a->a->a != 0) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr40057.c b/gcc/testsuite/gcc.c-torture/execute/pr40057.c new file mode 100644 index 000000000..9d5c4e31e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr40057.c @@ -0,0 +1,37 @@ +/* PR middle-end/40057 */ + +extern void abort (void); + +__attribute__((noinline)) int +foo (unsigned long long x) +{ + unsigned long long y = (x >> 31ULL) & 1ULL; + if (y == 0ULL) + return 0; + return -1; +} + +__attribute__((noinline)) int +bar (long long x) +{ + long long y = (x >> 31LL) & 1LL; + if (y == 0LL) + return 0; + return -1; +} + +int +main (void) +{ + if (sizeof (long long) != 8) + return 0; + if (foo (0x1682a9aaaULL)) + abort (); + if (!foo (0x1882a9aaaULL)) + abort (); + if (bar (0x1682a9aaaLL)) + abort (); + if (!bar (0x1882a9aaaLL)) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr40386.c b/gcc/testsuite/gcc.c-torture/execute/pr40386.c new file mode 100644 index 000000000..ae0ac5a98 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr40386.c @@ -0,0 +1,99 @@ +/* { dg-options "-fno-ira-share-spill-slots" } */ +#define CHAR_BIT 8 + +#define ROR(a,b) (((a) >> (b)) | ((a) << ((sizeof (a) * CHAR_BIT) - (b)))) +#define ROL(a,b) (((a) << (b)) | ((a) >> ((sizeof (a) * CHAR_BIT) - (b)))) + +#define CHAR_VALUE ((char)0xf234) +#define SHORT_VALUE ((short)0xf234) +#define INT_VALUE ((int)0xf234) +#define LONG_VALUE ((long)0xf2345678L) +#define LL_VALUE ((long long)0xf2345678abcdef0LL) + +#define SHIFT1 4 +#define SHIFT2 ((sizeof (long long) * CHAR_BIT) - SHIFT1) + +char c = CHAR_VALUE; +short s = SHORT_VALUE; +int i = INT_VALUE; +long l = LONG_VALUE; +long long ll = LL_VALUE; +int shift1 = SHIFT1; +int shift2 = SHIFT2; + +main () +{ + if (ROR (c, shift1) != ROR (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROR (c, SHIFT1) != ROR (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROR (s, shift1) != ROR (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROR (s, SHIFT1) != ROR (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROR (i, shift1) != ROR (INT_VALUE, SHIFT1)) + abort (); + + if (ROR (i, SHIFT1) != ROR (INT_VALUE, SHIFT1)) + abort (); + + if (ROR (l, shift1) != ROR (LONG_VALUE, SHIFT1)) + abort (); + + if (ROR (l, SHIFT1) != ROR (LONG_VALUE, SHIFT1)) + abort (); + + if (ROR (ll, shift1) != ROR (LL_VALUE, SHIFT1)) + abort (); + + if (ROR (ll, SHIFT1) != ROR (LL_VALUE, SHIFT1)) + abort (); + + if (ROR (ll, shift2) != ROR (LL_VALUE, SHIFT2)) + abort (); + + if (ROR (ll, SHIFT2) != ROR (LL_VALUE, SHIFT2)) + abort (); + + if (ROL (c, shift1) != ROL (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROL (c, SHIFT1) != ROL (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROL (s, shift1) != ROL (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROL (s, SHIFT1) != ROL (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROL (i, shift1) != ROL (INT_VALUE, SHIFT1)) + abort (); + + if (ROL (i, SHIFT1) != ROL (INT_VALUE, SHIFT1)) + abort (); + + if (ROL (l, shift1) != ROL (LONG_VALUE, SHIFT1)) + abort (); + + if (ROL (l, SHIFT1) != ROL (LONG_VALUE, SHIFT1)) + abort (); + + if (ROL (ll, shift1) != ROL (LL_VALUE, SHIFT1)) + abort (); + + if (ROL (ll, SHIFT1) != ROL (LL_VALUE, SHIFT1)) + abort (); + + if (ROL (ll, shift2) != ROL (LL_VALUE, SHIFT2)) + abort (); + + if (ROL (ll, SHIFT2) != ROL (LL_VALUE, SHIFT2)) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr40386.x b/gcc/testsuite/gcc.c-torture/execute/pr40386.x new file mode 100644 index 000000000..12192e203 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr40386.x @@ -0,0 +1,2 @@ +set additional_flags "-fno-ira-share-spill-slots" +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr40404.c b/gcc/testsuite/gcc.c-torture/execute/pr40404.c new file mode 100644 index 000000000..b2e0ea275 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr40404.c @@ -0,0 +1,19 @@ +extern void abort (void); + +#if (__SIZEOF_INT__ <= 2) +struct S { + unsigned long ui17 : 17; +} s; +#else +struct S { + unsigned int ui17 : 17; +} s; +#endif +int main() +{ + s.ui17 = 0x1ffff; + if (s.ui17 >= 0xfffffffeu) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr40493.c b/gcc/testsuite/gcc.c-torture/execute/pr40493.c new file mode 100644 index 000000000..c30786525 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr40493.c @@ -0,0 +1,82 @@ +extern void abort (void); + +typedef union i386_operand_type +{ + struct + { + unsigned int reg8:1; + unsigned int reg16:1; + unsigned int reg32:1; + unsigned int reg64:1; + unsigned int floatreg:1; + unsigned int regmmx:1; + unsigned int regxmm:1; + unsigned int regymm:1; + unsigned int control:1; + unsigned int debug:1; + unsigned int test:1; + unsigned int sreg2:1; + unsigned int sreg3:1; + unsigned int imm1:1; + unsigned int imm8:1; + unsigned int imm8s:1; + unsigned int imm16:1; + unsigned int imm32:1; + unsigned int imm32s:1; + unsigned int imm64:1; + unsigned int disp8:1; + unsigned int disp16:1; + unsigned int disp32:1; + unsigned int disp32s:1; + unsigned int disp64:1; + unsigned int acc:1; + unsigned int floatacc:1; + unsigned int baseindex:1; + unsigned int inoutportreg:1; + unsigned int shiftcount:1; + unsigned int jumpabsolute:1; + unsigned int esseg:1; + unsigned int regmem:1; + unsigned int mem:1; + unsigned int byte:1; + unsigned int word:1; + unsigned int dword:1; + unsigned int fword:1; + unsigned int qword:1; + unsigned int tbyte:1; + unsigned int xmmword:1; + unsigned int ymmword:1; + unsigned int unspecified:1; + unsigned int anysize:1; + } bitfield; + unsigned int array[2]; +} i386_operand_type; + +unsigned int x00, x01, y00, y01; + +int main (int argc, char *argv[]) +{ + i386_operand_type a,b,c,d; + + a.bitfield.reg16 = 1; + a.bitfield.imm16 = 0; + a.array[1] = 22; + + b = a; + x00 = b.array[0]; + x01 = b.array[1]; + + c = b; + y00 = c.array[0]; + y01 = c.array[1]; + + d = c; + if (d.bitfield.reg16 != 1) + abort(); + if (d.bitfield.imm16 != 0) + abort(); + if (d.array[1] != 22) + abort(); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr40579.c b/gcc/testsuite/gcc.c-torture/execute/pr40579.c new file mode 100644 index 000000000..7f44af310 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr40579.c @@ -0,0 +1,28 @@ +extern void abort (void); +static char * __attribute__((noinline)) +itos(int num) +{ + return (char *)0; +} +static void __attribute__((noinline)) +foo(int i, const char *x) +{ + if (i >= 4) + abort (); +} +int main() +{ + int x = -__INT_MAX__ + 3; + int i; + + for (i = 0; i < 4; ++i) + { + char *p; + --x; + p = itos(x); + foo(i, p); + } + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr40657.c b/gcc/testsuite/gcc.c-torture/execute/pr40657.c new file mode 100644 index 000000000..e6d8dda9f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr40657.c @@ -0,0 +1,23 @@ +/* Verify that that Thumb-1 epilogue size optimization does not clobber the + return value. */ + +long long v = 0x123456789abc; + +__attribute__((noinline)) void bar (int *x) +{ + asm volatile ("" : "=m" (x) ::); +} + +__attribute__((noinline)) long long foo() +{ + int x; + bar(&x); + return v; +} + +int main () +{ + if (foo () != v) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr40668.c b/gcc/testsuite/gcc.c-torture/execute/pr40668.c new file mode 100644 index 000000000..b860dd7c9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr40668.c @@ -0,0 +1,40 @@ +#if (__SIZEOF_INT__ == 2) +#define TESTVALUE 0x1234 +#else +#define TESTVALUE 0x12345678 +#endif +static void +foo (unsigned int x, void *p) +{ + __builtin_memcpy (p, &x, sizeof x); +} + +void +bar (int type, void *number) +{ + switch (type) + { + case 1: + foo (TESTVALUE, number); + break; + case 7: + foo (0, number); + break; + case 8: + foo (0, number); + break; + case 9: + foo (0, number); + break; + } +} + +int +main (void) +{ + unsigned int x; + bar (1, &x); + if (x != TESTVALUE) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr40747.c b/gcc/testsuite/gcc.c-torture/execute/pr40747.c new file mode 100644 index 000000000..1c75be3fc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr40747.c @@ -0,0 +1,22 @@ +/* PR middle-end/40747 */ + +extern void abort (void); + +int +foo (int i) +{ + return (i < 4 && i >= 0) ? i : 4; +} + +int +main () +{ + if (foo (-1) != 4) abort (); + if (foo (0) != 0) abort (); + if (foo (1) != 1) abort (); + if (foo (2) != 2) abort (); + if (foo (3) != 3) abort (); + if (foo (4) != 4) abort (); + if (foo (5) != 4) abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr41239.c b/gcc/testsuite/gcc.c-torture/execute/pr41239.c new file mode 100644 index 000000000..9966b867c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr41239.c @@ -0,0 +1,67 @@ +/* PR rtl-optimization/41239 */ + +struct S +{ + short nargs; + unsigned long arg[2]; +}; + +extern void abort (void); +extern void exit (int); +extern char fn1 (int, const char *, int, const char *, const char *); +extern void fn2 (int, ...); +extern int fn3 (int); +extern int fn4 (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); + +unsigned long +test (struct S *x) +{ + signed int arg1 = x->arg[0]; + long int arg2 = x->arg[1]; + + if (arg2 == 0) + (fn1 (20, "foo", 924, __func__, ((void *) 0)) + ? (fn2 (fn3 (0x2040082), fn4 ("division by zero"))) + : (void) 0); + + return (long int) arg1 / arg2; +} + +int +main (void) +{ + struct S s = { 2, { 5, 0 } }; + test (&s); + abort (); +} + +__attribute__((noinline)) char +fn1 (int x, const char *y, int z, const char *w, const char *v) +{ + asm volatile ("" : : "r" (w), "r" (v) : "memory"); + asm volatile ("" : "+r" (x) : "r" (y), "r" (z) : "memory"); + return x; +} + +__attribute__((noinline)) int +fn3 (int x) +{ + asm volatile ("" : "+r" (x) : : "memory"); + return x; +} + +__attribute__((noinline)) int +fn4 (const char *x, ...) +{ + asm volatile ("" : "+r" (x) : : "memory"); + return *x; +} + +__attribute__((noinline)) void +fn2 (int x, ...) +{ + asm volatile ("" : "+r" (x) : : "memory"); + if (x) + /* Could be a longjmp or throw too. */ + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr41317.c b/gcc/testsuite/gcc.c-torture/execute/pr41317.c new file mode 100644 index 000000000..742068b9a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr41317.c @@ -0,0 +1,28 @@ +extern void abort (void); + +struct A +{ + int i; +}; +struct B +{ + struct A a; + int j; +}; + +static void +foo (struct B *p) +{ + ((struct A *)p)->i = 1; +} + +int main() +{ + struct A a; + a.i = 0; + foo ((struct B *)&a); + if (a.i != 1) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr41395-1.c b/gcc/testsuite/gcc.c-torture/execute/pr41395-1.c new file mode 100644 index 000000000..e4df0e5d1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr41395-1.c @@ -0,0 +1,28 @@ +struct VEC_char_base +{ + unsigned num; + unsigned alloc; + short vec[1]; +}; + +short __attribute__((noinline)) +foo (struct VEC_char_base *p, int i) +{ + short *q; + p->vec[i] = 0; + q = &p->vec[8]; + *q = 1; + return p->vec[i]; +} + +extern void abort (void); +extern void *malloc (__SIZE_TYPE__); + +int +main() +{ + struct VEC_char_base *p = malloc (sizeof (struct VEC_char_base) + 256); + if (foo (p, 8) != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr41395-2.c b/gcc/testsuite/gcc.c-torture/execute/pr41395-2.c new file mode 100644 index 000000000..c75e96361 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr41395-2.c @@ -0,0 +1,35 @@ +struct VEC_char_base +{ + unsigned num; + unsigned alloc; + union { + short vec[1]; + struct { + int i; + int j; + int k; + } a; + } u; +}; + +short __attribute__((noinline)) +foo (struct VEC_char_base *p, int i) +{ + short *q; + p->u.vec[i] = 0; + q = &p->u.vec[16]; + *q = 1; + return p->u.vec[i]; +} + +extern void abort (void); +extern void *malloc (__SIZE_TYPE__); + +int +main() +{ + struct VEC_char_base *p = malloc (sizeof (struct VEC_char_base) + 256); + if (foo (p, 16) != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr41463.c b/gcc/testsuite/gcc.c-torture/execute/pr41463.c new file mode 100644 index 000000000..c410fe021 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr41463.c @@ -0,0 +1,56 @@ +#include + +union tree_node; + +struct tree_common +{ + int a; + long b; + long c; + void *p; + int d; +}; + +struct other_tree +{ + struct tree_common common; + int arr[14]; +}; + +struct tree_vec +{ + struct tree_common common; + int length; + union tree_node *a[1]; +}; + +union tree_node +{ + struct other_tree othr; + struct tree_vec vec; +}; + +union tree_node global; + +union tree_node * __attribute__((noinline)) +foo (union tree_node *p, int i) +{ + union tree_node **q; + p->vec.a[i] = (union tree_node *) 0; + q = &p->vec.a[1]; + *q = &global; + return p->vec.a[i]; +} + +extern void abort (void); +extern void *malloc (__SIZE_TYPE__); + +int +main() +{ + union tree_node *p = malloc (sizeof (union tree_node)); + if (foo (p, 1) != &global) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr41750.c b/gcc/testsuite/gcc.c-torture/execute/pr41750.c new file mode 100644 index 000000000..3f5cb635d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr41750.c @@ -0,0 +1,68 @@ +/* PR 41750 - IPA-SRA used to pass hash->sgot by value rather than by + reference. */ + +struct bfd_link_hash_table +{ + int hash; +}; + +struct foo_link_hash_table +{ + struct bfd_link_hash_table root; + int *dynobj; + int *sgot; +}; + +struct foo_link_info +{ + struct foo_link_hash_table *hash; +}; + +extern void abort (void); + +int __attribute__((noinline)) +foo_create_got_section (int *abfd, struct foo_link_info *info) +{ + info->hash->sgot = abfd; + return 1; +} + +static int * +get_got (int *abfd, struct foo_link_info *info, + struct foo_link_hash_table *hash) +{ + int *got; + int *dynobj; + + got = hash->sgot; + if (!got) + { + dynobj = hash->dynobj; + if (!dynobj) + hash->dynobj = dynobj = abfd; + if (!foo_create_got_section (dynobj, info)) + return 0; + got = hash->sgot; + } + return got; +} + +int * __attribute__((noinline,noclone)) +elf64_ia64_check_relocs (int *abfd, struct foo_link_info *info) +{ + return get_got (abfd, info, info->hash); +} + +struct foo_link_info link_info; +struct foo_link_hash_table hash; +int abfd; + +int +main () +{ + link_info.hash = &hash; + if (elf64_ia64_check_relocs (&abfd, &link_info) != &abfd) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr41917.c b/gcc/testsuite/gcc.c-torture/execute/pr41917.c new file mode 100644 index 000000000..4a9ada921 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr41917.c @@ -0,0 +1,21 @@ +/* PR rtl-optimization/41917 */ + +extern void abort (void); +unsigned int a = 1; + +int +main (void) +{ + unsigned int b, c, d; + + if (sizeof (int) != 4 || (int) 0xc7d24b5e > 0) + return 0; + + c = 0xc7d24b5e; + d = a | -2; + b = (d == 0) ? c : (c % d); + if (b != c) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr41919.c b/gcc/testsuite/gcc.c-torture/execute/pr41919.c new file mode 100644 index 000000000..ebd417664 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr41919.c @@ -0,0 +1,39 @@ +extern void abort (void); + +#define assert(x) if(!(x)) abort() + +struct S1 +{ + signed char f0; +}; + +int g_23 = 0; + +static struct S1 +foo (void) +{ + int *l_100 = &g_23; + int **l_110 = &l_100; + struct S1 l_128 = { 1 }; + assert (l_100 == &g_23); + assert (l_100 == &g_23); + assert (l_100 == &g_23); + assert (l_100 == &g_23); + assert (l_100 == &g_23); + assert (l_100 == &g_23); + assert (l_100 == &g_23); + return l_128; +} + +static signed char bar(signed char si1, signed char si2) +{ + return (si1 <= 0) ? si1 : (si2 * 2); +} +int main (void) +{ + struct S1 s = foo(); + if (bar(0x99 ^ (s.f0 && 1), 1) != -104) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr41935.c b/gcc/testsuite/gcc.c-torture/execute/pr41935.c new file mode 100644 index 000000000..ef8d08ce0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr41935.c @@ -0,0 +1,25 @@ +/* PR middle-end/41935 */ + +extern void abort (void); + +long int +foo (int n, int i, int j) +{ + typedef int T[n]; + struct S { int a; T b[n]; }; + return __builtin_offsetof (struct S, b[i][j]); +} + +int +main (void) +{ + typedef int T[5]; + struct S { int a; T b[5]; }; + if (foo (5, 2, 3) + != __builtin_offsetof (struct S, b) + (5 * 2 + 3) * sizeof (int)) + abort (); + if (foo (5, 5, 5) + != __builtin_offsetof (struct S, b) + (5 * 5 + 5) * sizeof (int)) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr42006.c b/gcc/testsuite/gcc.c-torture/execute/pr42006.c new file mode 100644 index 000000000..f40fc1796 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr42006.c @@ -0,0 +1,33 @@ +extern void abort (void); + +static unsigned int +my_add(unsigned int si1, unsigned int si2) +{ + return (si1 > (50-si2)) ? si1 : (si1 + si2); +} + +static unsigned int +my_shift(unsigned int left, unsigned int right) +{ + return (right > 100) ? left : (left >> right); +} + +static int func_4(unsigned int p_6) +{ + int count = 0; + for (p_6 = 1; p_6 < 3; p_6 = my_add(p_6, 1)) + { + if (count++ > 1) + abort (); + + if (my_shift(p_6, p_6)) + return 0; + } + return 0; +} + +int main(void) +{ + func_4(0); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr42142.c b/gcc/testsuite/gcc.c-torture/execute/pr42142.c new file mode 100644 index 000000000..43cf57e7b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr42142.c @@ -0,0 +1,26 @@ +int __attribute__((noinline,noclone)) +sort(int L) +{ + int end[2] = { 10, 10, }, i=0, R; + while (i<2) + { + R = end[i]; + if (L max) + max = i; +} + +static int CallFunctionRec(int (*fun)(int depth), int depth) { + if (!fun(depth)) { + return 0; + } + if (depth < 10) { + CallFunctionRec(fun, depth + 1); + } + return 1; +} + +static int CallFunction(int (*fun)(int depth)) { + return CallFunctionRec(fun, 1) && !fun(0); +} + +static int callback(int depth) { + storemax (depth); + return depth != 0; +} + +int main() { + CallFunction(callback); + if (max != 10) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr42248.c b/gcc/testsuite/gcc.c-torture/execute/pr42248.c new file mode 100644 index 000000000..bbb91b343 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr42248.c @@ -0,0 +1,27 @@ +typedef struct { + _Complex double a; + _Complex double b; +} Scf10; + +Scf10 g1s; + +void +check (Scf10 x, _Complex double y) +{ + if (x.a != y) __builtin_abort (); +} + +void +init (Scf10 *p, _Complex double y) +{ + p->a = y; +} + +int +main () +{ + init (&g1s, (_Complex double)1); + check (g1s, (_Complex double)1); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr42269-2.c b/gcc/testsuite/gcc.c-torture/execute/pr42269-2.c new file mode 100644 index 000000000..a9410d442 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr42269-2.c @@ -0,0 +1,15 @@ +/* Make sure that language + abi extensions in passing S interoperate. */ + +static long long __attribute__((noinline)) +foo (unsigned short s) +{ + return (short) s; +} + +unsigned short s = 0xFFFF; + +int +main (void) +{ + return foo (s) + 1 != 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr42512.c b/gcc/testsuite/gcc.c-torture/execute/pr42512.c new file mode 100644 index 000000000..f4e5cedbf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr42512.c @@ -0,0 +1,13 @@ +extern void abort (void); + +short g_3; + +int main (void) +{ + int l_2; + for (l_2 = -1; l_2 != 0; l_2 = (unsigned char)(l_2 - 1)) + g_3 |= l_2; + if (g_3 != -1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr42544.c b/gcc/testsuite/gcc.c-torture/execute/pr42544.c new file mode 100644 index 000000000..c5951b06a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr42544.c @@ -0,0 +1,14 @@ +/* PR c/42544 */ + +extern void abort (void); + +int +main () +{ + signed short s = -1; + if (sizeof (long long) == sizeof (unsigned int)) + return 0; + if ((unsigned int) s >= 0x100000000ULL) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr42570.c b/gcc/testsuite/gcc.c-torture/execute/pr42570.c new file mode 100644 index 000000000..99a8d8072 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr42570.c @@ -0,0 +1,9 @@ +typedef unsigned char uint8_t; +uint8_t foo[1][0]; +extern void abort (void); +int main() +{ + if (sizeof (foo) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr42614.c b/gcc/testsuite/gcc.c-torture/execute/pr42614.c new file mode 100644 index 000000000..d3680539b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr42614.c @@ -0,0 +1,68 @@ +extern void *malloc(__SIZE_TYPE__); +extern void abort(void); +extern void free(void *); + +typedef struct SEntry +{ + unsigned char num; +} TEntry; + +typedef struct STable +{ + TEntry data[2]; +} TTable; + +TTable *init () +{ + return malloc(sizeof(TTable)); +} + +void +expect_func (int a, unsigned char *b) __attribute__ ((noinline)); + +static inline void +inlined_wrong (TEntry *entry_p, int flag); + +void +inlined_wrong (TEntry *entry_p, int flag) +{ + unsigned char index; + entry_p->num = 0; + + if (flag == 0) + abort(); + + for (index = 0; index < 1; index++) + entry_p->num++; + + if (!entry_p->num) + { + abort(); + } +} + +void +expect_func (int a, unsigned char *b) +{ + if (abs ((a == 0))) + abort (); + if (abs ((b == 0))) + abort (); +} + +int +main () +{ + unsigned char index = 0; + TTable *table_p = init(); + TEntry work; + + inlined_wrong (&(table_p->data[1]), 1); + expect_func (1, &index); + inlined_wrong (&work, 1); + + free (table_p); + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr42691.c b/gcc/testsuite/gcc.c-torture/execute/pr42691.c new file mode 100644 index 000000000..7eeee99ec --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr42691.c @@ -0,0 +1,41 @@ +extern void abort (void); + +union _D_rep +{ + unsigned short rep[4]; + double val; +}; + +int add(double* key, double* table) +{ + unsigned i = 0; + double* deletedEntry = 0; + while (1) { + double* entry = table + i; + + if (*entry == *key) + break; + + union _D_rep _D_inf = {{ 0, 0, 0, 0x7ff0 }}; + if (*entry != _D_inf.val) + abort (); + + union _D_rep _D_inf2 = {{ 0, 0, 0, 0x7ff0 }}; + if (!_D_inf2.val) + deletedEntry = entry; + + i++; + } + if (deletedEntry) + *deletedEntry = 0.0; + return 0; +} + +int main () +{ + union _D_rep infinit = {{ 0, 0, 0, 0x7ff0 }}; + double table[2] = { infinit.val, 23 }; + double key = 23; + int ret = add (&key, table); + return ret; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr42721.c b/gcc/testsuite/gcc.c-torture/execute/pr42721.c new file mode 100644 index 000000000..706921b0d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr42721.c @@ -0,0 +1,21 @@ +/* PR c/42721 */ + +extern void abort (void); + +static unsigned long long +foo (unsigned long long x, unsigned long long y) +{ + return x / y; +} + +static int a, b; + +int +main (void) +{ + unsigned long long c = 1; + b ^= c && (foo (a, -1ULL) != 1L); + if (b != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr42833.c b/gcc/testsuite/gcc.c-torture/execute/pr42833.c new file mode 100644 index 000000000..5494f9868 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr42833.c @@ -0,0 +1,171 @@ +typedef __INT_LEAST8_TYPE__ int8_t; +typedef __UINT_LEAST32_TYPE__ uint32_t; +typedef int ssize_t; +typedef struct { int8_t v1; int8_t v2; int8_t v3; int8_t v4; } neon_s8; + +uint32_t helper_neon_rshl_s8 (uint32_t arg1, uint32_t arg2); + +uint32_t +helper_neon_rshl_s8 (uint32_t arg1, uint32_t arg2) +{ + uint32_t res; + neon_s8 vsrc1; + neon_s8 vsrc2; + neon_s8 vdest; + do + { + union + { + neon_s8 v; + uint32_t i; + } conv_u; + conv_u.i = (arg1); + vsrc1 = conv_u.v; + } + while (0); + do + { + union + { + neon_s8 v; + uint32_t i; + } conv_u; + conv_u.i = (arg2); + vsrc2 = conv_u.v; + } + while (0); + do + { + int8_t tmp; + tmp = (int8_t) vsrc2.v1; + if (tmp >= (ssize_t) sizeof (vsrc1.v1) * 8) + { + vdest.v1 = 0; + } + else if (tmp < -(ssize_t) sizeof (vsrc1.v1) * 8) + { + vdest.v1 = vsrc1.v1 >> (sizeof (vsrc1.v1) * 8 - 1); + } + else if (tmp == -(ssize_t) sizeof (vsrc1.v1) * 8) + { + vdest.v1 = vsrc1.v1 >> (tmp - 1); + vdest.v1++; + vdest.v1 >>= 1; + } + else if (tmp < 0) + { + vdest.v1 = (vsrc1.v1 + (1 << (-1 - tmp))) >> -tmp; + } + else + { + vdest.v1 = vsrc1.v1 << tmp; + } + } + while (0); + do + { + int8_t tmp; + tmp = (int8_t) vsrc2.v2; + if (tmp >= (ssize_t) sizeof (vsrc1.v2) * 8) + { + vdest.v2 = 0; + } + else if (tmp < -(ssize_t) sizeof (vsrc1.v2) * 8) + { + vdest.v2 = vsrc1.v2 >> (sizeof (vsrc1.v2) * 8 - 1); + } + else if (tmp == -(ssize_t) sizeof (vsrc1.v2) * 8) + { + vdest.v2 = vsrc1.v2 >> (tmp - 1); + vdest.v2++; + vdest.v2 >>= 1; + } + else if (tmp < 0) + { + vdest.v2 = (vsrc1.v2 + (1 << (-1 - tmp))) >> -tmp; + } + else + { + vdest.v2 = vsrc1.v2 << tmp; + } + } + while (0); + do + { + int8_t tmp; + tmp = (int8_t) vsrc2.v3; + if (tmp >= (ssize_t) sizeof (vsrc1.v3) * 8) + { + vdest.v3 = 0; + } + else if (tmp < -(ssize_t) sizeof (vsrc1.v3) * 8) + { + vdest.v3 = vsrc1.v3 >> (sizeof (vsrc1.v3) * 8 - 1); + } + else if (tmp == -(ssize_t) sizeof (vsrc1.v3) * 8) + { + vdest.v3 = vsrc1.v3 >> (tmp - 1); + vdest.v3++; + vdest.v3 >>= 1; + } + else if (tmp < 0) + { + vdest.v3 = (vsrc1.v3 + (1 << (-1 - tmp))) >> -tmp; + } + else + { + vdest.v3 = vsrc1.v3 << tmp; + } + } + while (0); + do + { + int8_t tmp; + tmp = (int8_t) vsrc2.v4; + if (tmp >= (ssize_t) sizeof (vsrc1.v4) * 8) + { + vdest.v4 = 0; + } + else if (tmp < -(ssize_t) sizeof (vsrc1.v4) * 8) + { + vdest.v4 = vsrc1.v4 >> (sizeof (vsrc1.v4) * 8 - 1); + } + else if (tmp == -(ssize_t) sizeof (vsrc1.v4) * 8) + { + vdest.v4 = vsrc1.v4 >> (tmp - 1); + vdest.v4++; + vdest.v4 >>= 1; + } + else if (tmp < 0) + { + vdest.v4 = (vsrc1.v4 + (1 << (-1 - tmp))) >> -tmp; + } + else + { + vdest.v4 = vsrc1.v4 << tmp; + } + } + while (0);; + do + { + union + { + neon_s8 v; + uint32_t i; + } conv_u; + conv_u.v = (vdest); + res = conv_u.i; + } + while (0); + return res; +} + +extern void abort(void); + +int main() +{ + uint32_t r = helper_neon_rshl_s8 (0x05050505, 0x01010101); + if (r != 0x0a0a0a0a) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr43008.c b/gcc/testsuite/gcc.c-torture/execute/pr43008.c new file mode 100644 index 000000000..428f4ae3b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr43008.c @@ -0,0 +1,23 @@ +int i; +struct X { + int *p; +}; +struct X * __attribute__((malloc)) +my_alloc (void) +{ + struct X *p = __builtin_malloc (sizeof (struct X)); + p->p = &i; + return p; +} +extern void abort (void); +int main() +{ + struct X *p, *q; + p = my_alloc (); + q = my_alloc (); + *(p->p) = 1; + *(q->p) = 0; + if (*(p->p) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr43220.c b/gcc/testsuite/gcc.c-torture/execute/pr43220.c new file mode 100644 index 000000000..4709f17b5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr43220.c @@ -0,0 +1,28 @@ +void *volatile p; + +int +main (void) +{ + int n = 0; +lab:; + { + int x[n % 1000 + 1]; + x[0] = 1; + x[n % 1000] = 2; + p = x; + n++; + } + + { + int x[n % 1000 + 1]; + x[0] = 1; + x[n % 1000] = 2; + p = x; + n++; + } + + if (n < 1000000) + goto lab; + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr43236.c b/gcc/testsuite/gcc.c-torture/execute/pr43236.c new file mode 100644 index 000000000..0401c88a3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr43236.c @@ -0,0 +1,32 @@ +/* { dg-options "-ftree-loop-distribution" } */ +extern void abort(void); +extern void *memset(void *s, int c, __SIZE_TYPE__ n); +extern int memcmp(const void *s1, const void *s2, __SIZE_TYPE__ n); +/*extern int printf(const char *format, ...);*/ + +int main() +{ + char A[30], B[30], C[30]; + int i; + + /* prepare arrays */ + memset(A, 1, 30); + memset(B, 1, 30); + + for (i = 20; i-- > 10;) { + A[i] = 0; + B[i] = 0; + } + + /* expected result */ + memset(C, 1, 30); + memset(C + 10, 0, 10); + + /* show result */ +/* for (i = 0; i < 30; i++) + printf("%d %d %d\n", A[i], B[i], C[i]); */ + + /* compare results */ + if (memcmp(A, C, 30) || memcmp(B, C, 30)) abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr43269.c b/gcc/testsuite/gcc.c-torture/execute/pr43269.c new file mode 100644 index 000000000..9f599a2dd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr43269.c @@ -0,0 +1,31 @@ +int g_21; +int g_211; +int g_261; + +static void __attribute__((noinline,noclone)) +func_32 (int b) +{ + if (b) { +lbl_370: + g_21 = 1; + } + + for (g_261 = -1; g_261 > -2; g_261--) { + if (g_211 + 1) { + return; + } else { + g_21 = 1; + goto lbl_370; + } + } +} + +extern void abort (void); + +int main(void) +{ + func_32(0); + if (g_261 != -1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr43385.c b/gcc/testsuite/gcc.c-torture/execute/pr43385.c new file mode 100644 index 000000000..eeb9096a8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr43385.c @@ -0,0 +1,59 @@ +/* PR c/43385 */ + +extern void abort (void); + +int e; + +__attribute__((noinline)) void +foo (int x, int y) +{ + if (__builtin_expect (x, 0) && y != 0) + e++; +} + +__attribute__((noinline)) int +bar (int x, int y) +{ + if (__builtin_expect (x, 0) && y != 0) + return 1; + else + return 0; +} + +int +main (void) +{ + int z = 0; + asm ("" : "+r" (z)); + foo (z + 2, z + 1); + if (e != 1) + abort (); + foo (z + 2, z); + if (e != 1) + abort (); + foo (z + 1, z + 1); + if (e != 2) + abort (); + foo (z + 1, z); + if (e != 2) + abort (); + foo (z, z + 1); + if (e != 2) + abort (); + foo (z, z); + if (e != 2) + abort (); + if (bar (z + 2, z + 1) != 1) + abort (); + if (bar (z + 2, z) != 0) + abort (); + if (bar (z + 1, z + 1) != 1) + abort (); + if (bar (z + 1, z) != 0) + abort (); + if (bar (z, z + 1) != 0) + abort (); + if (bar (z, z) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr43438.c b/gcc/testsuite/gcc.c-torture/execute/pr43438.c new file mode 100644 index 000000000..aa901ce0f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr43438.c @@ -0,0 +1,23 @@ +extern void abort (void); + +static unsigned char g_2 = 1; +static int g_9; +static int *l_8 = &g_9; + +static void func_12(int p_13) +{ + int * l_17 = &g_9; + *l_17 &= 0 < p_13; +} + +int main(void) +{ + unsigned char l_11 = 254; + *l_8 |= g_2; + l_11 |= *l_8; + func_12(l_11); + if (g_9 != 1) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr43560.c b/gcc/testsuite/gcc.c-torture/execute/pr43560.c new file mode 100644 index 000000000..cb420c614 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr43560.c @@ -0,0 +1,28 @@ +/* PR tree-optimization/43560 */ + +struct S +{ + int a, b; + char c[10]; +}; + +__attribute__ ((noinline)) void +test (struct S *x) +{ + while (x->b > 1 && x->c[x->b - 1] == '/') + { + x->b--; + x->c[x->b] = '\0'; + } +} + +const struct S s = { 0, 0, "" }; + +int +main () +{ + struct S *p; + asm ("" : "=r" (p) : "0" (&s)); + test (p); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr43629.c b/gcc/testsuite/gcc.c-torture/execute/pr43629.c new file mode 100644 index 000000000..10c0196c8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr43629.c @@ -0,0 +1,13 @@ +int flag; +extern void abort (void); +int main() +{ + int x; + if (flag) + x = -1; + else + x &= 0xff; + if (x & ~0xff) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr43783.c b/gcc/testsuite/gcc.c-torture/execute/pr43783.c new file mode 100644 index 000000000..3880026c4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr43783.c @@ -0,0 +1,21 @@ +typedef __attribute__((aligned(16))) +struct { + unsigned long long w[3]; +} UINT192; + +UINT192 bid_Kx192[32]; + +extern void abort (void); + +int main() +{ + int i = 0; + unsigned long x = 0; + for (i = 0; i < 32; ++i) + bid_Kx192[i].w[1] = i == 1; + for (i = 0; i < 32; ++i) + x += bid_Kx192[1].w[1]; + if (x != 32) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr43784.c b/gcc/testsuite/gcc.c-torture/execute/pr43784.c new file mode 100644 index 000000000..622232725 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr43784.c @@ -0,0 +1,33 @@ +struct s { + unsigned char a[256]; +}; +union u { + struct { struct s b; int c; } d; + struct { int c; struct s b; } e; +}; + +static union u v; +static struct s *p = &v.d.b; +static struct s *q = &v.e.b; + +static struct s __attribute__((noinline)) rp(void) +{ + return *p; +} + +static void qp(void) +{ + *q = rp(); +} + +int main() +{ + int i; + for (i = 0; i < 256; i++) + p->a[i] = i; + qp(); + for (i = 0; i < 256; i++) + if (q->a[i] != i) + __builtin_abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr43835.c b/gcc/testsuite/gcc.c-torture/execute/pr43835.c new file mode 100644 index 000000000..97237f625 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr43835.c @@ -0,0 +1,51 @@ +struct PMC { + unsigned flags; +}; + +typedef struct Pcc_cell +{ + struct PMC *p; + long bla; + long type; +} Pcc_cell; + +extern void abort (); +extern void Parrot_gc_mark_PMC_alive_fun(int * interp, struct PMC *pmc) + __attribute__((noinline)); + +void Parrot_gc_mark_PMC_alive_fun (int * interp, struct PMC *pmc) +{ + abort (); +} + +static void mark_cell(int * interp, Pcc_cell *c) + __attribute__((__nonnull__(1))) + __attribute__((__nonnull__(2))) + __attribute__((noinline)); + +static void +mark_cell(int * interp, Pcc_cell *c) +{ + if (c->type == 4 && c->p + && !(c->p->flags & (1<<18))) + Parrot_gc_mark_PMC_alive_fun(interp, c->p); +} + +void foo(int * interp, Pcc_cell *c); + +void +foo(int * interp, Pcc_cell *c) +{ + mark_cell(interp, c); +} + +int main() +{ + int i; + Pcc_cell c; + c.p = 0; + c.bla = 42; + c.type = 4; + foo (&i, &c); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr43987.c b/gcc/testsuite/gcc.c-torture/execute/pr43987.c new file mode 100644 index 000000000..ee41bdf27 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr43987.c @@ -0,0 +1,20 @@ +char B[256 * sizeof(void *)]; +typedef void *FILE; +typedef struct globals { + int c; + FILE *l; +} __attribute__((may_alias)) T; +void add_input_file(FILE *file) +{ + (*(T*)&B).l[0] = file; +} +extern void abort (void); +int main() +{ + FILE x; + (*(T*)&B).l = &x; + add_input_file ((void *)-1); + if ((*(T*)&B).l[0] != (void *)-1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44164.c b/gcc/testsuite/gcc.c-torture/execute/pr44164.c new file mode 100644 index 000000000..171f9c39f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr44164.c @@ -0,0 +1,24 @@ +struct X { + struct Y { + struct YY { + struct Z { + int i; + } c; + } bb; + } b; +} a; +int __attribute__((noinline, noclone)) +foo (struct Z *p) +{ + int i = p->i; + a.b = (struct Y){}; + return p->i + i; +} +extern void abort (void); +int main() +{ + a.b.bb.c.i = 1; + if (foo (&a.b.bb.c) != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44202-1.c b/gcc/testsuite/gcc.c-torture/execute/pr44202-1.c new file mode 100644 index 000000000..37e84f2fc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr44202-1.c @@ -0,0 +1,30 @@ +extern __attribute__ ((__noreturn__)) void exit(int); +extern __attribute__ ((__noreturn__)) void abort(void); +__attribute__ ((__noinline__)) +int +add512(int a, int *b) +{ + int c = a + 512; + if (c != 0) + *b = a; + return c; +} + +__attribute__ ((__noinline__)) +int +add513(int a, int *b) +{ + int c = a + 513; + if (c == 0) + *b = a; + return c; +} + +int main(void) +{ + int b0 = -1; + int b1 = -1; + if (add512(-512, &b0) != 0 || b0 != -1 || add513(-513, &b1) != 0 || b1 != -513) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44468.c b/gcc/testsuite/gcc.c-torture/execute/pr44468.c new file mode 100644 index 000000000..c4bd49265 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr44468.c @@ -0,0 +1,60 @@ +#include + +struct S { + int i; + int j; +}; +struct R { + int k; + struct S a; +}; +struct Q { + float k; + struct S a; +}; +struct Q s; +int __attribute__((noinline,noclone)) +test1 (void *q) +{ + struct S *b = (struct S *)((char *)q + sizeof (int)); + s.a.i = 0; + b->i = 3; + return s.a.i; +} +int __attribute__((noinline,noclone)) +test2 (void *q) +{ + struct S *b = &((struct R *)q)->a; + s.a.i = 0; + b->i = 3; + return s.a.i; +} +int __attribute__((noinline,noclone)) +test3 (void *q) +{ + s.a.i = 0; + ((struct S *)((char *)q + sizeof (int)))->i = 3; + return s.a.i; +} +extern void abort (void); +int +main() +{ + if (sizeof (float) != sizeof (int) + || offsetof (struct R, a) != sizeof (int) + || offsetof (struct Q, a) != sizeof (int)) + return 0; + s.a.i = 1; + s.a.j = 2; + if (test1 ((void *)&s) != 3) + abort (); + s.a.i = 1; + s.a.j = 2; + if (test2 ((void *)&s) != 3) + abort (); + s.a.i = 1; + s.a.j = 2; + if (test3 ((void *)&s) != 3) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44555.c b/gcc/testsuite/gcc.c-torture/execute/pr44555.c new file mode 100644 index 000000000..6ba8e4919 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr44555.c @@ -0,0 +1,16 @@ +struct a { + char b[100]; +}; +int foo(struct a *a) +{ + if (&a->b) + return 1; + return 0; +} +extern void abort (void); +int main() +{ + if (foo((struct a *)0) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44575.c b/gcc/testsuite/gcc.c-torture/execute/pr44575.c new file mode 100644 index 000000000..62a7d7800 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr44575.c @@ -0,0 +1,49 @@ +/* PR target/44575 */ + +#include + +int fails = 0; +struct S { float a[3]; }; +struct S a[5]; + +void +check (int z, ...) +{ + struct S arg, *p; + va_list ap; + int j = 0, k = 0; + int i; + va_start (ap, z); + for (i = 2; i < 4; ++i) + { + p = 0; + j++; + k += 2; + switch ((z << 4) | i) + { + case 0x12: + case 0x13: + p = &a[2]; + arg = va_arg (ap, struct S); + break; + default: + ++fails; + break; + } + if (p && p->a[2] != arg.a[2]) + ++fails; + if (fails) + break; + } + va_end (ap); +} + +int +main () +{ + a[2].a[2] = -49026; + check (1, a[2], a[2]); + if (fails) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44683.c b/gcc/testsuite/gcc.c-torture/execute/pr44683.c new file mode 100644 index 000000000..d0fd446f0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr44683.c @@ -0,0 +1,18 @@ +int __attribute__((noinline,noclone)) +copysign_bug (double x) +{ + if (x != 0.0 && (x * 0.5 == x)) + return 1; + if (__builtin_copysign(1.0, x) < 0.0) + return 2; + else + return 3; +} +int main(void) +{ + double x = -0.0; + if (copysign_bug (x) != 2) + __builtin_abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44683.x b/gcc/testsuite/gcc.c-torture/execute/pr44683.x new file mode 100644 index 000000000..20413409a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr44683.x @@ -0,0 +1,6 @@ +if { [istarget "sh*-*-*"] } { + # SH require -mieee for this test. + set additional_flags "-mieee" +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44828.c b/gcc/testsuite/gcc.c-torture/execute/pr44828.c new file mode 100644 index 000000000..93837344b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr44828.c @@ -0,0 +1,19 @@ +extern void abort (void); + +static signed char +foo (signed char si1, signed char si2) +{ + return si1 * si2; +} + +int a = 0x105F61CA; + +int +main (void) +{ + int b = 0x0332F5C8; + if (foo (b, a) > 0) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44852.c b/gcc/testsuite/gcc.c-torture/execute/pr44852.c new file mode 100644 index 000000000..440653e5f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr44852.c @@ -0,0 +1,22 @@ +__attribute__ ((__noinline__)) +char *sf(char *s, char *s0) +{ + asm (""); + while (*--s == '9') + if (s == s0) + { + *s = '0'; + break; + } + ++*s++; + return s; +} + +int main() +{ + char s[] = "999999"; + char *x = sf (s+2, s); + if (x != s+1 || __builtin_strcmp (s, "199999") != 0) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44858.c b/gcc/testsuite/gcc.c-torture/execute/pr44858.c new file mode 100644 index 000000000..45e1758b0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr44858.c @@ -0,0 +1,28 @@ +/* PR rtl-optimization/44858 */ + +extern void abort (void); +int a = 3; +int b = 1; + +__attribute__((noinline)) long long +foo (int x, int y) +{ + return x / y; +} + +__attribute__((noinline)) int +bar (void) +{ + int c = 2; + c &= foo (1, b) > b; + b = (a != 0) | c; + return c; +} + +int +main (void) +{ + if (bar () != 0 || b != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr44942.c b/gcc/testsuite/gcc.c-torture/execute/pr44942.c new file mode 100644 index 000000000..3ef083022 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr44942.c @@ -0,0 +1,70 @@ +/* PR target/44942 */ + +#include + +void +test1 (int a, int b, int c, int d, int e, int f, int g, long double h, ...) +{ + int i; + va_list ap; + + va_start (ap, h); + i = va_arg (ap, int); + if (i != 1234) + __builtin_abort (); + va_end (ap); +} + +void +test2 (int a, int b, int c, int d, int e, int f, int g, long double h, int i, + long double j, int k, long double l, int m, long double n, ...) +{ + int o; + va_list ap; + + va_start (ap, n); + o = va_arg (ap, int); + if (o != 1234) + __builtin_abort (); + va_end (ap); +} + +void +test3 (double a, double b, double c, double d, double e, double f, + double g, long double h, ...) +{ + double i; + va_list ap; + + va_start (ap, h); + i = va_arg (ap, double); + if (i != 1234.0) + __builtin_abort (); + va_end (ap); +} + +void +test4 (double a, double b, double c, double d, double e, double f, double g, + long double h, double i, long double j, double k, long double l, + double m, long double n, ...) +{ + double o; + va_list ap; + + va_start (ap, n); + o = va_arg (ap, double); + if (o != 1234.0) + __builtin_abort (); + va_end (ap); +} + +int +main () +{ + test1 (0, 0, 0, 0, 0, 0, 0, 0.0L, 1234); + test2 (0, 0, 0, 0, 0, 0, 0, 0.0L, 0, 0.0L, 0, 0.0L, 0, 0.0L, 1234); + test3 (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0L, 1234.0); + test4 (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0L, 0.0, 0.0L, + 0.0, 0.0L, 0.0, 0.0L, 1234.0); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr45034.c b/gcc/testsuite/gcc.c-torture/execute/pr45034.c new file mode 100644 index 000000000..2d86f309c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr45034.c @@ -0,0 +1,45 @@ +extern void abort (void); +static void fixnum_neg(signed char x, signed char *py, int *pv) +{ + unsigned char ux, uy; + + ux = (unsigned char)x; + uy = -ux; + *py = (uy <= 127) ? (signed char)uy : (-(signed char)(255 - uy) - 1); + *pv = (x == -128) ? 1 : 0; +} + +void __attribute__((noinline)) foo(int x, int y, int v) +{ + if (y < -128 || y > 127) + abort(); +} + +int test_neg(void) +{ + signed char x, y; + int v, err; + + err = 0; + x = -128; + for (;;) { + fixnum_neg(x, &y, &v); + foo((int)x, (int)y, v); + if ((v && x != -128) || (!v && x == -128)) + ++err; + if (x == 127) + break; + ++x; + } + return err; +} + +int main(void) +{ + if (sizeof (char) != 1) + return 0; + if (test_neg() != 0) + abort(); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr45070.c b/gcc/testsuite/gcc.c-torture/execute/pr45070.c new file mode 100644 index 000000000..95ff77aa0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr45070.c @@ -0,0 +1,52 @@ +/* PR45070 */ +extern void abort(void); + +struct packed_ushort { + unsigned short ucs; +} __attribute__((packed)); + +struct source { + int pos, length; + int flag; +}; + +static void __attribute__((noinline)) fetch(struct source *p) +{ + p->length = 128; +} + +static struct packed_ushort __attribute__((noinline)) next(struct source *p) +{ + struct packed_ushort rv; + + if (p->pos >= p->length) { + if (p->flag) { + p->flag = 0; + fetch(p); + return next(p); + } + p->flag = 1; + rv.ucs = 0xffff; + return rv; + } + rv.ucs = 0; + return rv; +} + +int main(void) +{ + struct source s; + int i; + + s.pos = 0; + s.length = 0; + s.flag = 0; + + for (i = 0; i < 16; i++) { + struct packed_ushort rv = next(&s); + if ((i == 0 && rv.ucs != 0xffff) + || (i > 0 && rv.ucs != 0)) + abort(); + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr45262.c b/gcc/testsuite/gcc.c-torture/execute/pr45262.c new file mode 100644 index 000000000..72e186bf2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr45262.c @@ -0,0 +1,33 @@ +/* PR middle-end/45262 */ + +extern void abort (void); + +int +foo (unsigned int x) +{ + return ((int) x < 0) || ((int) (-x) < 0); +} + +int +bar (unsigned int x) +{ + return x >> 31 || (-x) >> 31; +} + +int +main (void) +{ + if (foo (1) != 1) + abort (); + if (foo (0) != 0) + abort (); + if (foo (-1) != 1) + abort (); + if (bar (1) != 1) + abort (); + if (bar (0) != 0) + abort (); + if (bar (-1) != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr45695.c b/gcc/testsuite/gcc.c-torture/execute/pr45695.c new file mode 100644 index 000000000..eb1e4c788 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr45695.c @@ -0,0 +1,32 @@ +/* PR rtl-optimization/45695 */ + +extern void abort (void); + +__attribute__((noinline)) void +g (int x) +{ + asm volatile ("" : "+r" (x)); +} + +__attribute__((noinline)) int +f (int a, int b, int d) +{ + int r = -1; + b += d; + if (d == a) + r = b - d; + g (b); + return r; +} + +int +main (void) +{ + int l; + asm ("" : "=r" (l) : "0" (0)); + if (f (l + 0, l + 1, l + 4) != -1) + abort (); + if (f (l + 4, l + 1, l + 4) != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr45830.c b/gcc/testsuite/gcc.c-torture/execute/pr45830.c new file mode 100644 index 000000000..0f83e050e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr45830.c @@ -0,0 +1,97 @@ +/* PR tree-optimization/45830 */ + +extern void abort (void); + +long long va, vb, vc, vd, ve; + +__attribute__((noinline)) int +foo (int x) +{ + long long a, b, c, d, e; + switch (x) + { + case 0: + case 3: + case 1: + case 2: + case 4: + a = 1; + b = 129; + c = -12; + d = -4; + e = 128; + break; + case 23: + case 26: + case 19: + case 65: + case 5: + a = 2; + b = 138; + c = 115; + d = 128; + e = -16; + break; + case 21: + case 20: + case 22: + case 38: + case 27: + case 66: + case 45: + case 47: + a = 3; + b = 6; + c = 127; + d = 25; + e = 257; + break; + default: + a = 0; + b = 18; + c = 0; + d = 64; + e = 32768L; + break; + } + va = a; + vb = b; + vc = c; + vd = d; + ve = e; +} + +int +bar (int x) +{ + if (x < 0) + return 3; + if (x < 5) + return 0; + if (x == 5 || x == 19 || x == 23 | x == 26 || x == 65) + return 1; + if ((x >= 20 && x <= 22) || x == 27 || x == 38 + || x == 45 || x == 47 || x == 66) + return 2; + return 3; +} + +long long expected[] = +{ 1, 129, -12, -4, 128, 2, 138, 115, 128, -16, + 3, 6, 127, 25, 257, 0, 18, 0, 64, 32768L }; + +int +main (void) +{ + int i, v; + for (i = -4; i < 70; i++) + { + foo (i); + v = bar (i); + if (va != expected[5 * v] || vb != expected[5 * v + 1] + || vc != expected[5 * v + 2] || vd != expected[5 * v + 3] + || ve != expected[5 * v + 4]) + abort (); + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr46019.c b/gcc/testsuite/gcc.c-torture/execute/pr46019.c new file mode 100644 index 000000000..b0365576a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr46019.c @@ -0,0 +1,14 @@ +/* PR middle-end/46019 */ + +extern void abort (void); + +int +main (void) +{ + unsigned long long l = 0x40000000000ULL; + int n; + for (n = 0; n < 8; n++) + if (l / (0x200000000ULL << n) != (0x200 >> n)) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr46316.c b/gcc/testsuite/gcc.c-torture/execute/pr46316.c new file mode 100644 index 000000000..7aafaa740 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr46316.c @@ -0,0 +1,17 @@ +extern void abort (void); + +long long __attribute__((noinline,noclone)) +foo (long long t) +{ + while (t > -4) + t -= 2; + + return t; +} + +int main(void) +{ + if (foo (0) != -4) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr46909-1.c b/gcc/testsuite/gcc.c-torture/execute/pr46909-1.c new file mode 100644 index 000000000..c6c92fcbb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr46909-1.c @@ -0,0 +1,22 @@ +/* PR tree-optimization/46909 */ + +extern void abort (); + +int +__attribute__ ((__noinline__)) +foo (unsigned int x) +{ + if (! (x == 4 || x == 6) || (x == 2 || x == 6)) + return 1; + return -1; +} + +int +main () +{ + int i; + for (i = -10; i < 10; i++) + if (foo (i) != 1 - 2 * (i == 4)) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr46909-2.c b/gcc/testsuite/gcc.c-torture/execute/pr46909-2.c new file mode 100644 index 000000000..33da2189c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr46909-2.c @@ -0,0 +1,22 @@ +/* PR tree-optimization/46909 */ + +extern void abort (void); + +int +__attribute__((noinline)) +foo (int x) +{ + if ((x != 0 && x != 13) || x == 5 || x == 20) + return 1; + return -1; +} + +int +main (void) +{ + int i; + for (i = -10; i < 30; i++) + if (foo (i) != 1 - 2 * (i == 0) - 2 * (i == 13)) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr47148.c b/gcc/testsuite/gcc.c-torture/execute/pr47148.c new file mode 100644 index 000000000..8363631a9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr47148.c @@ -0,0 +1,32 @@ +/* PR tree-optimization/47148 */ + +static inline unsigned +bar (unsigned x, unsigned y) +{ + if (y >= 32) + return x; + else + return x >> y; +} + +static unsigned a = 1, b = 1; + +static inline void +foo (unsigned char x, unsigned y) +{ + if (!y) + return; + unsigned c = (0x7000U / (x - 2)) ^ a; + unsigned d = bar (a, a); + b &= ((a - d) && (a - 1)) + c; +} + +int +main (void) +{ + foo (1, 1); + foo (-1, 1); + if (b && ((unsigned char) -1) == 255) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr47155.c b/gcc/testsuite/gcc.c-torture/execute/pr47155.c new file mode 100644 index 000000000..6210a2fee --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr47155.c @@ -0,0 +1,14 @@ +/* PR tree-optimization/47155 */ + +unsigned int a; +static signed char b = -127; +int c = 1; + +int +main (void) +{ + a = b <= (unsigned char) (-6 * c); + if (!a) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr47237.c b/gcc/testsuite/gcc.c-torture/execute/pr47237.c new file mode 100644 index 000000000..2100e1540 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr47237.c @@ -0,0 +1,22 @@ +#define INTEGER_ARG 5 + +extern void abort(void); + +static void foo(int arg) +{ + if (arg != INTEGER_ARG) + abort(); +} + +static void bar(int arg) +{ + foo(arg); + __builtin_apply(foo, __builtin_apply_args(), 16); +} + +int main(void) +{ + bar(INTEGER_ARG); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr47299.c b/gcc/testsuite/gcc.c-torture/execute/pr47299.c new file mode 100644 index 000000000..4f3d1f9cb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr47299.c @@ -0,0 +1,17 @@ +/* PR rtl-optimization/47299 */ + +extern void abort (void); + +__attribute__ ((noinline, noclone)) unsigned short +foo (unsigned char x) +{ + return x * 255; +} + +int +main () +{ + if (foo (0x40) != 0x3fc0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr47337.c b/gcc/testsuite/gcc.c-torture/execute/pr47337.c new file mode 100644 index 000000000..ea88484a2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr47337.c @@ -0,0 +1,86 @@ +/* PR rtl-optimization/47337 */ + +static unsigned int a[256], b = 0; +static char c = 0; +static int d = 0, *f = &d; +static long long e = 0; + +static short +foo (long long x, long long y) +{ + return x / y; +} + +static char +bar (char x, char y) +{ + return x - y; +} + +static int +baz (int x, int y) +{ + *f = (y != (short) (y * 3)); + for (c = 0; c < 2; c++) + { + lab: + if (d) + { + if (e) + e = 1; + else + return x; + } + else + { + d = 1; + goto lab; + } + f = &d; + } + return x; +} + +static void +fnx (unsigned long long x, int y) +{ + if (!y) + { + b = a[b & 1]; + b = a[b & 1]; + b = a[(b ^ (x & 1)) & 1]; + b = a[(b ^ (x & 1)) & 1]; + } +} + +char *volatile w = "2"; + +int +main () +{ + int h = 0; + unsigned int k = 0; + int l[8]; + int i, j; + + if (__builtin_strcmp (w, "1") == 0) + h = 1; + + for (i = 0; i < 256; i++) + { + for (j = 8; j > 0; j--) + k = 1; + a[i] = k; + } + for (i = 0; i < 8; i++) + l[i] = 0; + + d = bar (c, c); + d = baz (c, 1 | foo (l[0], 10)); + fnx (d, h); + fnx (e, h); + + if (d != 0) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr47538.c b/gcc/testsuite/gcc.c-torture/execute/pr47538.c new file mode 100644 index 000000000..99dea0843 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr47538.c @@ -0,0 +1,73 @@ +/* PR tree-optimization/47538 */ + +struct S +{ + double a, b, *c; + unsigned long d; +}; + +__attribute__((noinline, noclone)) void +foo (struct S *x, const struct S *y) +{ + const unsigned long n = y->d + 1; + const double m = 0.25 * (y->b - y->a); + x->a = y->a; + x->b = y->b; + if (n == 1) + { + x->c[0] = 0.; + } + else if (n == 2) + { + x->c[1] = m * y->c[0]; + x->c[0] = 2.0 * x->c[1]; + } + else + { + double o = 0.0, p = 1.0; + unsigned long i; + + for (i = 1; i <= n - 2; i++) + { + x->c[i] = m * (y->c[i - 1] - y->c[i + 1]) / (double) i; + o += p * x->c[i]; + p = -p; + } + x->c[n - 1] = m * y->c[n - 2] / (n - 1.0); + o += p * x->c[n - 1]; + x->c[0] = 2.0 * o; + } +} + +int +main (void) +{ + struct S x, y; + double c[4] = { 10, 20, 30, 40 }, d[4], e[4] = { 118, 118, 118, 118 }; + + y.a = 10; + y.b = 6; + y.c = c; + x.c = d; + y.d = 3; + __builtin_memcpy (d, e, sizeof d); + foo (&x, &y); + if (d[0] != 0 || d[1] != 20 || d[2] != 10 || d[3] != -10) + __builtin_abort (); + y.d = 2; + __builtin_memcpy (d, e, sizeof d); + foo (&x, &y); + if (d[0] != 60 || d[1] != 20 || d[2] != -10 || d[3] != 118) + __builtin_abort (); + y.d = 1; + __builtin_memcpy (d, e, sizeof d); + foo (&x, &y); + if (d[0] != -20 || d[1] != -10 || d[2] != 118 || d[3] != 118) + __builtin_abort (); + y.d = 0; + __builtin_memcpy (d, e, sizeof d); + foo (&x, &y); + if (d[0] != 0 || d[1] != 118 || d[2] != 118 || d[3] != 118) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr47925.c b/gcc/testsuite/gcc.c-torture/execute/pr47925.c new file mode 100644 index 000000000..89f54c13a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr47925.c @@ -0,0 +1,24 @@ +struct s { volatile struct s *next; }; + +void __attribute__((noinline)) +bar (int ignored, int n) +{ + asm volatile (""); +} + +int __attribute__((noinline)) +foo (volatile struct s *ptr, int n) +{ + int i; + + bar (0, n); + for (i = 0; i < n; i++) + ptr = ptr->next; +} + +int main (void) +{ + volatile struct s rec = { &rec }; + foo (&rec, 10); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr48197.c b/gcc/testsuite/gcc.c-torture/execute/pr48197.c new file mode 100644 index 000000000..37812c07b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr48197.c @@ -0,0 +1,25 @@ +/* PR c/48197 */ + +extern void abort (void); +static int y = 0x8000; + +int +main () +{ + unsigned int x = (short)y; + if (sizeof (0LL) == sizeof (0U)) + return 0; + if (0LL > (0U ^ (short)-0x8000)) + abort (); + if (0LL > (0U ^ x)) + abort (); + if (0LL > (0U ^ (short)y)) + abort (); + if ((0U ^ (short)-0x8000) < 0LL) + abort (); + if ((0U ^ x) < 0LL) + abort (); + if ((0U ^ (short)y) < 0LL) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr48717.c b/gcc/testsuite/gcc.c-torture/execute/pr48717.c new file mode 100644 index 000000000..a746374a2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr48717.c @@ -0,0 +1,26 @@ +/* PR tree-optimization/48717 */ + +extern void abort (void); + +int v = 1, w; + +unsigned short +foo (unsigned short x, unsigned short y) +{ + return x + y; +} + +void +bar (void) +{ + v = foo (~w, w); +} + +int +main () +{ + bar (); + if (v != (unsigned short) -1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr48809.c b/gcc/testsuite/gcc.c-torture/execute/pr48809.c new file mode 100644 index 000000000..80de5bc8a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr48809.c @@ -0,0 +1,60 @@ +/* PR tree-optimization/48809 */ + +extern void abort (void); + +int +foo (signed char x) +{ + int y = 0; + switch (x) + { + case 0: y = 1; break; + case 1: y = 7; break; + case 2: y = 2; break; + case 3: y = 19; break; + case 4: y = 5; break; + case 5: y = 17; break; + case 6: y = 31; break; + case 7: y = 8; break; + case 8: y = 28; break; + case 9: y = 16; break; + case 10: y = 31; break; + case 11: y = 12; break; + case 12: y = 15; break; + case 13: y = 111; break; + case 14: y = 17; break; + case 15: y = 10; break; + case 16: y = 31; break; + case 17: y = 7; break; + case 18: y = 2; break; + case 19: y = 19; break; + case 20: y = 5; break; + case 21: y = 107; break; + case 22: y = 31; break; + case 23: y = 8; break; + case 24: y = 28; break; + case 25: y = 106; break; + case 26: y = 31; break; + case 27: y = 102; break; + case 28: y = 105; break; + case 29: y = 111; break; + case 30: y = 17; break; + case 31: y = 10; break; + case 32: y = 31; break; + case 98: y = 18; break; + case -62: y = 19; break; + } + return y; +} + +int +main () +{ + if (foo (98) != 18 || foo (97) != 0 || foo (99) != 0) + abort (); + if (foo (-62) != 19 || foo (-63) != 0 || foo (-61) != 0) + abort (); + if (foo (28) != 105 || foo (27) != 102 || foo (29) != 111) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr48973-1.c b/gcc/testsuite/gcc.c-torture/execute/pr48973-1.c new file mode 100644 index 000000000..02688a0ea --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr48973-1.c @@ -0,0 +1,20 @@ +/* PR middle-end/48973 */ + +extern void abort (void); +struct S { int f : 1; } s; +int v = -1; + +void +foo (unsigned int x) +{ + if (x != -1U) + abort (); +} + +int +main () +{ + s.f = (v & 1) > 0; + foo (s.f); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr48973-2.c b/gcc/testsuite/gcc.c-torture/execute/pr48973-2.c new file mode 100644 index 000000000..a64d4918e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr48973-2.c @@ -0,0 +1,14 @@ +/* PR middle-end/48973 */ + +extern void abort (void); +struct S { int f : 1; } s; +int v = -1; + +int +main () +{ + s.f = v < 0; + if ((unsigned int) s.f != -1U) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr49039.c b/gcc/testsuite/gcc.c-torture/execute/pr49039.c new file mode 100644 index 000000000..546d114fe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr49039.c @@ -0,0 +1,26 @@ +/* PR tree-optimization/49039 */ +extern void abort (void); +int cnt; + +__attribute__((noinline, noclone)) void +foo (unsigned int x, unsigned int y) +{ + unsigned int minv, maxv; + if (x == 1 || y == -2U) + return; + minv = x < y ? x : y; + maxv = x > y ? x : y; + if (minv == 1) + ++cnt; + if (maxv == -2U) + ++cnt; +} + +int +main () +{ + foo (-2U, 1); + if (cnt != 2) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr49073.c b/gcc/testsuite/gcc.c-torture/execute/pr49073.c new file mode 100644 index 000000000..92b923b82 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr49073.c @@ -0,0 +1,26 @@ +/* PR tree-optimization/49073 */ + +extern void abort (void); +int a[] = { 1, 2, 3, 4, 5, 6, 7 }, c; + +int +main () +{ + int d = 1, i = 1; + _Bool f = 0; + do + { + d = a[i]; + if (f && d == 4) + { + ++c; + break; + } + i++; + f = (d == 3); + } + while (d < 7); + if (c != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr49123.c b/gcc/testsuite/gcc.c-torture/execute/pr49123.c new file mode 100644 index 000000000..2f1f7935d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr49123.c @@ -0,0 +1,14 @@ +/* PR lto/49123 */ + +extern void abort (void); +static struct S { int f : 1; } s; +static int v = -1; + +int +main () +{ + s.f = v < 0; + if ((unsigned int) s.f != -1U) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr49161.c b/gcc/testsuite/gcc.c-torture/execute/pr49161.c new file mode 100644 index 000000000..cc822dae8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr49161.c @@ -0,0 +1,46 @@ +/* PR tree-optimization/49161 */ + +extern void abort (void); + +int c; + +__attribute__((noinline, noclone)) void +bar (int x) +{ + if (x != c++) + abort (); +} + +__attribute__((noinline, noclone)) void +foo (int x) +{ + switch (x) + { + case 3: goto l1; + case 4: goto l2; + case 6: goto l3; + default: return; + } +l1: + goto l4; +l2: + goto l4; +l3: + bar (-1); +l4: + bar (0); + if (x != 4) + bar (1); + if (x != 3) + bar (-1); + bar (2); +} + +int +main () +{ + foo (3); + if (c != 3) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr49186.c b/gcc/testsuite/gcc.c-torture/execute/pr49186.c new file mode 100644 index 000000000..743815b98 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr49186.c @@ -0,0 +1,15 @@ +/* PR target/49186 */ +extern void abort (void); + +int +main () +{ + int x; + unsigned long long uv = 0x1000000001ULL; + + x = (uv < 0x80) ? 1 : ((uv < 0x800) ? 2 : 3); + if (x != 3) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr49218.c b/gcc/testsuite/gcc.c-torture/execute/pr49218.c new file mode 100644 index 000000000..2fb18dda7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr49218.c @@ -0,0 +1,20 @@ +#ifdef __SIZEOF_INT128__ +typedef __int128 L; +#else +typedef long long L; +#endif +float f; + +int +main () +{ + L i = f; + if (i <= 10) + do + { + ++i; + asm (""); + } + while (i != 11); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr49279.c b/gcc/testsuite/gcc.c-torture/execute/pr49279.c new file mode 100644 index 000000000..7f2c0d221 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr49279.c @@ -0,0 +1,35 @@ +/* PR tree-optimization/49279 */ +extern void abort (void); + +struct S { int a; int *__restrict p; }; + +__attribute__((noinline, noclone)) +struct S *bar (struct S *p) +{ + struct S *r; + asm volatile ("" : "=r" (r) : "0" (p) : "memory"); + return r; +} + +__attribute__((noinline, noclone)) +int +foo (int *p, int *q) +{ + struct S s, *t; + s.a = 1; + s.p = p; + t = bar (&s); + t->p = q; + s.p[0] = 0; + t->p[0] = 1; + return s.p[0]; +} + +int +main () +{ + int a, b; + if (foo (&a, &b) != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr49390.c b/gcc/testsuite/gcc.c-torture/execute/pr49390.c new file mode 100644 index 000000000..dfcdea16f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr49390.c @@ -0,0 +1,88 @@ +/* PR rtl-optimization/49390 */ + +struct S { unsigned int s1; unsigned int s2; }; +struct T { unsigned int t1; struct S t2; }; +struct U { unsigned short u1; unsigned short u2; }; +struct V { struct U v1; struct T v2; }; +struct S a; +char *b; +union { char b[64]; struct V v; } u; +volatile int v; +extern void abort (void); + +__attribute__((noinline, noclone)) void +foo (int x, void *y, unsigned int z, unsigned int w) +{ + if (x != 4 || y != (void *) &u.v.v2) + abort (); + v = z + w; + v = 16384; +} + +__attribute__((noinline, noclone)) void +bar (struct S x) +{ + v = x.s1; + v = x.s2; +} + +__attribute__((noinline, noclone)) int +baz (struct S *x) +{ + v = x->s1; + v = x->s2; + v = 0; + return v + 1; +} + +__attribute__((noinline, noclone)) void +test (struct S *c) +{ + struct T *d; + struct S e = a; + unsigned int f, g; + if (c == 0) + c = &e; + else + { + if (c->s2 % 8192 <= 15 || (8192 - c->s2 % 8192) <= 31) + foo (1, 0, c->s1, c->s2); + } + if (!baz (c)) + return; + g = (((struct U *) b)->u2 & 2) ? 32 : __builtin_offsetof (struct V, v2); + f = c->s2 % 8192; + if (f == 0) + { + e.s2 += g; + f = g; + } + else if (f < g) + { + foo (2, 0, c->s1, c->s2); + return; + } + if ((((struct U *) b)->u2 & 1) && f == g) + { + bar (*c); + foo (3, 0, c->s1, c->s2); + return; + } + d = (struct T *) (b + c->s2 % 8192); + if (d->t2.s1 >= c->s1 && (d->t2.s1 != c->s1 || d->t2.s2 >= c->s2)) + foo (4, d, c->s1, c->s2); + return; +} + +int +main () +{ + struct S *c = 0; + asm ("" : "+r" (c) : "r" (&a)); + u.v.v2.t2.s1 = 8192; + b = u.b; + test (c); + if (v != 16384) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr49419.c b/gcc/testsuite/gcc.c-torture/execute/pr49419.c new file mode 100644 index 000000000..fddc16462 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr49419.c @@ -0,0 +1,38 @@ +/* PR tree-optimization/49419 */ + +extern void abort (void); + +struct S { int w, x, y; } *t; + +int +foo (int n, int f, int *s, int m) +{ + int x, i, a; + if (n == -1) + return 0; + for (x = n, i = 0; t[x].w == f && i < m; i++) + x = t[x].x; + if (i == m) + abort (); + a = i + 1; + for (x = n; i > 0; i--) + { + s[i] = t[x].y; + x = t[x].x; + } + s[0] = x; + return a; +} + +int +main (void) +{ + int s[3], i; + struct S buf[3] = { { 1, 1, 2 }, { 0, 0, 0 }, { 0, 0, 0 } }; + t = buf; + if (foo (0, 1, s, 3) != 2) + abort (); + if (s[0] != 1 || s[1] != 2) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr49644.c b/gcc/testsuite/gcc.c-torture/execute/pr49644.c new file mode 100644 index 000000000..88be23c40 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr49644.c @@ -0,0 +1,16 @@ +/* PR c/49644 */ + +extern void abort (void); + +int +main () +{ + _Complex double a[12], *c = a, s = 3.0 + 1.0i; + double b[12] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }, *d = b; + int i; + for (i = 0; i < 6; i++) + *c++ = *d++ * s; + if (c != a + 6 || d != b + 6) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr49768.c b/gcc/testsuite/gcc.c-torture/execute/pr49768.c new file mode 100644 index 000000000..85bc9d2a0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr49768.c @@ -0,0 +1,12 @@ +/* PR tree-optimization/49768 */ + +extern void abort (void); + +int +main () +{ + static struct { unsigned int : 1; unsigned int s : 1; } s = { .s = 1 }; + if (s.s != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr51323.c b/gcc/testsuite/gcc.c-torture/execute/pr51323.c new file mode 100644 index 000000000..929579983 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr51323.c @@ -0,0 +1,35 @@ +/* PR middle-end/51323 */ + +extern void abort (void); +struct S { int a, b, c; }; +int v; + +__attribute__((noinline, noclone)) void +foo (int x, int y, int z) +{ + if (x != v || y != 0 || z != 9) + abort (); +} + +static inline int +baz (const struct S *p) +{ + return p->b; +} + +__attribute__((noinline, noclone)) void +bar (int x, struct S y) +{ + foo (baz (&y), 0, x); +} + +int +main () +{ + struct S s; + v = 3; s.a = v - 1; s.b = v; s.c = v + 1; + bar (9, s); + v = 17; s.a = v - 1; s.b = v; s.c = v + 1; + bar (9, s); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr51466.c b/gcc/testsuite/gcc.c-torture/execute/pr51466.c new file mode 100644 index 000000000..aa0b7fd4f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr51466.c @@ -0,0 +1,43 @@ +/* PR tree-optimization/51466 */ + +extern void abort (void); + +__attribute__((noinline, noclone)) int +foo (int i) +{ + volatile int v[4]; + int *p; + v[i] = 6; + p = (int *) &v[i]; + return *p; +} + +__attribute__((noinline, noclone)) int +bar (int i) +{ + volatile int v[4]; + int *p; + v[i] = 6; + p = (int *) &v[i]; + *p = 8; + return v[i]; +} + +__attribute__((noinline, noclone)) int +baz (int i) +{ + volatile int v[4]; + int *p; + v[i] = 6; + p = (int *) &v[0]; + *p = 8; + return v[i]; +} + +int +main () +{ + if (foo (3) != 6 || bar (2) != 8 || baz (0) != 8 || baz (1) != 6) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr52129.c b/gcc/testsuite/gcc.c-torture/execute/pr52129.c new file mode 100644 index 000000000..a60bfa8bb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr52129.c @@ -0,0 +1,28 @@ +/* PR target/52129 */ + +extern void abort (void); +struct S { void *p; unsigned int q; }; +struct T { char a[64]; char b[64]; } t; + +__attribute__((noinline, noclone)) int +foo (void *x, struct S s, void *y, void *z) +{ + if (x != &t.a[2] || s.p != &t.b[5] || s.q != 27 || y != &t.a[17] || z != &t.b[17]) + abort (); + return 29; +} + +__attribute__((noinline, noclone)) int +bar (void *x, void *y, void *z, struct S s, int t, struct T *u) +{ + return foo (x, s, &u->a[t], &u->b[t]); +} + +int +main () +{ + struct S s = { &t.b[5], 27 }; + if (bar (&t.a[2], (void *) 0, (void *) 0, s, 17, &t) != 29) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr52286.c b/gcc/testsuite/gcc.c-torture/execute/pr52286.c new file mode 100644 index 000000000..bb56295ab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr52286.c @@ -0,0 +1,20 @@ +/* PR tree-optimization/52286 */ + +extern void abort (void); + +int +main () +{ +#if __SIZEOF_INT__ > 2 + int a, b; + asm ("" : "=r" (a) : "0" (0)); + b = (~a | 1) & -2038094497; +#else + long a, b; + asm ("" : "=r" (a) : "0" (0)); + b = (~a | 1) & -2038094497L; +#endif + if (b >= 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr53084.c b/gcc/testsuite/gcc.c-torture/execute/pr53084.c new file mode 100644 index 000000000..1afc016df --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr53084.c @@ -0,0 +1,18 @@ +/* PR middle-end/53084 */ + +extern void abort (void); + +__attribute__((noinline, noclone)) void +bar (const char *p) +{ + if (p[0] != 'o' || p[1] != 'o' || p[2]) + abort (); +} + +int +main () +{ + static const char *const foo[] = {"foo" + 1}; + bar (foo[0]); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr7284-1.c b/gcc/testsuite/gcc.c-torture/execute/pr7284-1.c new file mode 100644 index 000000000..de0057ceb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr7284-1.c @@ -0,0 +1,24 @@ +/* Signed left-shift is implementation-defined in C89 (and see + DR#081), not undefined. Bug 7284 from Al Grant (AlGrant at + myrealbox.com). */ + +/* { dg-options "-std=c89" } */ + +extern void abort (void); +extern void exit (int); + +int +f (int n) +{ + return (n << 24) / (1 << 23); +} + +volatile int x = 128; + +int +main (void) +{ + if (f(x) != -256) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr7284-1.x b/gcc/testsuite/gcc.c-torture/execute/pr7284-1.x new file mode 100644 index 000000000..121fcfecc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr7284-1.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_int16] } { + return 1 +} + +return 0; diff --git a/gcc/testsuite/gcc.c-torture/execute/printf-1.c b/gcc/testsuite/gcc.c-torture/execute/printf-1.c new file mode 100644 index 000000000..0ffcd5d44 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/printf-1.c @@ -0,0 +1,23 @@ +#include +#include + +int +main (void) +{ +#define test(ret, args...) \ + printf (args); \ + if (printf (args) != ret) \ + abort (); + test (5, "hello"); + test (6, "hello\n"); + test (1, "a"); + test (0, ""); + test (5, "%s", "hello"); + test (6, "%s", "hello\n"); + test (1, "%s", "a"); + test (0, "%s", ""); + test (1, "%c", 'x'); + test (7, "%s\n", "hello\n"); + test (2, "%d\n", 0); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/printf-chk-1.c b/gcc/testsuite/gcc.c-torture/execute/printf-chk-1.c new file mode 100644 index 000000000..8f9a79c5c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/printf-chk-1.c @@ -0,0 +1,49 @@ +#include +#include +#include + +volatile int should_optimize; + +int +__attribute__((noinline)) +__printf_chk (int flag, const char *fmt, ...) +{ + va_list ap; + int ret; +#ifdef __OPTIMIZE__ + if (should_optimize) + abort (); +#endif + should_optimize = 1; + va_start (ap, fmt); + ret = vprintf (fmt, ap); + va_end (ap); + return ret; +} + +int +main (void) +{ +#define test(ret, opt, args...) \ + should_optimize = opt; \ + __printf_chk (1, args); \ + if (!should_optimize) \ + abort (); \ + should_optimize = 0; \ + if (__printf_chk (1, args) != ret) \ + abort (); \ + if (!should_optimize) \ + abort (); + test (5, 0, "hello"); + test (6, 1, "hello\n"); + test (1, 1, "a"); + test (0, 1, ""); + test (5, 0, "%s", "hello"); + test (6, 1, "%s", "hello\n"); + test (1, 1, "%s", "a"); + test (0, 1, "%s", ""); + test (1, 1, "%c", 'x'); + test (7, 1, "%s\n", "hello\n"); + test (2, 0, "%d\n", 0); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pta-field-1.c b/gcc/testsuite/gcc.c-torture/execute/pta-field-1.c new file mode 100644 index 000000000..b03dff9b1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pta-field-1.c @@ -0,0 +1,29 @@ +struct Foo { + int *p; + int *q; +}; + +void __attribute__((noinline)) +bar (int **x) +{ + struct Foo *f = (struct Foo *)x; + *(f->q) = 0; +} + +int foo(void) +{ + struct Foo f; + int i = 1, j = 2; + f.p = &i; + f.q = &j; + bar(&f.p); + return j; +} + +extern void abort (void); +int main() +{ + if (foo () != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pta-field-2.c b/gcc/testsuite/gcc.c-torture/execute/pta-field-2.c new file mode 100644 index 000000000..dffd7154c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pta-field-2.c @@ -0,0 +1,29 @@ +struct Foo { + int *p; + int *q; +}; + +void __attribute__((noinline)) +bar (int **x) +{ + struct Foo *f = (struct Foo *)(x - 1); + *(f->p) = 0; +} + +int foo(void) +{ + struct Foo f; + int i = 1, j = 2; + f.p = &i; + f.q = &j; + bar(&f.q); + return i; +} + +extern void abort (void); +int main() +{ + if (foo () != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ptr-arith-1.c b/gcc/testsuite/gcc.c-torture/execute/ptr-arith-1.c new file mode 100644 index 000000000..46162b896 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ptr-arith-1.c @@ -0,0 +1,14 @@ +char * +f (char *s, unsigned int i) +{ + return &s[i + 3 - 1]; +} + +main () +{ + char *str = "abcdefghijkl"; + char *x2 = f (str, 12); + if (str + 14 != x2) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pure-1.c b/gcc/testsuite/gcc.c-torture/execute/pure-1.c new file mode 100644 index 000000000..174477e57 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pure-1.c @@ -0,0 +1,91 @@ + +/* Origin: Kaveh Ghazi 2002-05-27. */ + +/* Use a different function for each test so the link failures + indicate which one is broken. */ +extern void link_error0 (void); +extern void link_error1 (void); +extern void link_error2 (void); +extern void link_error3 (void); +extern void link_error4 (void); +extern void link_error5 (void); +extern void link_error6 (void); +extern void link_error7 (void); + +extern int i; + +extern int func0 (int) __attribute__ ((__pure__)); +extern int func1 (int) __attribute__ ((__const__)); + +/* GCC should automatically detect attributes for these functions. + At -O3 They'll be inlined, but that's ok. */ +static int func2 (int a) { return i + a; } /* pure */ +static int func3 (int a) { return a * 3; } /* const */ +static int func4 (int a) { return func0(a) + a; } /* pure */ +static int func5 (int a) { return a + func1(a); } /* const */ +static int func6 (int a) { return func2(a) + a; } /* pure */ +static int func7 (int a) { return a + func3(a); } /* const */ + +int main () +{ + int i[10], r; + + i[0] = 0; + r = func0(0); + if (i[0]) + link_error0(); + + i[1] = 0; + r = func1(0); + if (i[1]) + link_error1(); + + i[2] = 0; + r = func2(0); + if (i[2]) + link_error2(); + + i[3] = 0; + r = func3(0); + if (i[3]) + link_error3(); + + i[4] = 0; + r = func4(0); + if (i[4]) + link_error4(); + + i[5] = 0; + r = func5(0); + if (i[5]) + link_error5(); + + i[6] = 0; + r = func6(0); + if (i[6]) + link_error6(); + + i[7] = 0; + r = func7(0); + if (i[7]) + link_error7(); + + return r; +} + +int func0 (int a) { return a - i; } /* pure */ +int func1 (int a) { return a - a; } /* const */ + +int i = 2; + +#ifndef __OPTIMIZE__ +/* Avoid link failures when not optimizing. */ +void link_error0() {} +void link_error1() {} +void link_error2() {} +void link_error3() {} +void link_error4() {} +void link_error5() {} +void link_error6() {} +void link_error7() {} +#endif /* ! __OPTIMIZE__ */ diff --git a/gcc/testsuite/gcc.c-torture/execute/pushpop_macro.c b/gcc/testsuite/gcc.c-torture/execute/pushpop_macro.c new file mode 100644 index 000000000..08a822043 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pushpop_macro.c @@ -0,0 +1,15 @@ +extern void abort (); + +#define _ 2 +#pragma push_macro("_") +#undef _ +#define _ 1 +#pragma pop_macro("_") + +int main () +{ + if (_ != 2) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/regstack-1.c b/gcc/testsuite/gcc.c-torture/execute/regstack-1.c new file mode 100644 index 000000000..51fb858cf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/regstack-1.c @@ -0,0 +1,26 @@ +long double C = 5; +long double U = 1; +long double Y2 = 11; +long double Y1 = 17; +long double X, Y, Z, T, R, S; +main () +{ + X = (C + U) * Y2; + Y = C - U - U; + Z = C + U + U; + T = (C - U) * Y1; + X = X - (Z + U); + R = Y * Y1; + S = Z * Y2; + T = T - Y; + Y = (U - Y) + R; + Z = S - (Z + U + U); + R = (Y2 + U) * Y1; + Y1 = Y2 * Y1; + R = R - Y2; + Y1 = Y1 - 0.5L; + if (Z != 68. || Y != 49. || X != 58. || Y1 != 186.5 || R != 193. || S != 77. + || T != 65. || Y2 != 11.) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/restrict-1.c b/gcc/testsuite/gcc.c-torture/execute/restrict-1.c new file mode 100644 index 000000000..3c5696cb5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/restrict-1.c @@ -0,0 +1,30 @@ +/* PR rtl-optimization/16536 + Origin: Jeremy Denise + Reduced: Wolfgang Bangerth + Volker Reichelt */ + +extern void abort (); + +typedef struct +{ + int i, dummy; +} A; + +inline A foo (const A* p, const A* q) +{ + return (A){p->i+q->i}; +} + +void bar (A* __restrict__ p) +{ + *p=foo(p,p); + if (p->i!=2) + abort(); +} + +int main () +{ + A a={1}; + bar(&a); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/scope-1.c b/gcc/testsuite/gcc.c-torture/execute/scope-1.c new file mode 100644 index 000000000..cedd0b48c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/scope-1.c @@ -0,0 +1,17 @@ +int v = 3; + +f () +{ + int v = 4; + { + extern int v; + if (v != 3) + abort (); + } +} + +main () +{ + f (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/shiftdi.c b/gcc/testsuite/gcc.c-torture/execute/shiftdi.c new file mode 100644 index 000000000..44f0dfc2b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/shiftdi.c @@ -0,0 +1,20 @@ +/* Failed on sparc with -mv8plus because sparc.c:set_extends() thought + erroneously that SImode ASHIFT chops the upper bits, it does not. */ + +typedef unsigned long long uint64; + +void g(uint64 x, int y, int z, uint64 *p) +{ + unsigned w = ((x >> y) & 0xffffffffULL) << (z & 0x1f); + *p |= (w & 0xffffffffULL) << z; +} + +int main(void) +{ + uint64 a = 0; + g(0xdeadbeef01234567ULL, 0, 0, &a); + return (a == 0x01234567) ? 0 : 1; +} + + + diff --git a/gcc/testsuite/gcc.c-torture/execute/shiftdi.x b/gcc/testsuite/gcc.c-torture/execute/shiftdi.x new file mode 100644 index 000000000..121fcfecc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/shiftdi.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_int16] } { + return 1 +} + +return 0; diff --git a/gcc/testsuite/gcc.c-torture/execute/shiftopt-1.c b/gcc/testsuite/gcc.c-torture/execute/shiftopt-1.c new file mode 100644 index 000000000..8c855b888 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/shiftopt-1.c @@ -0,0 +1,67 @@ +/* Copyright (C) 2002 Free Software Foundation + + Check that constant folding of shift operations is working. + + Roger Sayle, 10th October 2002. */ + +extern void abort (void); +extern void link_error (void); + +void +utest (unsigned int x) +{ + if (x >> 0 != x) + link_error (); + + if (x << 0 != x) + link_error (); + + if (0 << x != 0) + link_error (); + + if (0 >> x != 0) + link_error (); + + if (-1 >> x != -1) + link_error (); + + if (~0 >> x != ~0) + link_error (); +} + +void +stest (int x) +{ + if (x >> 0 != x) + link_error (); + + if (x << 0 != x) + link_error (); + + if (0 << x != 0) + link_error (); + + if (0 >> x != 0) + link_error (); +} + +int +main () +{ + utest(9); + utest(0); + + stest(9); + stest(0); + + return 0; +} + +#ifndef __OPTIMIZE__ +void +link_error () +{ + abort (); +} +#endif + diff --git a/gcc/testsuite/gcc.c-torture/execute/simd-1.c b/gcc/testsuite/gcc.c-torture/execute/simd-1.c new file mode 100644 index 000000000..97d820697 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/simd-1.c @@ -0,0 +1,74 @@ +/* Origin: Aldy Hernandez + + Purpose: Test generic SIMD support. This test should work + regardless of if the target has SIMD instructions. +*/ + +typedef int __attribute__((mode(SI))) __attribute__((vector_size (16))) vecint; +typedef int __attribute__((mode(SI))) siint; + +vecint i = { 150, 100, 150, 200 }; +vecint j = { 10, 13, 20, 30 }; +vecint k; + +union { + vecint v; + siint i[4]; +} res; + +/* This should go away once we can use == and != on vector types. */ +void +verify (siint a1, siint a2, siint a3, siint a4, + siint b1, siint b2, siint b3, siint b4) +{ + if (a1 != b1 + || a2 != b2 + || a3 != b3 + || a4 != b4) + abort (); +} + +int +main () +{ + k = i + j; + res.v = k; + + verify (res.i[0], res.i[1], res.i[2], res.i[3], 160, 113, 170, 230); + + k = i * j; + res.v = k; + + verify (res.i[0], res.i[1], res.i[2], res.i[3], 1500, 1300, 3000, 6000); + + k = i / j; + res.v = k; + + verify (res.i[0], res.i[1], res.i[2], res.i[3], 15, 7, 7, 6); + + k = i & j; + res.v = k; + + verify (res.i[0], res.i[1], res.i[2], res.i[3], 2, 4, 20, 8); + + k = i | j; + res.v = k; + + verify (res.i[0], res.i[1], res.i[2], res.i[3], 158, 109, 150, 222); + + k = i ^ j; + res.v = k; + + verify (res.i[0], res.i[1], res.i[2], res.i[3], 156, 105, 130, 214); + + k = -i; + res.v = k; + verify (res.i[0], res.i[1], res.i[2], res.i[3], + -150, -100, -150, -200); + + k = ~i; + res.v = k; + verify (res.i[0], res.i[1], res.i[2], res.i[3], -151, -101, -151, -201); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/simd-2.c b/gcc/testsuite/gcc.c-torture/execute/simd-2.c new file mode 100644 index 000000000..d4f506a76 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/simd-2.c @@ -0,0 +1,72 @@ +/* + Purpose: Test generic SIMD support, V8HImode. This test should work + regardless of if the target has SIMD instructions. +*/ + +typedef short __attribute__((vector_size (16))) vecint; + +vecint i = { 150, 100, 150, 200, 0, 0, 0, 0 }; +vecint j = { 10, 13, 20, 30, 1, 1, 1, 1 }; +vecint k; + +union { + vecint v; + short i[8]; +} res; + +/* This should go away once we can use == and != on vector types. */ +void +verify (int a1, int a2, int a3, int a4, + int b1, int b2, int b3, int b4) +{ + if (a1 != b1 + || a2 != b2 + || a3 != b3 + || a4 != b4) + abort (); +} + +int +main () +{ + k = i + j; + res.v = k; + + verify (res.i[0], res.i[1], res.i[2], res.i[3], 160, 113, 170, 230); + + k = i * j; + res.v = k; + + verify (res.i[0], res.i[1], res.i[2], res.i[3], 1500, 1300, 3000, 6000); + + k = i / j; + res.v = k; + + verify (res.i[0], res.i[1], res.i[2], res.i[3], 15, 7, 7, 6); + + k = i & j; + res.v = k; + + verify (res.i[0], res.i[1], res.i[2], res.i[3], 2, 4, 20, 8); + + k = i | j; + res.v = k; + + verify (res.i[0], res.i[1], res.i[2], res.i[3], 158, 109, 150, 222); + + k = i ^ j; + res.v = k; + + verify (res.i[0], res.i[1], res.i[2], res.i[3], 156, 105, 130, 214); + + k = -i; + res.v = k; + verify (res.i[0], res.i[1], res.i[2], res.i[3], + -150, -100, -150, -200); + + k = ~i; + res.v = k; + verify (res.i[0], res.i[1], res.i[2], res.i[3], -151, -101, -151, -201); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/simd-4.c b/gcc/testsuite/gcc.c-torture/execute/simd-4.c new file mode 100644 index 000000000..5b9c78585 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/simd-4.c @@ -0,0 +1,20 @@ +#include +typedef int32_t __attribute__((vector_size(8))) v2si; +int64_t s64; + +static inline int64_t +__ev_convert_s64 (v2si a) +{ + return (int64_t) a; +} + +int main() +{ + union { int64_t ll; int32_t i[2]; } endianness_test; + endianness_test.ll = 1; + int32_t little_endian = endianness_test.i[0]; + s64 = __ev_convert_s64 ((v2si){1,0xffffffff}); + if (s64 != (little_endian ? 0xffffffff00000001LL : 0x1ffffffffLL)) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/simd-4.x b/gcc/testsuite/gcc.c-torture/execute/simd-4.x new file mode 100644 index 000000000..2e7510c6d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/simd-4.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_stdint_types] } { + return 0 +} + +return 1; diff --git a/gcc/testsuite/gcc.c-torture/execute/simd-5.c b/gcc/testsuite/gcc.c-torture/execute/simd-5.c new file mode 100644 index 000000000..f05843287 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/simd-5.c @@ -0,0 +1,59 @@ +/* Test saving and restoring of SIMD registers. */ + +typedef short Q __attribute__((vector_size(8))); + +Q q1 = {1, 2}, q2 = {3, 4}, q3 = {5, 6}, q4 = {7, 8}; + +Q w1, w2, w3, w4; +Q z1, z2, z3, z4; + +volatile int dummy; + +void __attribute__((__noinline__)) +func0 (void) +{ + dummy = 1; +} + +void __attribute__((__noinline__)) +func1 (void) +{ + Q a, b; + a = q1 * q2; + b = q3 * q4; + w1 = a; + w2 = b; + func0 (); + w3 = a; + w4 = b; +} + +void __attribute__((__noinline__)) +func2 (void) +{ + Q a, b; + a = q1 + q2; + b = q3 - q4; + z1 = a; + z2 = b; + func1 (); + z3 = a; + z4 = b; +} + +int +main (void) +{ + func2 (); + + if (memcmp (&w1, &w3, sizeof (Q)) != 0) + abort (); + if (memcmp (&w2, &w4, sizeof (Q)) != 0) + abort (); + if (memcmp (&z1, &z3, sizeof (Q)) != 0) + abort (); + if (memcmp (&z2, &z4, sizeof (Q)) != 0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/simd-6.c b/gcc/testsuite/gcc.c-torture/execute/simd-6.c new file mode 100644 index 000000000..ca4aabc43 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/simd-6.c @@ -0,0 +1,22 @@ +extern void abort (void); +extern int memcmp (const void *, const void *, __SIZE_TYPE__); + +typedef unsigned char v8qi __attribute__((vector_size(8))); + +v8qi foo(v8qi x, v8qi y) +{ + return x * y; +} + +int main() +{ + v8qi a = { 1, 2, 3, 4, 5, 6, 7, 8 }; + v8qi b = { 3, 3, 3, 3, 3, 3, 3, 3 }; + v8qi c = { 3, 6, 9, 12, 15, 18, 21, 24 }; + v8qi r; + + r = foo (a, b); + if (memcmp (&r, &c, 8) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/stdarg-1.c b/gcc/testsuite/gcc.c-torture/execute/stdarg-1.c new file mode 100644 index 000000000..0ff9759e9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/stdarg-1.c @@ -0,0 +1,156 @@ +#include + +extern void abort (void); + +int foo_arg, bar_arg; +long x; +double d; +va_list gap; +va_list *pap; + +void +foo (int v, va_list ap) +{ + switch (v) + { + case 5: foo_arg = va_arg (ap, int); break; + default: abort (); + } +} + +void +bar (int v) +{ + if (v == 0x4006) + { + if (va_arg (gap, double) != 17.0 + || va_arg (gap, long) != 129L) + abort (); + } + else if (v == 0x4008) + { + if (va_arg (*pap, long long) != 14LL + || va_arg (*pap, long double) != 131.0L + || va_arg (*pap, int) != 17) + abort (); + } + bar_arg = v; +} + +void +f0 (int i, ...) +{ +} + +void +f1 (int i, ...) +{ + va_list ap; + va_start (ap, i); + va_end (ap); +} + +void +f2 (int i, ...) +{ + va_list ap; + va_start (ap, i); + bar (d); + x = va_arg (ap, long); + bar (x); + va_end (ap); +} + +void +f3 (int i, ...) +{ + va_list ap; + va_start (ap, i); + d = va_arg (ap, double); + va_end (ap); +} + +void +f4 (int i, ...) +{ + va_list ap; + va_start (ap, i); + x = va_arg (ap, double); + foo (i, ap); + va_end (ap); +} + +void +f5 (int i, ...) +{ + va_list ap; + va_start (ap, i); + va_copy (gap, ap); + bar (i); + va_end (ap); + va_end (gap); +} + +void +f6 (int i, ...) +{ + va_list ap; + va_start (ap, i); + bar (d); + va_arg (ap, long); + va_arg (ap, long); + x = va_arg (ap, long); + bar (x); + va_end (ap); +} + +void +f7 (int i, ...) +{ + va_list ap; + va_start (ap, i); + pap = ≈ + bar (i); + va_end (ap); +} + +void +f8 (int i, ...) +{ + va_list ap; + va_start (ap, i); + pap = ≈ + bar (i); + d = va_arg (ap, double); + va_end (ap); +} + +int +main (void) +{ + f0 (1); + f1 (2); + d = 31.0; + f2 (3, 28L); + if (bar_arg != 28 || x != 28) + abort (); + f3 (4, 131.0); + if (d != 131.0) + abort (); + f4 (5, 16.0, 128); + if (x != 16 || foo_arg != 128) + abort (); + f5 (0x4006, 17.0, 129L); + if (bar_arg != 0x4006) + abort (); + f6 (7, 12L, 14L, -31L); + if (bar_arg != -31) + abort (); + f7 (0x4008, 14LL, 131.0L, 17, 26.0); + if (bar_arg != 0x4008) + abort (); + f8 (0x4008, 14LL, 131.0L, 17, 27.0); + if (bar_arg != 0x4008 || d != 27.0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/stdarg-2.c b/gcc/testsuite/gcc.c-torture/execute/stdarg-2.c new file mode 100644 index 000000000..40246f937 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/stdarg-2.c @@ -0,0 +1,180 @@ +#include + +extern void abort (void); + +int foo_arg, bar_arg; +long x; +double d; +va_list gap; + +void +foo (int v, va_list ap) +{ + switch (v) + { + case 5: + foo_arg = va_arg (ap, int); + foo_arg += va_arg (ap, double); + foo_arg += va_arg (ap, long long); + break; + case 8: + foo_arg = va_arg (ap, long long); + foo_arg += va_arg (ap, double); + break; + case 11: + foo_arg = va_arg (ap, int); + foo_arg += va_arg (ap, long double); + break; + default: + abort (); + } +} + +void +bar (int v) +{ + if (v == 0x4002) + { + if (va_arg (gap, int) != 13 || va_arg (gap, double) != -14.0) + abort (); + } + bar_arg = v; +} + +void +f1 (int i, ...) +{ + va_start (gap, i); + x = va_arg (gap, long); + va_end (gap); +} + +void +f2 (int i, ...) +{ + va_start (gap, i); + bar (i); + va_end (gap); +} + +void +f3 (int i, ...) +{ + va_list aps[10]; + va_start (aps[4], i); + x = va_arg (aps[4], long); + va_end (aps[4]); +} + +void +f4 (int i, ...) +{ + va_list aps[10]; + va_start (aps[4], i); + bar (i); + va_end (aps[4]); +} + +void +f5 (int i, ...) +{ + va_list aps[10]; + va_start (aps[4], i); + foo (i, aps[4]); + va_end (aps[4]); +} + +struct A { int i; va_list g; va_list h[2]; }; + +void +f6 (int i, ...) +{ + struct A a; + va_start (a.g, i); + x = va_arg (a.g, long); + va_end (a.g); +} + +void +f7 (int i, ...) +{ + struct A a; + va_start (a.g, i); + bar (i); + va_end (a.g); +} + +void +f8 (int i, ...) +{ + struct A a; + va_start (a.g, i); + foo (i, a.g); + va_end (a.g); +} + +void +f10 (int i, ...) +{ + struct A a; + va_start (a.h[1], i); + x = va_arg (a.h[1], long); + va_end (a.h[1]); +} + +void +f11 (int i, ...) +{ + struct A a; + va_start (a.h[1], i); + bar (i); + va_end (a.h[1]); +} + +void +f12 (int i, ...) +{ + struct A a; + va_start (a.h[1], i); + foo (i, a.h[1]); + va_end (a.h[1]); +} + +int +main (void) +{ + f1 (1, 79L); + if (x != 79L) + abort (); + f2 (0x4002, 13, -14.0); + if (bar_arg != 0x4002) + abort (); + f3 (3, 2031L); + if (x != 2031) + abort (); + f4 (4, 18); + if (bar_arg != 4) + abort (); + f5 (5, 1, 19.0, 18LL); + if (foo_arg != 38) + abort (); + f6 (6, 18L); + if (x != 18L) + abort (); + f7 (7); + if (bar_arg != 7) + abort (); + f8 (8, 2031LL, 13.0); + if (foo_arg != 2044) + abort (); + f10 (9, 180L); + if (x != 180L) + abort (); + f11 (10); + if (bar_arg != 10) + abort (); + f12 (11, 2030, 12.0L); + if (foo_arg != 2042) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/stdarg-3.c b/gcc/testsuite/gcc.c-torture/execute/stdarg-3.c new file mode 100644 index 000000000..ccc79e001 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/stdarg-3.c @@ -0,0 +1,166 @@ +#include + +extern void abort (void); + +int foo_arg, bar_arg; +long x; +double d; +va_list gap; +struct S1 { int i; double d; int j; double e; } s1; +struct S2 { double d; long i; } s2; +int y; + +void +bar (int v) +{ + bar_arg = v; +} + +void +f1 (int i, ...) +{ + va_list ap; + va_start (ap, i); + while (i-- > 0) + x = va_arg (ap, long); + va_end (ap); +} + +void +f2 (int i, ...) +{ + va_list ap; + va_start (ap, i); + while (i-- > 0) + d = va_arg (ap, double); + va_end (ap); +} + +void +f3 (int i, ...) +{ + va_list ap; + int j = i; + while (j-- > 0) + { + va_start (ap, i); + x = va_arg (ap, long); + va_end (ap); + bar (x); + } +} + +void +f4 (int i, ...) +{ + va_list ap; + int j = i; + while (j-- > 0) + { + va_start (ap, i); + d = va_arg (ap, double); + va_end (ap); + bar (d + 4.0); + } +} + +void +f5 (int i, ...) +{ + va_list ap; + va_start (ap, i); + while (i-- > 0) + s1 = va_arg (ap, struct S1); + va_end (ap); +} + +void +f6 (int i, ...) +{ + va_list ap; + va_start (ap, i); + while (i-- > 0) + s2 = va_arg (ap, struct S2); + va_end (ap); +} + +void +f7 (int i, ...) +{ + va_list ap; + int j = i; + while (j-- > 0) + { + va_start (ap, i); + s1 = va_arg (ap, struct S1); + va_end (ap); + bar (s1.i); + } +} + +void +f8 (int i, ...) +{ + va_list ap; + int j = i; + while (j-- > 0) + { + va_start (ap, i); + s2 = va_arg (ap, struct S2); + y = va_arg (ap, int); + va_end (ap); + bar (s2.i); + } +} + +int +main (void) +{ + struct S1 a1, a3; + struct S2 a2, a4; + + f1 (7, 1L, 2L, 3L, 5L, 7L, 9L, 11L, 13L); + if (x != 11L) + abort (); + f2 (6, 1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0); + if (d != 32.0) + abort (); + f3 (2, 1L, 3L); + if (bar_arg != 1L || x != 1L) + abort (); + f4 (2, 17.0, 19.0); + if (bar_arg != 21 || d != 17.0) + abort (); + a1.i = 131; + a1.j = 251; + a1.d = 15.0; + a1.e = 191.0; + a3 = a1; + a3.j = 254; + a3.e = 178.0; + f5 (2, a1, a3, a1); + if (s1.i != 131 || s1.j != 254 || s1.d != 15.0 || s1.e != 178.0) + abort (); + f5 (3, a1, a3, a1); + if (s1.i != 131 || s1.j != 251 || s1.d != 15.0 || s1.e != 191.0) + abort (); + a2.i = 138; + a2.d = 16.0; + a4.i = 257; + a4.d = 176.0; + f6 (2, a2, a4, a2); + if (s2.i != 257 || s2.d != 176.0) + abort (); + f6 (3, a2, a4, a2); + if (s2.i != 138 || s2.d != 16.0) + abort (); + f7 (2, a3, a1, a1); + if (s1.i != 131 || s1.j != 254 || s1.d != 15.0 || s1.e != 178.0) + abort (); + if (bar_arg != 131) + abort (); + f8 (3, a4, a2, a2); + if (s2.i != 257 || s2.d != 176.0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/stdarg-4.c b/gcc/testsuite/gcc.c-torture/execute/stdarg-4.c new file mode 100644 index 000000000..f820bcee4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/stdarg-4.c @@ -0,0 +1,137 @@ +#include + +extern void abort (void); +long x, y; + +inline void __attribute__((always_inline)) +f1i (va_list ap) +{ + x = va_arg (ap, double); + x += va_arg (ap, long); + x += va_arg (ap, double); +} + +void +f1 (int i, ...) +{ + va_list ap; + va_start (ap, i); + f1i (ap); + va_end (ap); +} + +inline void __attribute__((always_inline)) +f2i (va_list ap) +{ + y = va_arg (ap, int); + y += va_arg (ap, long); + y += va_arg (ap, double); + f1i (ap); +} + +void +f2 (int i, ...) +{ + va_list ap; + va_start (ap, i); + f2i (ap); + va_end (ap); +} + +long +f3h (int i, long arg0, long arg1, long arg2, long arg3) +{ + return i + arg0 + arg1 + arg2 + arg3; +} + +long +f3 (int i, ...) +{ + long t, arg0, arg1, arg2, arg3; + va_list ap; + + va_start (ap, i); + switch (i) + { + case 0: + t = f3h (i, 0, 0, 0, 0); + break; + case 1: + arg0 = va_arg (ap, long); + t = f3h (i, arg0, 0, 0, 0); + break; + case 2: + arg0 = va_arg (ap, long); + arg1 = va_arg (ap, long); + t = f3h (i, arg0, arg1, 0, 0); + break; + case 3: + arg0 = va_arg (ap, long); + arg1 = va_arg (ap, long); + arg2 = va_arg (ap, long); + t = f3h (i, arg0, arg1, arg2, 0); + break; + case 4: + arg0 = va_arg (ap, long); + arg1 = va_arg (ap, long); + arg2 = va_arg (ap, long); + arg3 = va_arg (ap, long); + t = f3h (i, arg0, arg1, arg2, arg3); + break; + default: + abort (); + } + va_end (ap); + + return t; +} + +void +f4 (int i, ...) +{ + va_list ap; + + va_start (ap, i); + switch (i) + { + case 4: + y = va_arg (ap, double); + break; + case 5: + y = va_arg (ap, double); + y += va_arg (ap, double); + break; + default: + abort (); + } + f1i (ap); + va_end (ap); +} + +int +main (void) +{ + f1 (3, 16.0, 128L, 32.0); + if (x != 176L) + abort (); + f2 (6, 5, 7L, 18.0, 19.0, 17L, 64.0); + if (x != 100L || y != 30L) + abort (); + if (f3 (0) != 0) + abort (); + if (f3 (1, 18L) != 19L) + abort (); + if (f3 (2, 18L, 100L) != 120L) + abort (); + if (f3 (3, 18L, 100L, 300L) != 421L) + abort (); + if (f3 (4, 18L, 71L, 64L, 86L) != 243L) + abort (); + f4 (4, 6.0, 9.0, 16L, 18.0); + if (x != 43L || y != 6L) + abort (); + f4 (5, 7.0, 21.0, 1.0, 17L, 126.0); + if (x != 144L || y != 28L) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/strcmp-1.c b/gcc/testsuite/gcc.c-torture/execute/strcmp-1.c new file mode 100644 index 000000000..79999af3c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/strcmp-1.c @@ -0,0 +1,131 @@ +/* Copyright (C) 2002 Free Software Foundation. + + Test strcmp with various combinations of pointer alignments and lengths to + make sure any optimizations in the library are correct. + + Written by Michael Meissner, March 9, 2002. */ + +#include +#include + +#ifndef MAX_OFFSET +#define MAX_OFFSET (sizeof (long long)) +#endif + +#ifndef MAX_TEST +#define MAX_TEST (8 * sizeof (long long)) +#endif + +#ifndef MAX_EXTRA +#define MAX_EXTRA (sizeof (long long)) +#endif + +#define MAX_LENGTH (MAX_OFFSET + MAX_TEST + MAX_EXTRA + 2) + +static union { + unsigned char buf[MAX_LENGTH]; + long long align_int; + long double align_fp; +} u1, u2; + +void +test (const unsigned char *s1, const unsigned char *s2, int expected) +{ + int value = strcmp ((char *) s1, (char *) s2); + + if (expected < 0 && value >= 0) + abort (); + else if (expected == 0 && value != 0) + abort (); + else if (expected > 0 && value <= 0) + abort (); +} + +main () +{ + size_t off1, off2, len, i; + unsigned char *buf1, *buf2; + unsigned char *mod1, *mod2; + unsigned char *p1, *p2; + + for (off1 = 0; off1 < MAX_OFFSET; off1++) + for (off2 = 0; off2 < MAX_OFFSET; off2++) + for (len = 0; len < MAX_TEST; len++) + { + p1 = u1.buf; + for (i = 0; i < off1; i++) + *p1++ = '\0'; + + buf1 = p1; + for (i = 0; i < len; i++) + *p1++ = 'a'; + + mod1 = p1; + for (i = 0; i < MAX_EXTRA+2; i++) + *p1++ = 'x'; + + p2 = u2.buf; + for (i = 0; i < off2; i++) + *p2++ = '\0'; + + buf2 = p2; + for (i = 0; i < len; i++) + *p2++ = 'a'; + + mod2 = p2; + for (i = 0; i < MAX_EXTRA+2; i++) + *p2++ = 'x'; + + mod1[0] = '\0'; + mod2[0] = '\0'; + test (buf1, buf2, 0); + + mod1[0] = 'a'; + mod1[1] = '\0'; + mod2[0] = '\0'; + test (buf1, buf2, +1); + + mod1[0] = '\0'; + mod2[0] = 'a'; + mod2[1] = '\0'; + test (buf1, buf2, -1); + + mod1[0] = 'b'; + mod1[1] = '\0'; + mod2[0] = 'c'; + mod2[1] = '\0'; + test (buf1, buf2, -1); + + mod1[0] = 'c'; + mod1[1] = '\0'; + mod2[0] = 'b'; + mod2[1] = '\0'; + test (buf1, buf2, +1); + + mod1[0] = 'b'; + mod1[1] = '\0'; + mod2[0] = (unsigned char)'\251'; + mod2[1] = '\0'; + test (buf1, buf2, -1); + + mod1[0] = (unsigned char)'\251'; + mod1[1] = '\0'; + mod2[0] = 'b'; + mod2[1] = '\0'; + test (buf1, buf2, +1); + + mod1[0] = (unsigned char)'\251'; + mod1[1] = '\0'; + mod2[0] = (unsigned char)'\252'; + mod2[1] = '\0'; + test (buf1, buf2, -1); + + mod1[0] = (unsigned char)'\252'; + mod1[1] = '\0'; + mod2[0] = (unsigned char)'\251'; + mod2[1] = '\0'; + test (buf1, buf2, +1); + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/strcpy-1.c b/gcc/testsuite/gcc.c-torture/execute/strcpy-1.c new file mode 100644 index 000000000..9484e95d9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/strcpy-1.c @@ -0,0 +1,75 @@ +/* Copyright (C) 2002 Free Software Foundation. + + Test strcpy with various combinations of pointer alignments and lengths to + make sure any optimizations in the library are correct. */ + +#include + +#ifndef MAX_OFFSET +#define MAX_OFFSET (sizeof (long long)) +#endif + +#ifndef MAX_COPY +#define MAX_COPY (10 * sizeof (long long)) +#endif + +#ifndef MAX_EXTRA +#define MAX_EXTRA (sizeof (long long)) +#endif + +#define MAX_LENGTH (MAX_OFFSET + MAX_COPY + 1 + MAX_EXTRA) + +/* Use a sequence length that is not divisible by two, to make it more + likely to detect when words are mixed up. */ +#define SEQUENCE_LENGTH 31 + +static union { + char buf[MAX_LENGTH]; + long long align_int; + long double align_fp; +} u1, u2; + +main () +{ + int off1, off2, len, i; + char *p, *q, c; + + for (off1 = 0; off1 < MAX_OFFSET; off1++) + for (off2 = 0; off2 < MAX_OFFSET; off2++) + for (len = 1; len < MAX_COPY; len++) + { + for (i = 0, c = 'A'; i < MAX_LENGTH; i++, c++) + { + u1.buf[i] = 'a'; + if (c >= 'A' + SEQUENCE_LENGTH) + c = 'A'; + u2.buf[i] = c; + } + u2.buf[off2 + len] = '\0'; + + p = strcpy (u1.buf + off1, u2.buf + off2); + if (p != u1.buf + off1) + abort (); + + q = u1.buf; + for (i = 0; i < off1; i++, q++) + if (*q != 'a') + abort (); + + for (i = 0, c = 'A' + off2; i < len; i++, q++, c++) + { + if (c >= 'A' + SEQUENCE_LENGTH) + c = 'A'; + if (*q != c) + abort (); + } + + if (*q++ != '\0') + abort (); + for (i = 0; i < MAX_EXTRA; i++, q++) + if (*q != 'a') + abort (); + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/strct-pack-1.c b/gcc/testsuite/gcc.c-torture/execute/strct-pack-1.c new file mode 100644 index 000000000..7b702f2cd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/strct-pack-1.c @@ -0,0 +1,25 @@ +typedef struct +{ + short s __attribute__ ((aligned(2), packed)); + double d __attribute__ ((aligned(2), packed)); +} TRIAL; + +int +check (TRIAL *t) +{ + if (t->s != 1 || t->d != 16.0) + return 1; + return 0; +} + +main () +{ + TRIAL trial; + + trial.s = 1; + trial.d = 16.0; + + if (check (&trial) != 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/strct-pack-2.c b/gcc/testsuite/gcc.c-torture/execute/strct-pack-2.c new file mode 100644 index 000000000..be76c7645 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/strct-pack-2.c @@ -0,0 +1,13 @@ +typedef struct +{ + short a __attribute__ ((aligned (2),packed)); + short *ap[2] __attribute__ ((aligned (2),packed)); +} A; + +main () +{ + short i, j = 1; + A a, *ap = &a; + ap->ap[j] = &i; + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/strct-pack-3.c b/gcc/testsuite/gcc.c-torture/execute/strct-pack-3.c new file mode 100644 index 000000000..8f91b040c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/strct-pack-3.c @@ -0,0 +1,28 @@ +typedef struct +{ + short i __attribute__ ((aligned (2),packed)); + int f[2] __attribute__ ((aligned (2),packed)); +} A; + +f (ap) + A *ap; +{ + short i, j = 1; + + i = ap->f[1]; + i += ap->f[j]; + for (j = 0; j < 2; j++) + i += ap->f[j]; + + return i; +} + +main () +{ + A a; + a.f[0] = 100; + a.f[1] = 13; + if (f (&a) != 139) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/strct-pack-4.c b/gcc/testsuite/gcc.c-torture/execute/strct-pack-4.c new file mode 100644 index 000000000..56d315f47 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/strct-pack-4.c @@ -0,0 +1,29 @@ +typedef struct +{ + unsigned char a __attribute__((packed)); + unsigned short b __attribute__((packed)); +} three_char_t; + +unsigned char +my_set_a (void) +{ + return 0xab; +} + +unsigned short +my_set_b (void) +{ + return 0x1234; +} + +main () +{ + three_char_t three_char; + + three_char.a = my_set_a (); + three_char.b = my_set_b (); + if (three_char.a != 0xab || three_char.b != 0x1234) + abort (); + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/strct-stdarg-1.c b/gcc/testsuite/gcc.c-torture/execute/strct-stdarg-1.c new file mode 100644 index 000000000..508c95470 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/strct-stdarg-1.c @@ -0,0 +1,61 @@ +#include + +struct tiny +{ + char c; + char d; + char e; + char f; + char g; +}; + +f (int n, ...) +{ + struct tiny x; + int i; + + va_list ap; + va_start (ap,n); + for (i = 0; i < n; i++) + { + x = va_arg (ap,struct tiny); + if (x.c != i + 10) + abort(); + if (x.d != i + 20) + abort(); + if (x.e != i + 30) + abort(); + if (x.f != i + 40) + abort(); + if (x.g != i + 50) + abort(); + } + { + long x = va_arg (ap, long); + if (x != 123) + abort(); + } + va_end (ap); +} + +main () +{ + struct tiny x[3]; + x[0].c = 10; + x[1].c = 11; + x[2].c = 12; + x[0].d = 20; + x[1].d = 21; + x[2].d = 22; + x[0].e = 30; + x[1].e = 31; + x[2].e = 32; + x[0].f = 40; + x[1].f = 41; + x[2].f = 42; + x[0].g = 50; + x[1].g = 51; + x[2].g = 52; + f (3, x[0], x[1], x[2], (long) 123); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/strct-varg-1.c b/gcc/testsuite/gcc.c-torture/execute/strct-varg-1.c new file mode 100644 index 000000000..ddd6f05d5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/strct-varg-1.c @@ -0,0 +1,42 @@ +#include + +struct s { int x, y; }; + +f (int attr, ...) +{ + struct s va_values; + va_list va; + int i; + + va_start (va, attr); + + if (attr != 2) + abort (); + + va_values = va_arg (va, struct s); + if (va_values.x != 0xaaaa || va_values.y != 0x5555) + abort (); + + attr = va_arg (va, int); + if (attr != 3) + abort (); + + va_values = va_arg (va, struct s); + if (va_values.x != 0xffff || va_values.y != 0x1111) + abort (); + + va_end (va); +} + +main () +{ + struct s a, b; + + a.x = 0xaaaa; + a.y = 0x5555; + b.x = 0xffff; + b.y = 0x1111; + + f (2, a, 3, b); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/string-opt-17.c b/gcc/testsuite/gcc.c-torture/execute/string-opt-17.c new file mode 100644 index 000000000..76a351bfb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/string-opt-17.c @@ -0,0 +1,45 @@ +/* Copyright (C) 2003 Free Software Foundation. + + Test strcpy optimizations don't evaluate side-effects twice. + + Written by Jakub Jelinek, June 23, 2003. */ + +typedef __SIZE_TYPE__ size_t; +extern char *strcpy (char *, const char *); +extern int memcmp (const void *, const void *, size_t); +extern void abort (void); +extern void exit (int); + +size_t +test1 (char *s, size_t i) +{ + strcpy (s, "foobarbaz" + i++); + return i; +} + +size_t +check2 (void) +{ + static size_t r = 5; + if (r != 5) + abort (); + return ++r; +} + +void +test2 (char *s) +{ + strcpy (s, "foobarbaz" + check2 ()); +} + +int +main (void) +{ + char buf[10]; + if (test1 (buf, 7) != 8 || memcmp (buf, "az", 3)) + abort (); + test2 (buf); + if (memcmp (buf, "baz", 4)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/string-opt-18.c b/gcc/testsuite/gcc.c-torture/execute/string-opt-18.c new file mode 100644 index 000000000..610c4caf1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/string-opt-18.c @@ -0,0 +1,76 @@ +/* Copyright (C) 2003 Free Software Foundation. + + Test equal pointer optimizations don't break anything. + + Written by Roger Sayle, July 14, 2003. */ + +extern void abort (); +typedef __SIZE_TYPE__ size_t; + +extern void *memcpy(void*, const void*, size_t); +extern void *mempcpy(void*, const void*, size_t); +extern void *memmove(void*, const void*, size_t); +extern char *strcpy(char*, const char*); +extern int memcmp(const void*, const void*, size_t); +extern int strcmp(const char*, const char*); +extern int strncmp(const char*, const char*, size_t); + + +void test1 (void *ptr) +{ + if (memcpy(ptr,ptr,8) != ptr) + abort (); +} + +void test2 (char *ptr) +{ + if (mempcpy(ptr,ptr,8) != ptr+8) + abort (); +} + +void test3 (void *ptr) +{ + if (memmove(ptr,ptr,8) != ptr) + abort (); +} + +void test4 (char *ptr) +{ + if (strcpy(ptr,ptr) != ptr) + abort (); +} + +void test5 (void *ptr) +{ + if (memcmp(ptr,ptr,8) != 0) + abort (); +} + +void test6 (const char *ptr) +{ + if (strcmp(ptr,ptr) != 0) + abort (); +} + +void test7 (const char *ptr) +{ + if (strncmp(ptr,ptr,8) != 0) + abort (); +} + + +int main () +{ + char buf[10]; + + test1 (buf); + test2 (buf); + test3 (buf); + test4 (buf); + test5 (buf); + test6 (buf); + test7 (buf); + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/string-opt-5.c b/gcc/testsuite/gcc.c-torture/execute/string-opt-5.c new file mode 100644 index 000000000..178812226 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/string-opt-5.c @@ -0,0 +1,107 @@ +/* Copyright (C) 2000 Free Software Foundation. + + Ensure builtin strlen, strcmp, strchr, strrchr and strncpy + perform correctly. + + Written by Jakub Jelinek, 11/7/2000. */ + +extern void abort (void); +extern __SIZE_TYPE__ strlen (const char *); +extern int strcmp (const char *, const char *); +extern char *strchr (const char *, int); +extern char *strrchr (const char *, int); +extern char *strncpy (char *, const char *, __SIZE_TYPE__); +extern void *memset (void *, int, __SIZE_TYPE__); +extern int memcmp (const void *, const void *, __SIZE_TYPE__); + +int x = 6; +int y = 1; +char *bar = "hi world"; +char buf [64]; + +int main() +{ + const char *const foo = "hello world"; + char dst [64]; + + if (strlen (bar) != 8) + abort (); + if (strlen (bar + (++x & 2)) != 6) + abort (); + if (x != 7) + abort (); + if (strlen (foo + (x++, 6)) != 5) + abort (); + if (x != 8) + abort (); + if (strlen (foo + (++x & 1)) != 10) + abort (); + if (x != 9) + abort (); + if (strcmp (foo + (x -= 6), "lo world")) + abort (); + if (x != 3) + abort (); + if (strcmp (foo, bar) >= 0) + abort (); + if (strcmp (foo, bar + (x++ & 1)) >= 0) + abort (); + if (x != 4) + abort (); + if (strchr (foo + (x++ & 7), 'l') != foo + 9) + abort (); + if (x != 5) + abort (); + if (strchr (bar, 'o') != bar + 4) + abort (); + if (strchr (bar, '\0') != bar + 8) + abort (); + if (strrchr (bar, 'x')) + abort (); + if (strrchr (bar, 'o') != bar + 4) + abort (); + if (strcmp (foo + (x++ & 1), "ello world" + (--y & 1))) + abort (); + if (x != 6 || y != 0) + abort (); + dst[5] = ' '; + dst[6] = '\0'; + x = 5; + y = 1; + if (strncpy (dst + 1, foo + (x++ & 3), 4) != dst + 1 + || x != 6 + || strcmp (dst + 1, "ello ")) + abort (); + memset (dst, ' ', sizeof dst); + if (strncpy (dst + (++x & 1), (y++ & 3) + "foo", 10) != dst + 1 + || x != 7 + || y != 2 + || memcmp (dst, " oo\0\0\0\0\0\0\0\0 ", 12)) + abort (); + memset (dst, ' ', sizeof dst); + if (strncpy (dst, "hello", 8) != dst || memcmp (dst, "hello\0\0\0 ", 9)) + abort (); + x = '!'; + memset (buf, ' ', sizeof buf); + if (memset (buf, x++, ++y) != buf + || x != '!' + 1 + || y != 3 + || memcmp (buf, "!!!", 3)) + abort (); + if (memset (buf + y++, '-', 8) != buf + 3 + || y != 4 + || memcmp (buf, "!!!--------", 11)) + abort (); + x = 10; + if (memset (buf + ++x, 0, y++) != buf + 11 + || x != 11 + || y != 5 + || memcmp (buf + 8, "---\0\0\0", 7)) + abort (); + if (memset (buf + (x += 4), 0, 6) != buf + 15 + || x != 15 + || memcmp (buf + 10, "-\0\0\0\0\0\0\0\0\0", 11)) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/strlen-1.c b/gcc/testsuite/gcc.c-torture/execute/strlen-1.c new file mode 100644 index 000000000..c29592b8b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/strlen-1.c @@ -0,0 +1,57 @@ +/* Copyright (C) 2002 Free Software Foundation. + + Test strlen with various combinations of pointer alignments and lengths to + make sure any optimizations in the library are correct. + + Written by Michael Meissner, March 9, 2002. */ + +#include +#include + +#ifndef MAX_OFFSET +#define MAX_OFFSET (sizeof (long long)) +#endif + +#ifndef MAX_TEST +#define MAX_TEST (8 * sizeof (long long)) +#endif + +#ifndef MAX_EXTRA +#define MAX_EXTRA (sizeof (long long)) +#endif + +#define MAX_LENGTH (MAX_OFFSET + MAX_TEST + MAX_EXTRA + 1) + +static union { + char buf[MAX_LENGTH]; + long long align_int; + long double align_fp; +} u; + +main () +{ + size_t off, len, len2, i; + char *p; + + for (off = 0; off < MAX_OFFSET; off++) + for (len = 0; len < MAX_TEST; len++) + { + p = u.buf; + for (i = 0; i < off; i++) + *p++ = '\0'; + + for (i = 0; i < len; i++) + *p++ = 'a'; + + *p++ = '\0'; + for (i = 0; i < MAX_EXTRA; i++) + *p++ = 'b'; + + p = u.buf + off; + len2 = strlen (p); + if (len != len2) + abort (); + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/strncmp-1.c b/gcc/testsuite/gcc.c-torture/execute/strncmp-1.c new file mode 100644 index 000000000..dee904ff1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/strncmp-1.c @@ -0,0 +1,140 @@ +/* Copyright (C) 2002 Free Software Foundation. + + Test strncmp with various combinations of pointer alignments and lengths to + make sure any optimizations in the library are correct. + + Written by Michael Meissner, March 9, 2002. */ + +#include +#include + +#ifndef MAX_OFFSET +#define MAX_OFFSET (sizeof (long long)) +#endif + +#ifndef MAX_TEST +#define MAX_TEST (8 * sizeof (long long)) +#endif + +#ifndef MAX_EXTRA +#define MAX_EXTRA (sizeof (long long)) +#endif + +#define MAX_LENGTH (MAX_OFFSET + MAX_TEST + MAX_EXTRA) + +static union { + unsigned char buf[MAX_LENGTH]; + long long align_int; + long double align_fp; +} u1, u2; + +void +test (const unsigned char *s1, const unsigned char *s2, size_t len, int expected) +{ + int value = strncmp ((char *) s1, (char *) s2, len); + + if (expected < 0 && value >= 0) + abort (); + else if (expected == 0 && value != 0) + abort (); + else if (expected > 0 && value <= 0) + abort (); +} + +main () +{ + size_t off1, off2, len, i; + unsigned char *buf1, *buf2; + unsigned char *mod1, *mod2; + unsigned char *p1, *p2; + + for (off1 = 0; off1 < MAX_OFFSET; off1++) + for (off2 = 0; off2 < MAX_OFFSET; off2++) + for (len = 0; len < MAX_TEST; len++) + { + p1 = u1.buf; + for (i = 0; i < off1; i++) + *p1++ = '\0'; + + buf1 = p1; + for (i = 0; i < len; i++) + *p1++ = 'a'; + + mod1 = p1; + for (i = 0; i < MAX_EXTRA; i++) + *p1++ = 'x'; + + p2 = u2.buf; + for (i = 0; i < off2; i++) + *p2++ = '\0'; + + buf2 = p2; + for (i = 0; i < len; i++) + *p2++ = 'a'; + + mod2 = p2; + for (i = 0; i < MAX_EXTRA; i++) + *p2++ = 'x'; + + mod1[0] = '\0'; + mod2[0] = '\0'; + test (buf1, buf2, MAX_LENGTH, 0); + test (buf1, buf2, len, 0); + + mod1[0] = 'a'; + mod1[1] = '\0'; + mod2[0] = '\0'; + test (buf1, buf2, MAX_LENGTH, +1); + test (buf1, buf2, len, 0); + + mod1[0] = '\0'; + mod2[0] = 'a'; + mod2[1] = '\0'; + test (buf1, buf2, MAX_LENGTH, -1); + test (buf1, buf2, len, 0); + + mod1[0] = 'b'; + mod1[1] = '\0'; + mod2[0] = 'c'; + mod2[1] = '\0'; + test (buf1, buf2, MAX_LENGTH, -1); + test (buf1, buf2, len, 0); + + mod1[0] = 'c'; + mod1[1] = '\0'; + mod2[0] = 'b'; + mod2[1] = '\0'; + test (buf1, buf2, MAX_LENGTH, +1); + test (buf1, buf2, len, 0); + + mod1[0] = 'b'; + mod1[1] = '\0'; + mod2[0] = (unsigned char)'\251'; + mod2[1] = '\0'; + test (buf1, buf2, MAX_LENGTH, -1); + test (buf1, buf2, len, 0); + + mod1[0] = (unsigned char)'\251'; + mod1[1] = '\0'; + mod2[0] = 'b'; + mod2[1] = '\0'; + test (buf1, buf2, MAX_LENGTH, +1); + test (buf1, buf2, len, 0); + + mod1[0] = (unsigned char)'\251'; + mod1[1] = '\0'; + mod2[0] = (unsigned char)'\252'; + mod2[1] = '\0'; + test (buf1, buf2, MAX_LENGTH, -1); + test (buf1, buf2, len, 0); + + mod1[0] = (unsigned char)'\252'; + mod1[1] = '\0'; + mod2[0] = (unsigned char)'\251'; + mod2[1] = '\0'; + test (buf1, buf2, MAX_LENGTH, +1); + test (buf1, buf2, len, 0); + } + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/strncmp-1.x b/gcc/testsuite/gcc.c-torture/execute/strncmp-1.x new file mode 100644 index 000000000..b555e0c8f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/strncmp-1.x @@ -0,0 +1,16 @@ +if {[istarget i?86-*-vxworks*] + || [istarget mips*-*-vxworks*] + || [istarget sh*-*-vxworks*] + || [istarget sparc*-*-vxworks*]} { + # The kernel strncmp doesn't perform unsigned comparisons. + set torture_eval_before_execute { + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data { + "The kernel strncmp doesn't perform unsigned comparisons." + { "*-*-*" } + {} + { "-mrtp" } + } + } +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/struct-aliasing-1.c b/gcc/testsuite/gcc.c-torture/execute/struct-aliasing-1.c new file mode 100644 index 000000000..9786b44c2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/struct-aliasing-1.c @@ -0,0 +1,17 @@ +struct S { float f; }; +int __attribute__((noinline)) +foo (int *r, struct S *p) +{ + int *q = (int *)&p->f; + int i = *q; + *r = 0; + return i + *q; +} +extern void abort (void); +int main() +{ + int i = 1; + if (foo (&i, (struct S *)&i) != 1) + abort (); + return (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/struct-cpy-1.c b/gcc/testsuite/gcc.c-torture/execute/struct-cpy-1.c new file mode 100644 index 000000000..52886feee --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/struct-cpy-1.c @@ -0,0 +1,43 @@ +/* powerpc64-linux gcc miscompiled this due to rs6000.c:expand_block_move + not setting mem aliasing info correctly for the code implementing the + structure assignment. */ + +struct termios +{ + unsigned int a; + unsigned int b; + unsigned int c; + unsigned int d; + unsigned char pad[28]; +}; + +struct tty_driver +{ + unsigned char pad1[38]; + struct termios t __attribute__ ((aligned (8))); +}; + +static struct termios zero_t; +static struct tty_driver pty; + +void ini (void) +{ + pty.t = zero_t; + pty.t.a = 1; + pty.t.b = 2; + pty.t.c = 3; + pty.t.d = 4; +} + +int main (void) +{ + extern void abort (void); + + ini (); + if (pty.t.a != 1 + || pty.t.b != 2 + || pty.t.c != 3 + || pty.t.d != 4) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/struct-ini-1.c b/gcc/testsuite/gcc.c-torture/execute/struct-ini-1.c new file mode 100644 index 000000000..ab2d178a7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/struct-ini-1.c @@ -0,0 +1,15 @@ +struct S +{ + char f1; + int f2[2]; +}; + +struct S object = {'X', 8, 9}; + +main () +{ + if (object.f1 != 'X' || object.f2[0] != 8 || object.f2[1] != 9) + abort (); + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/struct-ini-2.c b/gcc/testsuite/gcc.c-torture/execute/struct-ini-2.c new file mode 100644 index 000000000..c785257cc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/struct-ini-2.c @@ -0,0 +1,17 @@ +struct { + int a:4; + int :4; + int b:4; + int c:4; +} x = { 2,3,4 }; + +main () +{ + if (x.a != 2) + abort (); + if (x.b != 3) + abort (); + if (x.c != 4) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/struct-ini-3.c b/gcc/testsuite/gcc.c-torture/execute/struct-ini-3.c new file mode 100644 index 000000000..7d282ecb8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/struct-ini-3.c @@ -0,0 +1,11 @@ +struct +{ + unsigned int f1:1, f2:1, f3:3, f4:3, f5:2, f6:1, f7:1; +} result = {1, 1, 7, 7, 3, 1, 1}; + +main () +{ + if ((result.f3 & ~7) != 0 || (result.f4 & ~7) != 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/struct-ini-4.c b/gcc/testsuite/gcc.c-torture/execute/struct-ini-4.c new file mode 100644 index 000000000..3342439e5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/struct-ini-4.c @@ -0,0 +1,15 @@ +struct s { + int a[3]; + int c[3]; +}; + +struct s s = { + c: {1, 2, 3} +}; + +main() +{ + if (s.c[0] != 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/struct-ret-1.c b/gcc/testsuite/gcc.c-torture/execute/struct-ret-1.c new file mode 100644 index 000000000..e5274ec4c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/struct-ret-1.c @@ -0,0 +1,57 @@ +#include +#include + +char out[100]; + +typedef struct { double d; int i[3]; } B; +typedef struct { char c[33],c1; } X; + +char c1 = 'a'; +char c2 = 127; +char c3 = (char)128; +char c4 = (char)255; +char c5 = -1; + +double d1 = 0.1; +double d2 = 0.2; +double d3 = 0.3; +double d4 = 0.4; +double d5 = 0.5; +double d6 = 0.6; +double d7 = 0.7; +double d8 = 0.8; +double d9 = 0.9; + +B B1 = {0.1,{1,2,3}}; +B B2 = {0.2,{5,4,3}}; +X X1 = {"abcdefghijklmnopqrstuvwxyzABCDEF", 'G'}; +X X2 = {"123",'9'}; +X X3 = {"return-return-return",'R'}; + +X f (B a, char b, double c, B d) +{ + static X xr = {"return val", 'R'}; + X r; + r = xr; + r.c1 = b; + sprintf (out, "X f(B,char,double,B):({%g,{%d,%d,%d}},'%c',%g,{%g,{%d,%d,%d}})", + a.d, a.i[0], a.i[1], a.i[2], b, c, d.d, d.i[0], d.i[1], d.i[2]); + return r; +} + +X (*fp) (B, char, double, B) = &f; + +main () +{ + X Xr; + char tmp[100]; + + Xr = f (B1, c2, d3, B2); + strcpy (tmp, out); + Xr.c[0] = Xr.c1 = '\0'; + Xr = (*fp) (B1, c2, d3, B2); + if (strcmp (tmp, out)) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/struct-ret-2.c b/gcc/testsuite/gcc.c-torture/execute/struct-ret-2.c new file mode 100644 index 000000000..06a40a720 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/struct-ret-2.c @@ -0,0 +1,29 @@ +typedef struct +{ + unsigned char a __attribute__ ((packed)); + unsigned short b __attribute__ ((packed)); +} three_byte_t; + +unsigned char +f (void) +{ + return 0xab; +} + +unsigned short +g (void) +{ + return 0x1234; +} + +main () +{ + three_byte_t three_byte; + + three_byte.a = f (); + three_byte.b = g (); + if (three_byte.a != 0xab || three_byte.b != 0x1234) + abort (); + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/switch-1.c b/gcc/testsuite/gcc.c-torture/execute/switch-1.c new file mode 100644 index 000000000..30cffed7b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/switch-1.c @@ -0,0 +1,57 @@ +/* Copyright (C) 2003 Free Software Foundation. + + Test that switch statements suitable using case bit tests are + implemented correctly. + + Written by Roger Sayle, 01/25/2001. */ + +extern void abort (void); + +int +foo (int x) +{ + switch (x) + { + case 4: + case 6: + case 9: + case 11: + return 30; + } + return 31; +} + +int +main (int argc) +{ + int i, r; + + for (i=-1; i<66; i++) + { + r = foo (i); + if (i == 4) + { + if (r != 30) + abort (); + } + else if (i == 6) + { + if (r != 30) + abort (); + } + else if (i == 9) + { + if (r != 30) + abort (); + } + else if (i == 11) + { + if (r != 30) + abort (); + } + else if (r != 31) + abort (); + } + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/tstdi-1.c b/gcc/testsuite/gcc.c-torture/execute/tstdi-1.c new file mode 100644 index 000000000..3e31fdf59 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/tstdi-1.c @@ -0,0 +1,139 @@ +#define FALSE 140 +#define TRUE 13 + +feq (x) + long long int x; +{ + if (x == 0) + return TRUE; + else + return FALSE; +} + +fne (x) + long long int x; +{ + if (x != 0) + return TRUE; + else + return FALSE; +} + +flt (x) + long long int x; +{ + if (x < 0) + return TRUE; + else + return FALSE; +} + +fge (x) + long long int x; +{ + if (x >= 0) + return TRUE; + else + return FALSE; +} + +fgt (x) + long long int x; +{ + if (x > 0) + return TRUE; + else + return FALSE; +} + +fle (x) + long long int x; +{ + if (x <= 0) + return TRUE; + else + return FALSE; +} + +main () +{ + if (feq (0LL) != TRUE) + abort (); + if (feq (-1LL) != FALSE) + abort (); + if (feq (0x8000000000000000LL) != FALSE) + abort (); + if (feq (0x8000000000000001LL) != FALSE) + abort (); + if (feq (1LL) != FALSE) + abort (); + if (feq (0x7fffffffffffffffLL) != FALSE) + abort (); + + if (fne (0LL) != FALSE) + abort (); + if (fne (-1LL) != TRUE) + abort (); + if (fne (0x8000000000000000LL) != TRUE) + abort (); + if (fne (0x8000000000000001LL) != TRUE) + abort (); + if (fne (1LL) != TRUE) + abort (); + if (fne (0x7fffffffffffffffLL) != TRUE) + abort (); + + if (flt (0LL) != FALSE) + abort (); + if (flt (-1LL) != TRUE) + abort (); + if (flt (0x8000000000000000LL) != TRUE) + abort (); + if (flt (0x8000000000000001LL) != TRUE) + abort (); + if (flt (1LL) != FALSE) + abort (); + if (flt (0x7fffffffffffffffLL) != FALSE) + abort (); + + if (fge (0LL) != TRUE) + abort (); + if (fge (-1LL) != FALSE) + abort (); + if (fge (0x8000000000000000LL) != FALSE) + abort (); + if (fge (0x8000000000000001LL) != FALSE) + abort (); + if (fge (1LL) != TRUE) + abort (); + if (fge (0x7fffffffffffffffLL) != TRUE) + abort (); + + if (fgt (0LL) != FALSE) + abort (); + if (fgt (-1LL) != FALSE) + abort (); + if (fgt (0x8000000000000000LL) != FALSE) + abort (); + if (fgt (0x8000000000000001LL) != FALSE) + abort (); + if (fgt (1LL) != TRUE) + abort (); + if (fgt (0x7fffffffffffffffLL) != TRUE) + abort (); + + if (fle (0LL) != TRUE) + abort (); + if (fle (-1LL) != TRUE) + abort (); + if (fle (0x8000000000000000LL) != TRUE) + abort (); + if (fle (0x8000000000000001LL) != TRUE) + abort (); + if (fle (1LL) != FALSE) + abort (); + if (fle (0x7fffffffffffffffLL) != FALSE) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/unroll-1.c b/gcc/testsuite/gcc.c-torture/execute/unroll-1.c new file mode 100644 index 000000000..881295565 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/unroll-1.c @@ -0,0 +1,19 @@ +inline int +f (int x) +{ + return (x + 1); +} + +int +main (void) +{ + int a = 0 ; + + while ( (f(f(f(f(f(f(f(f(f(f(1))))))))))) + a < 12 ) + { + a++; + exit (0); + } + if (a != 1) + abort(); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/usmul.c b/gcc/testsuite/gcc.c-torture/execute/usmul.c new file mode 100644 index 000000000..28501b53f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/usmul.c @@ -0,0 +1,33 @@ +int __attribute__ ((noinline)) foo (short x, unsigned short y) +{ + return x * y; +} + +int __attribute__ ((noinline)) bar (unsigned short x, short y) +{ + return x * y; +} + +int main () +{ + if (foo (-2, 0xffff) != -131070) + abort (); + if (foo (2, 0xffff) != 131070) + abort (); + if (foo (-32768, 0x8000) != -1073741824) + abort (); + if (foo (32767, 0x8000) != 1073709056) + abort (); + + if (bar (0xffff, -2) != -131070) + abort (); + if (bar (0xffff, 2) != 131070) + abort (); + if (bar (0x8000, -32768) != -1073741824) + abort (); + if (bar (0x8000, 32767) != 1073709056) + abort (); + + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/usmul.x b/gcc/testsuite/gcc.c-torture/execute/usmul.x new file mode 100644 index 000000000..121fcfecc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/usmul.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_int16] } { + return 1 +} + +return 0; diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-1.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-1.c new file mode 100644 index 000000000..3f3b141a9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-1.c @@ -0,0 +1,24 @@ +#include + +typedef unsigned long L; +f (L p0, L p1, L p2, L p3, L p4, L p5, L p6, L p7, L p8, ...) +{ + va_list select; + + va_start (select, p8); + + if (va_arg (select, L) != 10) + abort (); + if (va_arg (select, L) != 11) + abort (); + if (va_arg (select, L) != 0) + abort (); + + va_end (select); +} + +main () +{ + f (1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 0L); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-10.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-10.c new file mode 100644 index 000000000..5ce3453ac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-10.c @@ -0,0 +1,248 @@ +/* This is a modfied version of va-arg-9.c to test va_copy. */ + +#include + +#ifndef va_copy +#define va_copy __va_copy +#endif + +extern __SIZE_TYPE__ strlen (const char *); + +int +to_hex (unsigned int a) +{ + static char hex[] = "0123456789abcdef"; + + if (a > 15) + abort (); + return hex[a]; +} + +void +fap (int i, char* format, va_list ap) +{ + va_list apc; + char *formatc; + + va_copy (apc, ap); + formatc = format; + + if (strlen (format) != 16 - i) + abort (); + while (*format) + if (*format++ != to_hex (va_arg (ap, int))) + abort (); + while (*formatc) + if (*formatc++ != to_hex (va_arg (apc, int))) + abort (); +} + +void +f0 (char* format, ...) +{ + va_list ap; + + va_start (ap, format); + fap(0, format, ap); + va_end(ap); +} + +void +f1 (int a1, char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(1, format, ap); + va_end(ap); +} + +void +f2 (int a1, int a2, char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(2, format, ap); + va_end(ap); +} + +void +f3 (int a1, int a2, int a3, char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(3, format, ap); + va_end(ap); +} + +void +f4 (int a1, int a2, int a3, int a4, char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(4, format, ap); + va_end(ap); +} + +void +f5 (int a1, int a2, int a3, int a4, int a5, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(5, format, ap); + va_end(ap); +} + +void +f6 (int a1, int a2, int a3, int a4, int a5, + int a6, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(6, format, ap); + va_end(ap); +} + +void +f7 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(7, format, ap); + va_end(ap); +} + +void +f8 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, int a8, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(8, format, ap); + va_end(ap); +} + +void +f9 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, int a8, int a9, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(9, format, ap); + va_end(ap); +} + +void +f10 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, int a8, int a9, int a10, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(10, format, ap); + va_end(ap); +} + +void +f11 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, int a8, int a9, int a10, + int a11, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(11, format, ap); + va_end(ap); +} + +void +f12 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, int a8, int a9, int a10, + int a11, int a12, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(12, format, ap); + va_end(ap); +} + +void +f13 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, int a8, int a9, int a10, + int a11, int a12, int a13, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(13, format, ap); + va_end(ap); +} + +void +f14 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, int a8, int a9, int a10, + int a11, int a12, int a13, int a14, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(14, format, ap); + va_end(ap); +} + +void +f15 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, int a8, int a9, int a10, + int a11, int a12, int a13, int a14, int a15, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(15, format, ap); + va_end(ap); +} + +main () +{ + char *f = "0123456789abcdef"; + + f0 (f+0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + f1 (0, f+1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + f2 (0, 1, f+2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + f3 (0, 1, 2, f+3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + f4 (0, 1, 2, 3, f+4, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + f5 (0, 1, 2, 3, 4, f+5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + f6 (0, 1, 2, 3, 4, 5, f+6, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + f7 (0, 1, 2, 3, 4, 5, 6, f+7, 7, 8, 9, 10, 11, 12, 13, 14, 15); + f8 (0, 1, 2, 3, 4, 5, 6, 7, f+8, 8, 9, 10, 11, 12, 13, 14, 15); + f9 (0, 1, 2, 3, 4, 5, 6, 7, 8, f+9, 9, 10, 11, 12, 13, 14, 15); + f10 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, f+10, 10, 11, 12, 13, 14, 15); + f11 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, f+11, 11, 12, 13, 14, 15); + f12 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, f+12, 12, 13, 14, 15); + f13 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, f+13, 13, 14, 15); + f14 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, f+14, 14, 15); + f15 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, f+15, 15); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-11.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-11.c new file mode 100644 index 000000000..b178b880d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-11.c @@ -0,0 +1,29 @@ +/* Test va_arg when the result is ignored and only the pointer increment + side effect is used. */ +#include + +static int +foo (int a, ...) +{ + va_list va; + int i, res; + + va_start (va, a); + + for (i = 0; i < 4; ++i) + (void) va_arg (va, int); + + res = va_arg (va, int); + + va_end (va); + + return res; +} + +int +main (void) +{ + if (foo (5, 4, 3, 2, 1, 0)) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-12.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-12.c new file mode 100644 index 000000000..f2971d91e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-12.c @@ -0,0 +1,25 @@ +#include + +/*typedef unsigned long L;*/ +typedef double L; +void f (L p0, L p1, L p2, L p3, L p4, L p5, L p6, L p7, L p8, ...) +{ + va_list select; + + va_start (select, p8); + + if (va_arg (select, L) != 10.) + abort (); + if (va_arg (select, L) != 11.) + abort (); + if (va_arg (select, L) != 0.) + abort (); + + va_end (select); +} + +int main () +{ + f (1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 0.); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-13.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-13.c new file mode 100644 index 000000000..65caf2b9a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-13.c @@ -0,0 +1,38 @@ +/* derived from mozilla source code */ + +#include + +typedef struct { + void *stream; + va_list ap; + int nChar; +} ScanfState; + +void dummy (va_list vap) +{ + if (va_arg (vap, int) != 1234) abort(); + return; +} + +void test (int fmt, ...) +{ + ScanfState state, *statep; + + statep = &state; + + va_start (statep->ap, fmt); + dummy (statep->ap); + va_end (statep->ap); + + va_start (state.ap, fmt); + dummy (state.ap); + va_end (state.ap); + + return; +} + +int main (void) +{ + test (456, 1234); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-14.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-14.c new file mode 100644 index 000000000..d8b517a42 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-14.c @@ -0,0 +1,45 @@ +#include + +va_list global; + +void vat(va_list param, ...) +{ + va_list local; + + va_start (local, param); + va_copy (global, local); + va_copy (param, local); + if (va_arg (local, int) != 1) + abort(); + va_end (local); + if (va_arg (global, int) != 1) + abort(); + va_end (global); + if (va_arg (param, int) != 1) + abort(); + va_end (param); + + va_start (param, param); + va_start (global, param); + va_copy (local, param); + if (va_arg (local, int) != 1) + abort(); + va_end (local); + va_copy (local, global); + if (va_arg (local, int) != 1) + abort(); + va_end (local); + if (va_arg (global, int) != 1) + abort(); + va_end (global); + if (va_arg (param, int) != 1) + abort(); + va_end (param); +} + +int main(void) +{ + va_list t; + vat (t, 1); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-15.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-15.c new file mode 100644 index 000000000..24411f8c4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-15.c @@ -0,0 +1,44 @@ +#include + +void vafunction (char *dummy, ...) +{ + double darg; + int iarg; + int flag = 0; + int i; + va_list ap; + + va_start(ap, dummy); + for (i = 1; i <= 18; i++, flag++) + { + if (flag & 1) + { + darg = va_arg (ap, double); + if (darg != (double)i) + abort(); + } + else + { + iarg = va_arg (ap, int); + if (iarg != i) + abort(); + } + } + va_end(ap); +} + +int main (void) +{ + vafunction( "", + 1, 2., + 3, 4., + 5, 6., + 7, 8., + 9, 10., + 11, 12., + 13, 14., + 15, 16., + 17, 18. ); + exit(0); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-16.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-16.c new file mode 100644 index 000000000..1115ef085 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-16.c @@ -0,0 +1,41 @@ +#include + +typedef double TYPE; + +void vafunction (TYPE dummy1, TYPE dummy2, ...) +{ + va_list ap; + + va_start(ap, dummy2); + if (dummy1 != 888.) + abort(); + if (dummy2 != 999.) + abort(); + if (va_arg (ap, TYPE) != 1.) + abort(); + if (va_arg (ap, TYPE) != 2.) + abort(); + if (va_arg (ap, TYPE) != 3.) + abort(); + if (va_arg (ap, TYPE) != 4.) + abort(); + if (va_arg (ap, TYPE) != 5.) + abort(); + if (va_arg (ap, TYPE) != 6.) + abort(); + if (va_arg (ap, TYPE) != 7.) + abort(); + if (va_arg (ap, TYPE) != 8.) + abort(); + if (va_arg (ap, TYPE) != 9.) + abort(); + va_end(ap); +} + + +int main (void) +{ + vafunction( 888., 999., 1., 2., 3., 4., 5., 6., 7., 8., 9. ); + exit(0); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-17.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-17.c new file mode 100644 index 000000000..17850db14 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-17.c @@ -0,0 +1,37 @@ +#include + +typedef double TYPE; + +void vafunction (char *dummy, ...) +{ + va_list ap; + + va_start(ap, dummy); + if (va_arg (ap, TYPE) != 1.) + abort(); + if (va_arg (ap, TYPE) != 2.) + abort(); + if (va_arg (ap, TYPE) != 3.) + abort(); + if (va_arg (ap, TYPE) != 4.) + abort(); + if (va_arg (ap, TYPE) != 5.) + abort(); + if (va_arg (ap, TYPE) != 6.) + abort(); + if (va_arg (ap, TYPE) != 7.) + abort(); + if (va_arg (ap, TYPE) != 8.) + abort(); + if (va_arg (ap, TYPE) != 9.) + abort(); + va_end(ap); +} + + +int main (void) +{ + vafunction( "", 1., 2., 3., 4., 5., 6., 7., 8., 9. ); + exit(0); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-18.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-18.c new file mode 100644 index 000000000..00dd54f4f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-18.c @@ -0,0 +1,24 @@ +#include + +typedef double L; +void f (L p0, L p1, L p2, L p3, L p4, L p5, L p6, L p7, L p8, ...) +{ + va_list select; + + va_start (select, p8); + + if (va_arg (select, int) != 10) + abort (); + if (va_arg (select, int) != 11) + abort (); + if (va_arg (select, int) != 12) + abort (); + + va_end (select); +} + +int main () +{ + f (1., 2., 3., 4., 5., 6., 7., 8., 9., 10, 11, 12); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-19.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-19.c new file mode 100644 index 000000000..9fdf49d89 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-19.c @@ -0,0 +1,37 @@ +#include + +typedef int TYPE; + +void vafunction (char *dummy, ...) +{ + va_list ap; + + va_start(ap, dummy); + if (va_arg (ap, TYPE) != 1) + abort(); + if (va_arg (ap, TYPE) != 2) + abort(); + if (va_arg (ap, TYPE) != 3) + abort(); + if (va_arg (ap, TYPE) != 4) + abort(); + if (va_arg (ap, TYPE) != 5) + abort(); + if (va_arg (ap, TYPE) != 6) + abort(); + if (va_arg (ap, TYPE) != 7) + abort(); + if (va_arg (ap, TYPE) != 8) + abort(); + if (va_arg (ap, TYPE) != 9) + abort(); + va_end(ap); +} + + +int main (void) +{ + vafunction( "", 1, 2, 3, 4, 5, 6, 7, 8, 9 ); + exit(0); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-2.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-2.c new file mode 100644 index 000000000..7675b3f76 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-2.c @@ -0,0 +1,292 @@ +/* The purpose of this test is to catch edge cases when arguments are passed + in regs and on the stack. We test 16 cases, trying to catch multiple + targets (some use 3 regs for argument passing, some use 12, etc.). + We test both the arguments and the `lastarg' (the argument to va_start). */ + +#include + +extern __SIZE_TYPE__ strlen (); + +int +to_hex (unsigned int a) +{ + static char hex[] = "0123456789abcdef"; + + if (a > 15) + abort (); + return hex[a]; +} + +void +f0 (char* format, ...) +{ + va_list ap; + + va_start (ap, format); + if (strlen (format) != 16 - 0) + abort (); + while (*format) + if (*format++ != to_hex (va_arg (ap, int))) + abort (); + va_end(ap); +} + +void +f1 (int a1, char* format, ...) +{ + va_list ap; + + va_start(ap, format); + if (strlen (format) != 16 - 1) + abort (); + while (*format) + if (*format++ != to_hex (va_arg (ap, int))) + abort (); + va_end(ap); +} + +void +f2 (int a1, int a2, char* format, ...) +{ + va_list ap; + + va_start(ap, format); + if (strlen (format) != 16 - 2) + abort (); + while (*format) + if (*format++ != to_hex (va_arg (ap, int))) + abort (); + va_end(ap); +} + +void +f3 (int a1, int a2, int a3, char* format, ...) +{ + va_list ap; + + va_start(ap, format); + if (strlen (format) != 16 - 3) + abort (); + while (*format) + if (*format++ != to_hex (va_arg (ap, int))) + abort (); + va_end(ap); +} + +void +f4 (int a1, int a2, int a3, int a4, char* format, ...) +{ + va_list ap; + + va_start(ap, format); + if (strlen (format) != 16 - 4) + abort (); + while (*format) + if (*format++ != to_hex (va_arg (ap, int))) + abort (); + va_end(ap); +} + +void +f5 (int a1, int a2, int a3, int a4, int a5, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + if (strlen (format) != 16 - 5) + abort (); + while (*format) + if (*format++ != to_hex (va_arg (ap, int))) + abort (); + va_end(ap); +} + +void +f6 (int a1, int a2, int a3, int a4, int a5, + int a6, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + if (strlen (format) != 16 - 6) + abort (); + while (*format) + if (*format++ != to_hex (va_arg (ap, int))) + abort (); + va_end(ap); +} + +void +f7 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + if (strlen (format) != 16 - 7) + abort (); + while (*format) + if (*format++ != to_hex (va_arg (ap, int))) + abort (); + va_end(ap); +} + +void +f8 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, int a8, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + if (strlen (format) != 16 - 8) + abort (); + while (*format) + if (*format++ != to_hex (va_arg (ap, int))) + abort (); + va_end(ap); +} + +void +f9 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, int a8, int a9, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + if (strlen (format) != 16 - 9) + abort (); + while (*format) + if (*format++ != to_hex (va_arg (ap, int))) + abort (); + va_end(ap); +} + +void +f10 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, int a8, int a9, int a10, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + if (strlen (format) != 16 - 10) + abort (); + while (*format) + if (*format++ != to_hex (va_arg (ap, int))) + abort (); + va_end(ap); +} + +void +f11 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, int a8, int a9, int a10, + int a11, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + if (strlen (format) != 16 - 11) + abort (); + while (*format) + if (*format++ != to_hex (va_arg (ap, int))) + abort (); + va_end(ap); +} + +void +f12 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, int a8, int a9, int a10, + int a11, int a12, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + if (strlen (format) != 16 - 12) + abort (); + while (*format) + if (*format++ != to_hex (va_arg (ap, int))) + abort (); + va_end(ap); +} + +void +f13 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, int a8, int a9, int a10, + int a11, int a12, int a13, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + if (strlen (format) != 16 - 13) + abort (); + while (*format) + if (*format++ != to_hex (va_arg (ap, int))) + abort (); + va_end(ap); +} + +void +f14 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, int a8, int a9, int a10, + int a11, int a12, int a13, int a14, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + if (strlen (format) != 16 - 14) + abort (); + while (*format) + if (*format++ != to_hex (va_arg (ap, int))) + abort (); + va_end(ap); +} + +void +f15 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, int a8, int a9, int a10, + int a11, int a12, int a13, int a14, int a15, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + if (strlen (format) != 16 - 15) + abort (); + while (*format) + if (*format++ != to_hex (va_arg (ap, int))) + abort (); + va_end(ap); +} + +main () +{ + char *f = "0123456789abcdef"; + + f0 (f+0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + f1 (0, f+1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + f2 (0, 1, f+2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + f3 (0, 1, 2, f+3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + f4 (0, 1, 2, 3, f+4, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + f5 (0, 1, 2, 3, 4, f+5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + f6 (0, 1, 2, 3, 4, 5, f+6, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + f7 (0, 1, 2, 3, 4, 5, 6, f+7, 7, 8, 9, 10, 11, 12, 13, 14, 15); + f8 (0, 1, 2, 3, 4, 5, 6, 7, f+8, 8, 9, 10, 11, 12, 13, 14, 15); + f9 (0, 1, 2, 3, 4, 5, 6, 7, 8, f+9, 9, 10, 11, 12, 13, 14, 15); + f10 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, f+10, 10, 11, 12, 13, 14, 15); + f11 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, f+11, 11, 12, 13, 14, 15); + f12 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, f+12, 12, 13, 14, 15); + f13 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, f+13, 13, 14, 15); + f14 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, f+14, 14, 15); + f15 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, f+15, 15); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-20.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-20.c new file mode 100644 index 000000000..2e8e5640d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-20.c @@ -0,0 +1,22 @@ +#include + +void foo(va_list v) +{ + unsigned long long x = va_arg (v, unsigned long long); + if (x != 16LL) + abort(); +} + +void bar(char c, char d, ...) +{ + va_list v; + va_start(v, d); + foo(v); + va_end(v); +} + +int main(void) +{ + bar(0, 0, 16LL); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-21.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-21.c new file mode 100644 index 000000000..044541ba8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-21.c @@ -0,0 +1,48 @@ +/* Copyright (C) 2000 Free Software Foundation. + + If the argument to va_end() has side effects, test whether side + effects from that argument are honored. + + Written by Kaveh R. Ghazi, 10/31/2000. */ + +#include +#include +#include + +#ifndef __GNUC__ +#define __attribute__(x) +#endif + +static void __attribute__ ((__format__ (__printf__, 1, 2))) +doit (const char *s, ...) +{ + va_list *ap_array[3], **ap_ptr = ap_array; + + ap_array[0] = malloc (sizeof(va_list)); + ap_array[1] = NULL; + ap_array[2] = malloc (sizeof(va_list)); + + va_start (*ap_array[0], s); + vprintf (s, **ap_ptr); + /* Increment the va_list pointer once. */ + va_end (**ap_ptr++); + + /* Increment the va_list pointer a second time. */ + ap_ptr++; + + va_start (*ap_array[2], s); + /* If we failed to increment ap_ptr twice, then the parameter passed + in here will dereference NULL and should cause a crash. */ + vprintf (s, **ap_ptr); + va_end (**ap_ptr); + + /* Just in case, If *ap_ptr is NULL abort anyway. */ + if (*ap_ptr == 0) + abort(); +} + +int main() +{ + doit ("%s", "hello world\n"); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-22.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-22.c new file mode 100644 index 000000000..46b8dcbe8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-22.c @@ -0,0 +1,78 @@ +#include + +extern void abort (void); +extern void exit (int); + +void bar (int n, int c) +{ + static int lastn = -1, lastc = -1; + + if (lastn != n) + { + if (lastc != lastn) + abort (); + lastc = 0; + lastn = n; + } + + if (c != (char) (lastc ^ (n << 3))) + abort (); + lastc++; +} + +#define D(N) typedef struct { char x[N]; } A##N; +D(0) D(1) D(2) D(3) D(4) D(5) D(6) D(7) +D(8) D(9) D(10) D(11) D(12) D(13) D(14) D(15) +D(16) D(31) D(32) D(35) D(72) +#undef D + +void foo (int size, ...) +{ +#define D(N) A##N a##N; +D(0) D(1) D(2) D(3) D(4) D(5) D(6) D(7) +D(8) D(9) D(10) D(11) D(12) D(13) D(14) D(15) +D(16) D(31) D(32) D(35) D(72) +#undef D + va_list ap; + int i; + + if (size != 21) + abort (); + va_start (ap, size); +#define D(N) \ + a##N = va_arg (ap, typeof (a##N)); \ + for (i = 0; i < N; i++) \ + bar (N, a##N.x[i]); +D(0) D(1) D(2) D(3) D(4) D(5) D(6) D(7) +D(8) D(9) D(10) D(11) D(12) D(13) D(14) D(15) +D(16) D(31) D(32) D(35) D(72) +#undef D + va_end (ap); +} + +int main (void) +{ +#define D(N) A##N a##N; +D(0) D(1) D(2) D(3) D(4) D(5) D(6) D(7) +D(8) D(9) D(10) D(11) D(12) D(13) D(14) D(15) +D(16) D(31) D(32) D(35) D(72) +#undef D + int i; + +#define D(N) \ + for (i = 0; i < N; i++) \ + a##N.x[i] = i ^ (N << 3); +D(0) D(1) D(2) D(3) D(4) D(5) D(6) D(7) +D(8) D(9) D(10) D(11) D(12) D(13) D(14) D(15) +D(16) D(31) D(32) D(35) D(72) +#undef D + + foo (21 +#define D(N) , a##N +D(0) D(1) D(2) D(3) D(4) D(5) D(6) D(7) +D(8) D(9) D(10) D(11) D(12) D(13) D(14) D(15) +D(16) D(31) D(32) D(35) D(72) +#undef D + ); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-23.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-23.c new file mode 100644 index 000000000..89a11cf9f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-23.c @@ -0,0 +1,26 @@ +/* PR 9700 */ +/* Alpha got the base address for the va_list incorrect when there was + a structure that was passed partially in registers and partially on + the stack. */ + +#include + +struct two { long x, y; }; + +void foo(int a, int b, int c, int d, int e, struct two f, int g, ...) +{ + va_list args; + int h; + + va_start(args, g); + h = va_arg(args, int); + if (g != 1 || h != 2) + abort (); +} + +int main() +{ + struct two t = { 0, 0 }; + foo(0, 0, 0, 0, 0, t, 1, 2); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-24.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-24.c new file mode 100644 index 000000000..811b11f31 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-24.c @@ -0,0 +1,96 @@ +/* The purpose of this code is to test argument passing of a tuple of + 11 integers, with the break point between named and unnamed arguments + at every possible position. */ + +#include +#include +#include + +static int errors = 0; + +static void +verify (const char *tcase, int n[11]) +{ + int i; + for (i = 0; i <= 10; i++) + if (n[i] != i) + { + printf (" %s: n[%d] = %d expected %d\n", tcase, i, n[i], i); + errors++; + } +} + +#define STR(x) #x + +#define p(i) int q##i, +#define P(i) n[i] = q##i; + +#define p0 p(0) +#define p1 p(1) +#define p2 p(2) +#define p3 p(3) +#define p4 p(4) +#define p5 p(5) +#define p6 p(6) +#define p7 p(7) +#define p8 p(8) +#define p9 p(9) + +#define P0 P(0) +#define P1 P(1) +#define P2 P(2) +#define P3 P(3) +#define P4 P(4) +#define P5 P(5) +#define P6 P(6) +#define P7 P(7) +#define P8 P(8) +#define P9 P(9) + +#define TCASE(x, params, vecinit) \ +static void \ +varargs##x (params ...) \ +{ \ + va_list ap; \ + int n[11]; \ + int i; \ + \ + va_start (ap, q##x); \ + vecinit \ + for (i = x + 1; i <= 10; i++) \ + n[i] = va_arg (ap, int); \ + va_end (ap); \ + \ + verify (STR(varargs##x), n); \ +} + +#define TEST(x) varargs##x (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) + +TCASE(0, p0 , P0 ) +TCASE(1, p0 p1 , P0 P1 ) +TCASE(2, p0 p1 p2 , P0 P1 P2 ) +TCASE(3, p0 p1 p2 p3 , P0 P1 P2 P3 ) +TCASE(4, p0 p1 p2 p3 p4 , P0 P1 P2 P3 P4 ) +TCASE(5, p0 p1 p2 p3 p4 p5 , P0 P1 P2 P3 P4 P5 ) +TCASE(6, p0 p1 p2 p3 p4 p5 p6 , P0 P1 P2 P3 P4 P5 P6 ) +TCASE(7, p0 p1 p2 p3 p4 p5 p6 p7 , P0 P1 P2 P3 P4 P5 P6 P7 ) +TCASE(8, p0 p1 p2 p3 p4 p5 p6 p7 p8 , P0 P1 P2 P3 P4 P5 P6 P7 P8 ) +TCASE(9, p0 p1 p2 p3 p4 p5 p6 p7 p8 p9, P0 P1 P2 P3 P4 P5 P6 P7 P8 P9) + +int main(void) +{ + TEST(0); + TEST(1); + TEST(2); + TEST(3); + TEST(4); + TEST(5); + TEST(6); + TEST(7); + TEST(8); + TEST(9); + + if (errors) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-26.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-26.c new file mode 100644 index 000000000..8221e9c42 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-26.c @@ -0,0 +1,20 @@ +#include + +double f (float f1, float f2, float f3, float f4, + float f5, float f6, ...) +{ + va_list ap; + double d; + + va_start (ap, f6); + d = va_arg (ap, double); + va_end (ap); + return d; +} + +int main () +{ + if (f (1, 2, 3, 4, 5, 6, 7.0) != 7.0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-4.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-4.c new file mode 100644 index 000000000..a824f64ff --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-4.c @@ -0,0 +1,33 @@ +/* On the i960 any arg bigger than 16 bytes causes all subsequent args + to be passed on the stack. We test this. */ + +#include + +typedef struct { + char a[32]; +} big; + +void +f (big x, char *s, ...) +{ + va_list ap; + + if (x.a[0] != 'a' || x.a[1] != 'b' || x.a[2] != 'c') + abort (); + va_start (ap, s); + if (va_arg (ap, int) != 42) + abort (); + if (va_arg (ap, int) != 'x') + abort (); + if (va_arg (ap, int) != 0) + abort (); + va_end (ap); +} + +main () +{ + static big x = { "abc" }; + + f (x, "", 42, 'x', 0); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-5.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-5.c new file mode 100644 index 000000000..3d8b1a79a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-5.c @@ -0,0 +1,44 @@ +#include + +va_double (int n, ...) +{ + va_list args; + + va_start (args, n); + + if (va_arg (args, double) != 3.141592) + abort (); + if (va_arg (args, double) != 2.71827) + abort (); + if (va_arg (args, double) != 2.2360679) + abort (); + if (va_arg (args, double) != 2.1474836) + abort (); + + va_end (args); +} + +va_long_double (int n, ...) +{ + va_list args; + + va_start (args, n); + + if (va_arg (args, long double) != 3.141592L) + abort (); + if (va_arg (args, long double) != 2.71827L) + abort (); + if (va_arg (args, long double) != 2.2360679L) + abort (); + if (va_arg (args, long double) != 2.1474836L) + abort (); + + va_end (args); +} + +main () +{ + va_double (4, 3.141592, 2.71827, 2.2360679, 2.1474836); + va_long_double (4, 3.141592L, 2.71827L, 2.2360679L, 2.1474836L); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-6.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-6.c new file mode 100644 index 000000000..e8d495d66 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-6.c @@ -0,0 +1,35 @@ +#include + +f (int n, ...) +{ + va_list args; + + va_start (args, n); + + if (va_arg (args, int) != 10) + abort (); + if (va_arg (args, long long) != 10000000000LL) + abort (); + if (va_arg (args, int) != 11) + abort (); + if (va_arg (args, long double) != 3.14L) + abort (); + if (va_arg (args, int) != 12) + abort (); + if (va_arg (args, int) != 13) + abort (); + if (va_arg (args, long long) != 20000000000LL) + abort (); + if (va_arg (args, int) != 14) + abort (); + if (va_arg (args, double) != 2.72) + abort (); + + va_end(args); +} + +main () +{ + f (4, 10, 10000000000LL, 11, 3.14L, 12, 13, 20000000000LL, 14, 2.72); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-7.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-7.c new file mode 100644 index 000000000..f45219a56 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-7.c @@ -0,0 +1,31 @@ +/* Origin: Franz Sirl */ + +#include + +inline void +debug(int i1, int i2, int i3, int i4, int i5, int i6, int i7, + double f1, double f2, double f3, double f4, double f5, + double f6, double f7, double f8, double f9, ...) +{ + va_list ap; + + va_start (ap, f9); + + if (va_arg (ap,int) != 8) + abort (); + if (va_arg (ap,int) != 9) + abort (); + if (va_arg (ap,int) != 10) + abort (); + + va_end (ap); +} + +int +main(void) +{ + debug (1, 2, 3, 4, 5, 6, 7, + 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, + 8, 9, 10); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-8.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-8.c new file mode 100644 index 000000000..964833b52 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-8.c @@ -0,0 +1,41 @@ +/* Origin: Franz Sirl */ + +#include +#include + +#if __LONG_LONG_MAX__ == 9223372036854775807LL + +typedef long long int INT64; + +inline void +debug(int i1, int i2, int i3, int i4, int i5, + int i6, int i7, int i8, int i9, ...) +{ + va_list ap; + + va_start (ap, i9); + + if (va_arg (ap,int) != 10) + abort (); + if (va_arg (ap,INT64) != 0x123400005678LL) + abort (); + + va_end (ap); +} + +int +main(void) +{ + debug(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0x123400005678LL); + exit(0); +} + +#else + +int +main(void) +{ + exit(0); +} + +#endif /* long long 64 bits */ diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-9.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-9.c new file mode 100644 index 000000000..f0a92dcdd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-9.c @@ -0,0 +1,236 @@ +/* This is a modfied version of va-arg-2.c to test passing a va_list as + a parameter to another function. */ + +#include + +extern __SIZE_TYPE__ strlen (const char *); + +int +to_hex (unsigned int a) +{ + static char hex[] = "0123456789abcdef"; + + if (a > 15) + abort (); + return hex[a]; +} + +void +fap (int i, char* format, va_list ap) +{ + if (strlen (format) != 16 - i) + abort (); + while (*format) + if (*format++ != to_hex (va_arg (ap, int))) + abort (); +} + +void +f0 (char* format, ...) +{ + va_list ap; + + va_start (ap, format); + fap(0, format, ap); + va_end(ap); +} + +void +f1 (int a1, char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(1, format, ap); + va_end(ap); +} + +void +f2 (int a1, int a2, char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(2, format, ap); + va_end(ap); +} + +void +f3 (int a1, int a2, int a3, char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(3, format, ap); + va_end(ap); +} + +void +f4 (int a1, int a2, int a3, int a4, char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(4, format, ap); + va_end(ap); +} + +void +f5 (int a1, int a2, int a3, int a4, int a5, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(5, format, ap); + va_end(ap); +} + +void +f6 (int a1, int a2, int a3, int a4, int a5, + int a6, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(6, format, ap); + va_end(ap); +} + +void +f7 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(7, format, ap); + va_end(ap); +} + +void +f8 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, int a8, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(8, format, ap); + va_end(ap); +} + +void +f9 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, int a8, int a9, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(9, format, ap); + va_end(ap); +} + +void +f10 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, int a8, int a9, int a10, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(10, format, ap); + va_end(ap); +} + +void +f11 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, int a8, int a9, int a10, + int a11, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(11, format, ap); + va_end(ap); +} + +void +f12 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, int a8, int a9, int a10, + int a11, int a12, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(12, format, ap); + va_end(ap); +} + +void +f13 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, int a8, int a9, int a10, + int a11, int a12, int a13, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(13, format, ap); + va_end(ap); +} + +void +f14 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, int a8, int a9, int a10, + int a11, int a12, int a13, int a14, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(14, format, ap); + va_end(ap); +} + +void +f15 (int a1, int a2, int a3, int a4, int a5, + int a6, int a7, int a8, int a9, int a10, + int a11, int a12, int a13, int a14, int a15, + char* format, ...) +{ + va_list ap; + + va_start(ap, format); + fap(15, format, ap); + va_end(ap); +} + +main () +{ + char *f = "0123456789abcdef"; + + f0 (f+0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + f1 (0, f+1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + f2 (0, 1, f+2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + f3 (0, 1, 2, f+3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + f4 (0, 1, 2, 3, f+4, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + f5 (0, 1, 2, 3, 4, f+5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + f6 (0, 1, 2, 3, 4, 5, f+6, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + f7 (0, 1, 2, 3, 4, 5, 6, f+7, 7, 8, 9, 10, 11, 12, 13, 14, 15); + f8 (0, 1, 2, 3, 4, 5, 6, 7, f+8, 8, 9, 10, 11, 12, 13, 14, 15); + f9 (0, 1, 2, 3, 4, 5, 6, 7, 8, f+9, 9, 10, 11, 12, 13, 14, 15); + f10 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, f+10, 10, 11, 12, 13, 14, 15); + f11 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, f+11, 11, 12, 13, 14, 15); + f12 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, f+12, 12, 13, 14, 15); + f13 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, f+13, 13, 14, 15); + f14 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, f+14, 14, 15); + f15 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, f+15, 15); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-pack-1.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-pack-1.c new file mode 100644 index 000000000..baefe8758 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-pack-1.c @@ -0,0 +1,143 @@ +/* __builtin_va_arg_pack () builtin tests. */ + +#include + +extern void abort (void); + +int v1 = 8; +long int v2 = 3; +void *v3 = (void *) &v2; +struct A { char c[16]; } v4 = { "foo" }; +long double v5 = 40; +char seen[20]; +int cnt; + +__attribute__ ((noinline)) int +foo1 (int x, int y, ...) +{ + int i; + long int l; + void *v; + struct A a; + long double ld; + va_list ap; + + va_start (ap, y); + if (x < 0 || x >= 20 || seen[x]) + abort (); + seen[x] = ++cnt; + if (y != 6) + abort (); + i = va_arg (ap, int); + if (i != 5) + abort (); + switch (x) + { + case 0: + i = va_arg (ap, int); + if (i != 9 || v1 != 9) + abort (); + a = va_arg (ap, struct A); + if (__builtin_memcmp (a.c, v4.c, sizeof (a.c)) != 0) + abort (); + v = (void *) va_arg (ap, struct A *); + if (v != (void *) &v4) + abort (); + l = va_arg (ap, long int); + if (l != 3 || v2 != 4) + abort (); + break; + case 1: + ld = va_arg (ap, long double); + if (ld != 41 || v5 != ld) + abort (); + i = va_arg (ap, int); + if (i != 8) + abort (); + v = va_arg (ap, void *); + if (v != &v2) + abort (); + break; + case 2: + break; + default: + abort (); + } + va_end (ap); + return x; +} + +__attribute__ ((noinline)) int +foo2 (int x, int y, ...) +{ + long long int ll; + void *v; + struct A a, b; + long double ld; + va_list ap; + + va_start (ap, y); + if (x < 0 || x >= 20 || seen[x]) + abort (); + seen[x] = ++cnt | 64; + if (y != 10) + abort (); + switch (x) + { + case 11: + break; + case 12: + ld = va_arg (ap, long double); + if (ld != 41 || v5 != 40) + abort (); + a = va_arg (ap, struct A); + if (__builtin_memcmp (a.c, v4.c, sizeof (a.c)) != 0) + abort (); + b = va_arg (ap, struct A); + if (__builtin_memcmp (b.c, v4.c, sizeof (b.c)) != 0) + abort (); + v = va_arg (ap, void *); + if (v != &v2) + abort (); + ll = va_arg (ap, long long int); + if (ll != 16LL) + abort (); + break; + case 2: + break; + default: + abort (); + } + va_end (ap); + return x + 8; +} + +__attribute__ ((noinline)) int +foo3 (void) +{ + return 6; +} + +extern inline __attribute__ ((always_inline, gnu_inline)) int +bar (int x, ...) +{ + if (x < 10) + return foo1 (x, foo3 (), 5, __builtin_va_arg_pack ()); + return foo2 (x, foo3 () + 4, __builtin_va_arg_pack ()); +} + +int +main (void) +{ + if (bar (0, ++v1, v4, &v4, v2++) != 0) + abort (); + if (bar (1, ++v5, 8, v3) != 1) + abort (); + if (bar (2) != 2) + abort (); + if (bar (v1 + 2) != 19) + abort (); + if (bar (v1 + 3, v5--, v4, v4, v3, 16LL) != 20) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-trap-1.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-trap-1.c new file mode 100644 index 000000000..1e1dae8e8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-trap-1.c @@ -0,0 +1,36 @@ +/* Undefined behavior from a call to va_arg with a type other than + that of the argument passed (in particular, with a type such as + "float" that can never be the type of an argument passed through + "...") does not appear until after the va_list expression is + evaluated. PR 38483. */ +/* Origin: Joseph Myers */ + +#include + +extern void exit (int); +extern void abort (void); + +va_list ap; +float f; + +va_list * +foo (void) +{ + exit (0); + return ≈ +} + +void +bar (int i, ...) +{ + va_start (ap, i); + f = va_arg (*foo (), float); + va_end (ap); +} + +int +main (void) +{ + bar (1, 0); + abort (); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/vector-shift.c b/gcc/testsuite/gcc.c-torture/execute/vector-shift.c new file mode 100644 index 000000000..f52eb58a1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vector-shift.c @@ -0,0 +1,48 @@ + +#define vector __attribute__((vector_size(sizeof(int)*4) )) + +static vector int allones = {1, 1, 1, 1}; +static vector int allzeros = {0, 0, 0, 0}; +static vector int numbers = {0, 1, 2, 3}; +static vector int numbersleftshiftallones = {0, 2, 4, 6}; +static vector int numbersrightshiftallones = {0, 0, 1, 1}; + + +static vector unsigned int uallones = {1, 1, 1, 1}; +static vector unsigned int uallzeros = {0, 0, 0, 0}; +static vector unsigned int unumbers = {0, 1, 2, 3}; +static vector unsigned int unumbersleftshiftallones = {0, 2, 4, 6}; +static vector unsigned int unumbersrightshiftallones = {0, 0, 1, 1}; + +#define TEST(result, expected) \ +do { \ + typeof(result) result1 = result; \ + if(sizeof (result1) != sizeof (expected)) \ + __builtin_abort (); \ + if (__builtin_memcmp (&result1, &expected, sizeof(result1)) != 0) \ + __builtin_abort (); \ +}while (0); + +int main(void) +{ + vector int result; + TEST ((numbers << allzeros), numbers); + TEST ((numbers >> allzeros), numbers); + TEST((numbers << allones), numbersleftshiftallones); + TEST((numbers >> allones), numbersrightshiftallones); + /* Test left shift followed by a right shift, numbers should be back as + numbers are all small numbers and no lose of precision happens. */ + TEST((numbers << allones) >> allones, numbers); + + + + TEST ((unumbers << uallzeros), unumbers); + TEST ((unumbers >> uallzeros), unumbers); + TEST((unumbers << uallones), unumbersleftshiftallones); + TEST((unumbers >> uallones), unumbersrightshiftallones); + /* Test left shift followed by a right shift, numbers should be back as + numbers are all small numbers and no lose of precision happens. */ + TEST((unumbers << uallones) >> uallones, unumbers); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/vector-shift1.c b/gcc/testsuite/gcc.c-torture/execute/vector-shift1.c new file mode 100644 index 000000000..6041fc3b0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vector-shift1.c @@ -0,0 +1,17 @@ +#define vector __attribute__((vector_size(8*sizeof(short)))) + +int main (int argc, char *argv[]) { + vector short v0 = {argc,2,3,4,5,6,7}; + vector short v1 = {2,2,2,2,2,2,2}; + vector short r1,r2,r3,r4; + int i = 8; + + r1 = v0 << 1; + r2 = v0 >> 1; + + r3 = v0 << v1; + r4 = v0 >> v1; + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/vector-shift2.c b/gcc/testsuite/gcc.c-torture/execute/vector-shift2.c new file mode 100644 index 000000000..55f103555 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vector-shift2.c @@ -0,0 +1,59 @@ +#define vector(elcount, type) \ +__attribute__((vector_size((elcount)*sizeof(type)))) type + +#define vidx(type, vec, idx) (*((type *) &(vec) + idx)) +#define uint unsigned int + +int main (int argc, char *argv[]) { + vector(4, uint) vuint = { 1, 2, 3, 4}; + vector(4, int) vint0 = { 1, 1, 1, 1}; + vector(4, int) vint1 = {-1, -1, -1, -1}; + + vector(4, int) i1, i2, i3; + vector(4, uint) u1, u2, u3; + + i1 = vint1<< vint0; + + if (vidx(int, i1, 0) != ((int)-1 << (int)1)) + __builtin_abort (); + if (vidx(int, i1, 1) != ((int)-1 << (int)1)) + __builtin_abort (); + if (vidx(int, i1, 2) != ((int)-1 << (int)1)) + __builtin_abort (); + if (vidx(int, i1, 3) != ((int)-1 << (int)1)) + __builtin_abort (); + + u1 = vuint << vint0; + + if (vidx(int, u1, 0) != ((uint)1 << (int)1)) + __builtin_abort (); + if (vidx(int, u1, 1) != ((uint)2 << (int)1)) + __builtin_abort (); + if (vidx(int, u1, 2) != ((uint)3 << (int)1)) + __builtin_abort (); + if (vidx(int, u1, 3) != ((uint)4 << (int)1)) + __builtin_abort (); + + + i2 = vint1 >> vuint; + + if (vidx(int, i2, 0) != ((int)-1 >> (uint)1)) + __builtin_abort (); + if (vidx(int, i2, 1) != ((int)-1 >> (uint)2)) + __builtin_abort (); + if (vidx(int, i2, 2) != ((int)-1 >> (uint)3)) + __builtin_abort (); + if (vidx(int, i2, 3) != ((int)-1 >> (uint)4)) + __builtin_abort (); + + + vint1 >>= vuint; + + vuint <<= vint0; + vuint <<= vint1; + + + return 0; +} + + diff --git a/gcc/testsuite/gcc.c-torture/execute/vector-subscript-1.c b/gcc/testsuite/gcc.c-torture/execute/vector-subscript-1.c new file mode 100644 index 000000000..03647fd50 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vector-subscript-1.c @@ -0,0 +1,60 @@ +/* dg-do run */ +#define vector __attribute__((vector_size(sizeof(int)*4) )) + +/* Check to make sure that we extract and insert the vector at the same + location for vector subscripting and that vectors layout are the same + as arrays. */ + +struct TV4 +{ + vector int v; +}; + +typedef struct TV4 MYV4; +static inline int *f(MYV4 *a, int i) +{ + return &(a->v[i]); +} + +static inline MYV4 myfunc2( int x, int y, int z, int w ) +{ + MYV4 temp; + *f(&temp, 0 ) = x; + *f(&temp, 1 ) = y; + *f(&temp, 2 ) = z; + *f(&temp, 3 ) = w; + return temp; +} + +MYV4 val3; + +__attribute__((noinline)) void modify (void) +{ + val3 = myfunc2( 1, 2, 3, 4 ); +} + +int main( int argc, char* argv[] ) +{ + int a[4]; + int i; + + modify(); + + if (*f(&val3, 0 ) != 1) + __builtin_abort (); + if (*f(&val3, 1 ) != 2) + __builtin_abort (); + if (*f(&val3, 2 ) != 3) + __builtin_abort (); + if (*f(&val3, 3 ) != 4) + __builtin_abort (); + + __builtin_memcpy(a, &val3, 16); + for(i = 0; i < 4; i++) + if (a[i] != i+1) + __builtin_abort (); + + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/vector-subscript-2.c b/gcc/testsuite/gcc.c-torture/execute/vector-subscript-2.c new file mode 100644 index 000000000..d0e5b889c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vector-subscript-2.c @@ -0,0 +1,67 @@ +#define vector __attribute__((vector_size(sizeof(int)*4) )) + +/* Check to make sure that we extract and insert the vector at the same + location for vector subscripting (with constant indexes) and + that vectors layout are the same as arrays. */ + +struct TV4 +{ + vector int v; +}; + +typedef struct TV4 MYV4; + +static inline MYV4 myfunc2( int x, int y, int z, int w ) +{ + MYV4 temp; + temp.v[0] = x; + temp.v[1] = y; + temp.v[2] = z; + temp.v[3] = w; + return temp; +} +MYV4 val3; +__attribute__((noinline)) void modify (void) +{ + val3 = myfunc2( 1, 2, 3, 4 ); +} +int main( int argc, char* argv[] ) +{ + int a[4]; + int i; + + /* Set up the vector. */ + modify(); + + /* Check the vector via the global variable. */ + if (val3.v[0] != 1) + __builtin_abort (); + if (val3.v[1] != 2) + __builtin_abort (); + if (val3.v[2] != 3) + __builtin_abort (); + if (val3.v[3] != 4) + __builtin_abort (); + + vector int a1 = val3.v; + + /* Check the vector via a local variable. */ + if (a1[0] != 1) + __builtin_abort (); + if (a1[1] != 2) + __builtin_abort (); + if (a1[2] != 3) + __builtin_abort (); + if (a1[3] != 4) + __builtin_abort (); + + __builtin_memcpy(a, &val3, sizeof(a)); + /* Check the vector via copying it to an array. */ + for(i = 0; i < 4; i++) + if (a[i] != i+1) + __builtin_abort (); + + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/vector-subscript-3.c b/gcc/testsuite/gcc.c-torture/execute/vector-subscript-3.c new file mode 100644 index 000000000..97d531c17 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vector-subscript-3.c @@ -0,0 +1,26 @@ +/* dg-do run */ +#define vector __attribute__((vector_size(16) )) + +/* Check whether register declaration of vector type still + allow us to subscript this type. */ + +typedef vector short myvec_t; + +struct vec_s { + vector short member; +}; + + +int main () { + register short vector v0 = {1,2,3,4,5,6,7}; + register myvec_t v1 = {1,2,3,4,5,6,7}; + register struct vec_s v2; + + v2.member = v1; + + short r = v0[0] + v1[1] + v2.member[2]; + if (r != 6) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/vfprintf-1.c b/gcc/testsuite/gcc.c-torture/execute/vfprintf-1.c new file mode 100644 index 000000000..c00380425 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vfprintf-1.c @@ -0,0 +1,53 @@ +#ifndef test +#include +#include +#include + +void +inner (int x, ...) +{ + va_list ap, ap2; + va_start (ap, x); + va_start (ap2, x); + + switch (x) + { +#define test(n, ret, fmt, args) \ + case n: \ + vfprintf (stdout, fmt, ap); \ + if (vfprintf (stdout, fmt, ap2) != ret) \ + abort (); \ + break; +#include "vfprintf-1.c" +#undef test + default: + abort (); + } + + va_end (ap); + va_end (ap2); +} + +int +main (void) +{ +#define test(n, ret, fmt, args) \ + inner args; +#include "vfprintf-1.c" +#undef test + return 0; +} + +#else + test (0, 5, "hello", (0)); + test (1, 6, "hello\n", (1)); + test (2, 1, "a", (2)); + test (3, 0, "", (3)); + test (4, 5, "%s", (4, "hello")); + test (5, 6, "%s", (5, "hello\n")); + test (6, 1, "%s", (6, "a")); + test (7, 0, "%s", (7, "")); + test (8, 1, "%c", (8, 'x')); + test (9, 7, "%s\n", (9, "hello\n")); + test (10, 2, "%d\n", (10, 0)); +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/vfprintf-chk-1.c b/gcc/testsuite/gcc.c-torture/execute/vfprintf-chk-1.c new file mode 100644 index 000000000..f8f964c7e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vfprintf-chk-1.c @@ -0,0 +1,73 @@ +#ifndef test +#include +#include +#include + +volatile int should_optimize; + +int +__attribute__((noinline)) +__vfprintf_chk (FILE *f, int flag, const char *fmt, va_list ap) +{ +#ifdef __OPTIMIZE__ + if (should_optimize) + abort (); +#endif + should_optimize = 1; + return vfprintf (f, fmt, ap); +} + +void +inner (int x, ...) +{ + va_list ap, ap2; + va_start (ap, x); + va_start (ap2, x); + + switch (x) + { +#define test(n, ret, opt, fmt, args) \ + case n: \ + should_optimize = opt; \ + __vfprintf_chk (stdout, 1, fmt, ap); \ + if (! should_optimize) \ + abort (); \ + should_optimize = 0; \ + if (__vfprintf_chk (stdout, 1, fmt, ap2) != ret) \ + abort (); \ + if (! should_optimize) \ + abort (); \ + break; +#include "vfprintf-chk-1.c" +#undef test + default: + abort (); + } + + va_end (ap); + va_end (ap2); +} + +int +main (void) +{ +#define test(n, ret, opt, fmt, args) \ + inner args; +#include "vfprintf-chk-1.c" +#undef test + return 0; +} + +#else + test (0, 5, 1, "hello", (0)); + test (1, 6, 1, "hello\n", (1)); + test (2, 1, 1, "a", (2)); + test (3, 0, 1, "", (3)); + test (4, 5, 0, "%s", (4, "hello")); + test (5, 6, 0, "%s", (5, "hello\n")); + test (6, 1, 0, "%s", (6, "a")); + test (7, 0, 0, "%s", (7, "")); + test (8, 1, 0, "%c", (8, 'x')); + test (9, 7, 0, "%s\n", (9, "hello\n")); + test (10, 2, 0, "%d\n", (10, 0)); +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/vla-dealloc-1.c b/gcc/testsuite/gcc.c-torture/execute/vla-dealloc-1.c new file mode 100644 index 000000000..9eb95c1b4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vla-dealloc-1.c @@ -0,0 +1,28 @@ +/* VLAs should be deallocated on a jump to before their definition, + including a jump to a label in an inner scope. PR 19771. */ + +#if (__SIZEOF_INT__ <= 2) +#define LIMIT 10000 +#else +#define LIMIT 1000000 +#endif + +void *volatile p; + +int +main (void) +{ + int n = 0; + if (0) + { + lab:; + } + int x[n % 1000 + 1]; + x[0] = 1; + x[n % 1000] = 2; + p = x; + n++; + if (n < LIMIT) + goto lab; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/vprintf-1.c b/gcc/testsuite/gcc.c-torture/execute/vprintf-1.c new file mode 100644 index 000000000..9f1b8bf67 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vprintf-1.c @@ -0,0 +1,53 @@ +#ifndef test +#include +#include +#include + +void +inner (int x, ...) +{ + va_list ap, ap2; + va_start (ap, x); + va_start (ap2, x); + + switch (x) + { +#define test(n, ret, fmt, args) \ + case n: \ + vprintf (fmt, ap); \ + if (vprintf (fmt, ap2) != ret) \ + abort (); \ + break; +#include "vprintf-1.c" +#undef test + default: + abort (); + } + + va_end (ap); + va_end (ap2); +} + +int +main (void) +{ +#define test(n, ret, fmt, args) \ + inner args; +#include "vprintf-1.c" +#undef test + return 0; +} + +#else + test (0, 5, "hello", (0)); + test (1, 6, "hello\n", (1)); + test (2, 1, "a", (2)); + test (3, 0, "", (3)); + test (4, 5, "%s", (4, "hello")); + test (5, 6, "%s", (5, "hello\n")); + test (6, 1, "%s", (6, "a")); + test (7, 0, "%s", (7, "")); + test (8, 1, "%c", (8, 'x')); + test (9, 7, "%s\n", (9, "hello\n")); + test (10, 2, "%d\n", (10, 0)); +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/vprintf-chk-1.c b/gcc/testsuite/gcc.c-torture/execute/vprintf-chk-1.c new file mode 100644 index 000000000..ca62f8b9f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vprintf-chk-1.c @@ -0,0 +1,73 @@ +#ifndef test +#include +#include +#include + +volatile int should_optimize; + +int +__attribute__((noinline)) +__vprintf_chk (int flag, const char *fmt, va_list ap) +{ +#ifdef __OPTIMIZE__ + if (should_optimize) + abort (); +#endif + should_optimize = 1; + return vprintf (fmt, ap); +} + +void +inner (int x, ...) +{ + va_list ap, ap2; + va_start (ap, x); + va_start (ap2, x); + + switch (x) + { +#define test(n, ret, opt, fmt, args) \ + case n: \ + should_optimize = opt; \ + __vprintf_chk (1, fmt, ap); \ + if (! should_optimize) \ + abort (); \ + should_optimize = 0; \ + if (__vprintf_chk (1, fmt, ap2) != ret) \ + abort (); \ + if (! should_optimize) \ + abort (); \ + break; +#include "vprintf-chk-1.c" +#undef test + default: + abort (); + } + + va_end (ap); + va_end (ap2); +} + +int +main (void) +{ +#define test(n, ret, opt, fmt, args) \ + inner args; +#include "vprintf-chk-1.c" +#undef test + return 0; +} + +#else + test (0, 5, 0, "hello", (0)); + test (1, 6, 1, "hello\n", (1)); + test (2, 1, 1, "a", (2)); + test (3, 0, 1, "", (3)); + test (4, 5, 0, "%s", (4, "hello")); + test (5, 6, 0, "%s", (5, "hello\n")); + test (6, 1, 0, "%s", (6, "a")); + test (7, 0, 0, "%s", (7, "")); + test (8, 1, 0, "%c", (8, 'x')); + test (9, 7, 0, "%s\n", (9, "hello\n")); + test (10, 2, 0, "%d\n", (10, 0)); +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/vrp-1.c b/gcc/testsuite/gcc.c-torture/execute/vrp-1.c new file mode 100644 index 000000000..ac42e6c37 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vrp-1.c @@ -0,0 +1,20 @@ + +extern void abort (); +extern void exit (int); + +int f (int a) { + if (a != 2) { + a = -a; + if (a == 2) + return 0; + return 1; + } + return 1; +} + +int main (int argc, char *argv[]) { + if (f (-2)) + abort (); + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/vrp-2.c b/gcc/testsuite/gcc.c-torture/execute/vrp-2.c new file mode 100644 index 000000000..69ed3e702 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vrp-2.c @@ -0,0 +1,19 @@ +extern void abort (); +extern void exit (int); + +int f (int a) { + if (a != 2) { + a = a > 0 ? a : -a; + if (a == 2) + return 0; + return 1; + } + return 1; +} + +int main (int argc, char *argv[]) { + if (f (-2)) + abort (); + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/vrp-3.c b/gcc/testsuite/gcc.c-torture/execute/vrp-3.c new file mode 100644 index 000000000..bc0e490dc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vrp-3.c @@ -0,0 +1,21 @@ +extern void abort (); +extern void exit (int); + +int f (int a) { + if (a < 12) { + if (a > -15) { + a = a > 0 ? a : -a; + if (a == 2) + return 0; + return 1; + } + } + return 1; +} + +int main (int argc, char *argv[]) { + if (f (-2)) + abort (); + exit (0); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/vrp-4.c b/gcc/testsuite/gcc.c-torture/execute/vrp-4.c new file mode 100644 index 000000000..23f29220c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vrp-4.c @@ -0,0 +1,20 @@ +extern void exit (int); +extern void abort (); + +void test(int x, int y) +{ + int c; + + if (x == 1) abort(); + if (y == 1) abort(); + + c = x / y; + + if (c != 1) abort(); +} + +int main() +{ + test(2, 2); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/vrp-5.c b/gcc/testsuite/gcc.c-torture/execute/vrp-5.c new file mode 100644 index 000000000..8f3c7255a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vrp-5.c @@ -0,0 +1,22 @@ +extern void exit (int); +extern void abort (); + +void test(unsigned int a, unsigned int b) +{ + if (a < 5) + abort(); + if (b < 5) + abort(); + if (a + b != 0U) + abort(); +} + +int main(int argc, char *argv[]) +{ + unsigned int x = 0x80000000; + test(x, x); + exit (0); +} + + + diff --git a/gcc/testsuite/gcc.c-torture/execute/vrp-5.x b/gcc/testsuite/gcc.c-torture/execute/vrp-5.x new file mode 100644 index 000000000..121fcfecc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vrp-5.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_int16] } { + return 1 +} + +return 0; diff --git a/gcc/testsuite/gcc.c-torture/execute/vrp-6.c b/gcc/testsuite/gcc.c-torture/execute/vrp-6.c new file mode 100644 index 000000000..7c6a1750f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vrp-6.c @@ -0,0 +1,33 @@ +#include + +extern void exit (int); +extern void abort (); + +void test01(unsigned int a, unsigned int b) +{ + if (a < 5) + abort(); + if (b < 5) + abort(); + if (a - b != 5) + abort(); +} + +void test02(unsigned int a, unsigned int b) +{ + if (a >= 12) + if (b > 15) + if (a - b < UINT_MAX - 15U) + abort (); +} + +int main(int argc, char *argv[]) +{ + unsigned x = 0x80000000; + test01(x + 5, x); + test02(14, 16); + exit (0); +} + + + diff --git a/gcc/testsuite/gcc.c-torture/execute/vrp-6.x b/gcc/testsuite/gcc.c-torture/execute/vrp-6.x new file mode 100644 index 000000000..121fcfecc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vrp-6.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_int16] } { + return 1 +} + +return 0; diff --git a/gcc/testsuite/gcc.c-torture/execute/vrp-7.c b/gcc/testsuite/gcc.c-torture/execute/vrp-7.c new file mode 100644 index 000000000..b4c9e62d4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vrp-7.c @@ -0,0 +1,20 @@ + +void abort (void); + +struct T +{ + int b : 1; +} t; + +void __attribute__((noinline)) foo (int f) +{ + t.b = (f & 0x10) ? 1 : 0; +} + +int main (void) +{ + foo (0x10); + if (!t.b) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/wchar_t-1.c b/gcc/testsuite/gcc.c-torture/execute/wchar_t-1.c new file mode 100644 index 000000000..7e90cc08f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/wchar_t-1.c @@ -0,0 +1,17 @@ +/* { dg-options "-finput-charset=utf-8" } */ +typedef __WCHAR_TYPE__ wchar_t; +wchar_t x[] = L"Ä"; +wchar_t y = L'Ä'; +extern void abort (void); +extern void exit (int); + +int main (void) +{ + if (sizeof (x) / sizeof (wchar_t) != 2) + abort (); + if (x[0] != L'Ä' || x[1] != L'\0') + abort (); + if (y != L'Ä') + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/widechar-1.c b/gcc/testsuite/gcc.c-torture/execute/widechar-1.c new file mode 100644 index 000000000..45b9d89b4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/widechar-1.c @@ -0,0 +1,14 @@ +#define C L'\400' + +#if C +#define zero (!C) +#else +#define zero C +#endif + +main() +{ + if (zero != 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/widechar-2.c b/gcc/testsuite/gcc.c-torture/execute/widechar-2.c new file mode 100644 index 000000000..9e6a73bcd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/widechar-2.c @@ -0,0 +1,11 @@ +#include + +const wchar_t ws[] = L"foo"; + +int +main (void) +{ + if (ws[0] != L'f' || ws[1] != L'o' || ws[2] != L'o' || ws[3] != L'\0') + abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/zero-struct-1.c b/gcc/testsuite/gcc.c-torture/execute/zero-struct-1.c new file mode 100644 index 000000000..d673adf5c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/zero-struct-1.c @@ -0,0 +1,23 @@ +struct g{}; +char y[3]; +char *f = &y[0]; +char *ff = &y[0]; +void h(void) +{ + struct g t; + *((struct g*)(f++)) = *((struct g*)(ff++)); + *((struct g*)(f++)) = (struct g){}; + t = *((struct g*)(ff++)); +} + +void abort (void); + +int main(void) +{ + h(); + if (f != &y[2]) + abort(); + if (ff != &y[2]) + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/zero-struct-2.c b/gcc/testsuite/gcc.c-torture/execute/zero-struct-2.c new file mode 100644 index 000000000..ed1d5a027 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/zero-struct-2.c @@ -0,0 +1,20 @@ +void abort (void); +int ii; +typedef struct {} raw_spinlock_t; +typedef struct { + raw_spinlock_t raw_lock; +} spinlock_t; +raw_spinlock_t one_raw_spinlock (void) +{ + raw_spinlock_t raw_lock; + ii++; + return raw_lock; +} +int main(void) +{ + spinlock_t lock = (spinlock_t) { .raw_lock = one_raw_spinlock() }; + if (ii != 1) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/zerolen-1.c b/gcc/testsuite/gcc.c-torture/execute/zerolen-1.c new file mode 100644 index 000000000..632ad4bc0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/zerolen-1.c @@ -0,0 +1,32 @@ +extern void abort (void); +extern void exit (int); + +union iso_directory_record { + char carr[4]; + struct { + unsigned char name_len [1]; + char name [0]; + } u; +} entry; + +void set(union iso_directory_record *); + +int main (void) +{ + union iso_directory_record *de; + + de = &entry; + set(de); + + if (de->u.name_len[0] == 1 && de->u.name[0] == 0) + exit (0); + else + abort (); +} + +void set (union iso_directory_record *p) +{ + p->carr[0] = 1; + p->carr[1] = 0; + return; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/zerolen-2.c b/gcc/testsuite/gcc.c-torture/execute/zerolen-2.c new file mode 100644 index 000000000..446e58283 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/zerolen-2.c @@ -0,0 +1,18 @@ +extern void abort(void); + +typedef int word __attribute__((mode(word))); + +struct foo +{ + word x; + word y[0]; +}; + +int main() +{ + if (sizeof(word) != sizeof(struct foo)) + abort(); + if (__alignof__(word) != __alignof__(struct foo)) + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/386.c b/gcc/testsuite/gcc.c-torture/unsorted/386.c new file mode 100644 index 000000000..432cdaddd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/386.c @@ -0,0 +1,23 @@ +foo (a, p) + int *p; +{ + p[0] = a; + a = (short) a; + return a; +} + +main () +{ + int i; + foobar (i, &i); +} + + +foobar (a, b) +{ + int c; + + c = a % b; + a = a / b; + return a + b; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/86.c b/gcc/testsuite/gcc.c-torture/unsorted/86.c new file mode 100644 index 000000000..deea85ee2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/86.c @@ -0,0 +1,19 @@ +m32 (a) + int *a; +{ + a[1] = a[0]; +} + +m16 (a) + short *a; +{ + a[1] = a[0]; +} + + +m8 (a) + char *a; +{ + a[1] = a[0]; +} + diff --git a/gcc/testsuite/gcc.c-torture/unsorted/BUG1.c b/gcc/testsuite/gcc.c-torture/unsorted/BUG1.c new file mode 100644 index 000000000..ada8eaf49 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/BUG1.c @@ -0,0 +1,37 @@ +struct _XtTextSource { + /* ... */ + void (* SetSelection)(); + /* ... */ + }; + +typedef struct _XtTextSource *XtTextSource; + +typedef struct _TextPart { + XtTextSource source; + /* ... */ +} TextPart; + +typedef struct _TextRec { + /* ... */ + TextPart text; +} TextRec; + +typedef struct _TextRec *TextWidget; + + +void XtTextUnsetSelection(w) + TextWidget w; /* original is: Widget w; */ +{ + register TextWidget ctx = (TextWidget) w; + void (*nullProc)() = 0; + +/* + * the following line causes the error, when optimizing: + */ + + if (ctx->text.source->SetSelection != nullProc) { + + foo(); + + } +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/BUG11.c b/gcc/testsuite/gcc.c-torture/unsorted/BUG11.c new file mode 100644 index 000000000..fe2923a97 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/BUG11.c @@ -0,0 +1,29 @@ +#define DD 2410065408 + +unsigned +foo (d) + double d; +{ + return d; +} + +#if foobar + +main () +{ +#if bar + unsigned u = DD; + double d = (double) u; +#else + double d = (double) DD; +#endif + printf ("%u = %u = %lf\n", foo ((double) DD), foo (d), d); +} +#else + +main () +{ + printf ("%lf\n", (double) ((unsigned) DD)); + foo ((double) DD); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/unsorted/BUG12.c b/gcc/testsuite/gcc.c-torture/unsorted/BUG12.c new file mode 100644 index 000000000..b32fa6071 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/BUG12.c @@ -0,0 +1,5 @@ +long long +main () +{ + return 1.1e10; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/BUG13.c b/gcc/testsuite/gcc.c-torture/unsorted/BUG13.c new file mode 100644 index 000000000..9a302b951 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/BUG13.c @@ -0,0 +1,19 @@ +struct tree_common +{ + int uid; + unsigned int code : 8; + unsigned int code2 : 8; + unsigned external_attr : 1; + unsigned public_attr : 1; + +}; + +static int +duplicate_decls (x) + register struct tree_common *x; +{ + if (x->external_attr) + if (x->code) + if (x->code2) + x->public_attr = 1; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/BUG16.c b/gcc/testsuite/gcc.c-torture/unsorted/BUG16.c new file mode 100644 index 000000000..daeae2ca5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/BUG16.c @@ -0,0 +1,6 @@ +setgetlen (a) + int *a; +{ + while (*a++ & 0x80000000) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/BUG17.c b/gcc/testsuite/gcc.c-torture/unsorted/BUG17.c new file mode 100644 index 000000000..920587046 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/BUG17.c @@ -0,0 +1,8 @@ +double d; + +main() +{ + int i; + + i = (int) d; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/BUG18.c b/gcc/testsuite/gcc.c-torture/unsorted/BUG18.c new file mode 100644 index 000000000..ed586a7f9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/BUG18.c @@ -0,0 +1,5 @@ +main() +{ + if ((signed int) 1 < (signed int) -2147483648) + printf("true\n"); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/BUG2.c b/gcc/testsuite/gcc.c-torture/unsorted/BUG2.c new file mode 100644 index 000000000..6dc30be65 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/BUG2.c @@ -0,0 +1,8 @@ +BUG2 (p) int *p; +{ + int a = 0; + if (*p == a) + return 0; + else + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/BUG21.c b/gcc/testsuite/gcc.c-torture/unsorted/BUG21.c new file mode 100644 index 000000000..c8a1157cc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/BUG21.c @@ -0,0 +1,22 @@ +typedef struct { + int knock_on_wood; /* leave it out and it works. */ + int f1; +} FOO; + +typedef struct { + FOO *b1; +} BAR; + +Nase () +{ + int i, j; + FOO *foop; + BAR *barp; + + for (i = 0; i < 2; i++) { + foop = &barp->b1[i]; + for (j = 0; j < foop->f1; j++) { + /* dummy() */; /* put it in and it works. */ + } + } +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/BUG22.c b/gcc/testsuite/gcc.c-torture/unsorted/BUG22.c new file mode 100644 index 000000000..9fd95254d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/BUG22.c @@ -0,0 +1,6 @@ + +void +Rotate (float angle) +{ + float mag = (angle < 0) ? -angle : angle; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/BUG23.c b/gcc/testsuite/gcc.c-torture/unsorted/BUG23.c new file mode 100644 index 000000000..1ff429ef0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/BUG23.c @@ -0,0 +1,18 @@ +main() +{ + static char static_char_array[1]; + static char *static_char_pointer; + static char static_char; + char char_array[1]; + char *char_pointer; + char character; + + char *cp, c; + + c = cp - static_char_array; /* error */ + c = cp - static_char_pointer; + c = cp - &static_char; /* error */ + c = cp - char_array; + c = cp - char_pointer; + c = cp - &character; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/BUG24.c b/gcc/testsuite/gcc.c-torture/unsorted/BUG24.c new file mode 100644 index 000000000..7627a3ddc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/BUG24.c @@ -0,0 +1,15 @@ +struct ack { + char a, b, c; +}; + +main() +{ + struct ack bad; + + foo(bad); +} + +foo(c) + struct ack c; +{ +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/BUG25.c b/gcc/testsuite/gcc.c-torture/unsorted/BUG25.c new file mode 100644 index 000000000..574417061 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/BUG25.c @@ -0,0 +1,5 @@ + +foo (a) +{ + __builtin_ffs (a); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/BUG3.c b/gcc/testsuite/gcc.c-torture/unsorted/BUG3.c new file mode 100644 index 000000000..30e6622a5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/BUG3.c @@ -0,0 +1,8 @@ +BUG2 (p) char *p; +{ + int a = 0; + if (*p == a) + return 0; + else + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/BUG4.c b/gcc/testsuite/gcc.c-torture/unsorted/BUG4.c new file mode 100644 index 000000000..be6a14989 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/BUG4.c @@ -0,0 +1,20 @@ +int foo() +{ + char c; + + return (c ^ 30 ) > (c ^ 40 ); +/* + these also get the signal : + return (c ^ 30 ) == (c ^ 40 ); + return ((int)c ^ 30 ) > (c ^ 40 ); + also fails if c is "extern char" + + these are ok : + return (c + 30 ) > (c ^ 40 ); + return (c ^ 30 ) > (c + 40 ); + return (c ^ 30 ) + (c ^ 40 ); + return ('a' ^ 30 ) > (c ^ 40 ); + return (c ^ 40 ); + return (c ^ 30 ) > (c ^ 40 ); +*/ +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/BUG5.c b/gcc/testsuite/gcc.c-torture/unsorted/BUG5.c new file mode 100644 index 000000000..9bed7136f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/BUG5.c @@ -0,0 +1,18 @@ +enum bar +{ + one, + two +}; + +enum bar foo; + +void bar() +{ + switch (foo) + { + case one: + case two: + printf ("one to two\n"); + break; + } +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/BUG6.c b/gcc/testsuite/gcc.c-torture/unsorted/BUG6.c new file mode 100644 index 000000000..b13946509 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/BUG6.c @@ -0,0 +1,8 @@ +main() +{ + unsigned long L; + double D; + D = L = -3; + printf("L=%lu, D=%g\n", L, D); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/DFcmp.c b/gcc/testsuite/gcc.c-torture/unsorted/DFcmp.c new file mode 100644 index 000000000..b32b0ecc6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/DFcmp.c @@ -0,0 +1,280 @@ +#define type double + +type glob0, glob1; + +#define E0 ((type *)10000000) +#define reg0 r0 +#define indreg0 (*p0) +#define imm0 22 +#define limm0 ((type)((int)&glob0)) +#define adr0 (*E0) +#define adrreg0 (p0[10000000]) +#define adrx0 (E0[x0]) +#define regx0 (p0[x0]) + +#define E1 ((type *)11111111) +#define reg1 r1 +#define indreg1 (*p1) +#define imm1 33 +#define limm1 ((type)((int)&glob1)) +#define adr1 (*E1) +#define adrreg1 (p1[1111111/4]) +#define adrx1 (E1[x1]) +#define regx1 (p1[x1]) + +reg0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= reg1) return 1; else return 0;} + +reg0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= indreg1) return 1; else return 0;} + +reg0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= imm1) return 1; else return 0;} + +reg0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= limm1) return 1; else return 0;} + +reg0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= adr1) return 1; else return 0;} + +reg0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= adrreg1) return 1; else return 0;} + +reg0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= adrx1) return 1; else return 0;} + +reg0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= regx1) return 1; else return 0;} + +indreg0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= reg1) return 1; else return 0;} + +indreg0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= indreg1) return 1; else return 0;} + +indreg0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= imm1) return 1; else return 0;} + +indreg0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= limm1) return 1; else return 0;} + +indreg0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= adr1) return 1; else return 0;} + +indreg0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= adrreg1) return 1; else return 0;} + +indreg0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= adrx1) return 1; else return 0;} + +indreg0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= regx1) return 1; else return 0;} + +imm0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= reg1) return 1; else return 0;} + +imm0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= indreg1) return 1; else return 0;} + +imm0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= imm1) return 1; else return 0;} + +imm0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= limm1) return 1; else return 0;} + +imm0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= adr1) return 1; else return 0;} + +imm0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= adrreg1) return 1; else return 0;} + +imm0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= adrx1) return 1; else return 0;} + +imm0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= regx1) return 1; else return 0;} + +limm0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= reg1) return 1; else return 0;} + +limm0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= indreg1) return 1; else return 0;} + +limm0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= imm1) return 1; else return 0;} + +limm0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= limm1) return 1; else return 0;} + +limm0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= adr1) return 1; else return 0;} + +limm0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= adrreg1) return 1; else return 0;} + +limm0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= adrx1) return 1; else return 0;} + +limm0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= regx1) return 1; else return 0;} + +adr0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= reg1) return 1; else return 0;} + +adr0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= indreg1) return 1; else return 0;} + +adr0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= imm1) return 1; else return 0;} + +adr0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= limm1) return 1; else return 0;} + +adr0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= adr1) return 1; else return 0;} + +adr0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= adrreg1) return 1; else return 0;} + +adr0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= adrx1) return 1; else return 0;} + +adr0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= regx1) return 1; else return 0;} + +adrreg0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= reg1) return 1; else return 0;} + +adrreg0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= indreg1) return 1; else return 0;} + +adrreg0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= imm1) return 1; else return 0;} + +adrreg0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= limm1) return 1; else return 0;} + +adrreg0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= adr1) return 1; else return 0;} + +adrreg0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= adrreg1) return 1; else return 0;} + +adrreg0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= adrx1) return 1; else return 0;} + +adrreg0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= regx1) return 1; else return 0;} + +adrx0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= reg1) return 1; else return 0;} + +adrx0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= indreg1) return 1; else return 0;} + +adrx0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= imm1) return 1; else return 0;} + +adrx0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= limm1) return 1; else return 0;} + +adrx0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= adr1) return 1; else return 0;} + +adrx0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= adrreg1) return 1; else return 0;} + +adrx0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= adrx1) return 1; else return 0;} + +adrx0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= regx1) return 1; else return 0;} + +regx0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= reg1) return 1; else return 0;} + +regx0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= indreg1) return 1; else return 0;} + +regx0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= imm1) return 1; else return 0;} + +regx0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= limm1) return 1; else return 0;} + +regx0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= adr1) return 1; else return 0;} + +regx0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= adrreg1) return 1; else return 0;} + +regx0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= adrx1) return 1; else return 0;} + +regx0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= regx1) return 1; else return 0;} + diff --git a/gcc/testsuite/gcc.c-torture/unsorted/HIcmp.c b/gcc/testsuite/gcc.c-torture/unsorted/HIcmp.c new file mode 100644 index 000000000..eea39841b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/HIcmp.c @@ -0,0 +1,280 @@ +#define type short + +type glob0, glob1; + +#define E0 ((type *)10000000) +#define reg0 r0 +#define indreg0 (*p0) +#define imm0 22 +#define limm0 ((type)&glob0) +#define adr0 (*E0) +#define adrreg0 (p0[10000000]) +#define adrx0 (E0[x0]) +#define regx0 (p0[x0]) + +#define E1 ((type *)11111111) +#define reg1 r1 +#define indreg1 (*p1) +#define imm1 33 +#define limm1 ((type)&glob1) +#define adr1 (*E1) +#define adrreg1 (p1[1111111/4]) +#define adrx1 (E1[x1]) +#define regx1 (p1[x1]) + +reg0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= reg1) return 1; else return 0;} + +reg0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= indreg1) return 1; else return 0;} + +reg0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= imm1) return 1; else return 0;} + +reg0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= limm1) return 1; else return 0;} + +reg0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= adr1) return 1; else return 0;} + +reg0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= adrreg1) return 1; else return 0;} + +reg0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= adrx1) return 1; else return 0;} + +reg0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= regx1) return 1; else return 0;} + +indreg0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= reg1) return 1; else return 0;} + +indreg0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= indreg1) return 1; else return 0;} + +indreg0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= imm1) return 1; else return 0;} + +indreg0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= limm1) return 1; else return 0;} + +indreg0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= adr1) return 1; else return 0;} + +indreg0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= adrreg1) return 1; else return 0;} + +indreg0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= adrx1) return 1; else return 0;} + +indreg0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= regx1) return 1; else return 0;} + +imm0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= reg1) return 1; else return 0;} + +imm0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= indreg1) return 1; else return 0;} + +imm0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= imm1) return 1; else return 0;} + +imm0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= limm1) return 1; else return 0;} + +imm0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= adr1) return 1; else return 0;} + +imm0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= adrreg1) return 1; else return 0;} + +imm0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= adrx1) return 1; else return 0;} + +imm0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= regx1) return 1; else return 0;} + +limm0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= reg1) return 1; else return 0;} + +limm0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= indreg1) return 1; else return 0;} + +limm0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= imm1) return 1; else return 0;} + +limm0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= limm1) return 1; else return 0;} + +limm0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= adr1) return 1; else return 0;} + +limm0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= adrreg1) return 1; else return 0;} + +limm0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= adrx1) return 1; else return 0;} + +limm0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= regx1) return 1; else return 0;} + +adr0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= reg1) return 1; else return 0;} + +adr0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= indreg1) return 1; else return 0;} + +adr0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= imm1) return 1; else return 0;} + +adr0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= limm1) return 1; else return 0;} + +adr0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= adr1) return 1; else return 0;} + +adr0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= adrreg1) return 1; else return 0;} + +adr0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= adrx1) return 1; else return 0;} + +adr0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= regx1) return 1; else return 0;} + +adrreg0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= reg1) return 1; else return 0;} + +adrreg0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= indreg1) return 1; else return 0;} + +adrreg0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= imm1) return 1; else return 0;} + +adrreg0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= limm1) return 1; else return 0;} + +adrreg0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= adr1) return 1; else return 0;} + +adrreg0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= adrreg1) return 1; else return 0;} + +adrreg0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= adrx1) return 1; else return 0;} + +adrreg0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= regx1) return 1; else return 0;} + +adrx0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= reg1) return 1; else return 0;} + +adrx0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= indreg1) return 1; else return 0;} + +adrx0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= imm1) return 1; else return 0;} + +adrx0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= limm1) return 1; else return 0;} + +adrx0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= adr1) return 1; else return 0;} + +adrx0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= adrreg1) return 1; else return 0;} + +adrx0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= adrx1) return 1; else return 0;} + +adrx0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= regx1) return 1; else return 0;} + +regx0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= reg1) return 1; else return 0;} + +regx0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= indreg1) return 1; else return 0;} + +regx0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= imm1) return 1; else return 0;} + +regx0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= limm1) return 1; else return 0;} + +regx0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= adr1) return 1; else return 0;} + +regx0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= adrreg1) return 1; else return 0;} + +regx0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= adrx1) return 1; else return 0;} + +regx0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= regx1) return 1; else return 0;} + diff --git a/gcc/testsuite/gcc.c-torture/unsorted/HIset.c b/gcc/testsuite/gcc.c-torture/unsorted/HIset.c new file mode 100644 index 000000000..8108fbb27 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/HIset.c @@ -0,0 +1,216 @@ +#define E0 ((type *)10000000) +#define reg0 r0 +#define indreg0 (*p0) +#define imm0 22 +#define limm0 ((type)(int)&glob0) +#define adr0 (*E0) +#define adrreg0 (p0[10000000]) +#define adrx0 (E0[x0]) +#define regx0 (p0[x0]) + +#define E1 ((type *)11111111) +#define reg1 r1 +#define indreg1 (*p1) +#define imm1 33 +#define limm1 ((type)(int)&glob1) +#define adr1 (*E1) +#define adrreg1 (p1[1111111/4]) +#define adrx1 (E1[x1]) +#define regx1 (p1[x1]) + +int glob0, glob1; + +#define type short + +reg0reg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = reg1; } + +reg0indreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = indreg1; } + +reg0imm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = imm1; } + +reg0limm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = limm1; } + +reg0adr1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = adr1; } + +reg0adrreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = adrreg1; } + +reg0adrx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = adrx1; } + +reg0regx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = regx1; } + +indreg0reg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = reg1; } + +indreg0indreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = indreg1; } + +indreg0imm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = imm1; } + +indreg0limm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = limm1; } + +indreg0adr1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = adr1; } + +indreg0adrreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = adrreg1; } + +indreg0adrx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = adrx1; } + +indreg0regx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = regx1; } + +adr0reg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = reg1; } + +adr0indreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = indreg1; } + +adr0imm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = imm1; } + +adr0limm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = limm1; } + +adr0adr1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = adr1; } + +adr0adrreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = adrreg1; } + +adr0adrx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = adrx1; } + +adr0regx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = regx1; } + +adrreg0reg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = reg1; } + +adrreg0indreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = indreg1; } + +adrreg0imm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = imm1; } + +adrreg0limm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = limm1; } + +adrreg0adr1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = adr1; } + +adrreg0adrreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = adrreg1; } + +adrreg0adrx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = adrx1; } + +adrreg0regx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = regx1; } + +adrx0reg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = reg1; } + +adrx0indreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = indreg1; } + +adrx0imm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = imm1; } + +adrx0limm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = limm1; } + +adrx0adr1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = adr1; } + +adrx0adrreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = adrreg1; } + +adrx0adrx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = adrx1; } + +adrx0regx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = regx1; } + +regx0reg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = reg1; } + +regx0indreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = indreg1; } + +regx0imm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = imm1; } + +regx0limm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = limm1; } + +regx0adr1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = adr1; } + +regx0adrreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = adrreg1; } + +regx0adrx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = adrx1; } + +regx0regx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = regx1; } + diff --git a/gcc/testsuite/gcc.c-torture/unsorted/PYRBUG.c b/gcc/testsuite/gcc.c-torture/unsorted/PYRBUG.c new file mode 100644 index 000000000..c64c3f5e1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/PYRBUG.c @@ -0,0 +1,17 @@ +typedef struct +{ + int v; + int h; +} Point; + +typedef struct +{ + int top, left, bottom, right; +} Rect; + +int +x_PtInRect (Point pt, Rect *r) +{ + return pt.v >= r->top && pt.v < r->bottom + && pt.h >= r->left && pt.h < r->right; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/QIcmp.c b/gcc/testsuite/gcc.c-torture/unsorted/QIcmp.c new file mode 100644 index 000000000..c5161646f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/QIcmp.c @@ -0,0 +1,280 @@ +#define type signed char + +type glob0, glob1; + +#define E0 ((type *)10000000) +#define reg0 r0 +#define indreg0 (*p0) +#define imm0 22 +#define limm0 ((type)&glob0) +#define adr0 (*E0) +#define adrreg0 (p0[10000000]) +#define adrx0 (E0[x0]) +#define regx0 (p0[x0]) + +#define E1 ((type *)11111111) +#define reg1 r1 +#define indreg1 (*p1) +#define imm1 33 +#define limm1 ((type)&glob1) +#define adr1 (*E1) +#define adrreg1 (p1[1111111/4]) +#define adrx1 (E1[x1]) +#define regx1 (p1[x1]) + +reg0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= reg1) return 1; else return 0;} + +reg0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= indreg1) return 1; else return 0;} + +reg0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= imm1) return 1; else return 0;} + +reg0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= limm1) return 1; else return 0;} + +reg0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= adr1) return 1; else return 0;} + +reg0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= adrreg1) return 1; else return 0;} + +reg0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= adrx1) return 1; else return 0;} + +reg0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= regx1) return 1; else return 0;} + +indreg0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= reg1) return 1; else return 0;} + +indreg0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= indreg1) return 1; else return 0;} + +indreg0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= imm1) return 1; else return 0;} + +indreg0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= limm1) return 1; else return 0;} + +indreg0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= adr1) return 1; else return 0;} + +indreg0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= adrreg1) return 1; else return 0;} + +indreg0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= adrx1) return 1; else return 0;} + +indreg0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= regx1) return 1; else return 0;} + +imm0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= reg1) return 1; else return 0;} + +imm0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= indreg1) return 1; else return 0;} + +imm0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= imm1) return 1; else return 0;} + +imm0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= limm1) return 1; else return 0;} + +imm0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= adr1) return 1; else return 0;} + +imm0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= adrreg1) return 1; else return 0;} + +imm0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= adrx1) return 1; else return 0;} + +imm0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= regx1) return 1; else return 0;} + +limm0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= reg1) return 1; else return 0;} + +limm0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= indreg1) return 1; else return 0;} + +limm0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= imm1) return 1; else return 0;} + +limm0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= limm1) return 1; else return 0;} + +limm0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= adr1) return 1; else return 0;} + +limm0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= adrreg1) return 1; else return 0;} + +limm0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= adrx1) return 1; else return 0;} + +limm0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= regx1) return 1; else return 0;} + +adr0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= reg1) return 1; else return 0;} + +adr0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= indreg1) return 1; else return 0;} + +adr0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= imm1) return 1; else return 0;} + +adr0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= limm1) return 1; else return 0;} + +adr0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= adr1) return 1; else return 0;} + +adr0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= adrreg1) return 1; else return 0;} + +adr0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= adrx1) return 1; else return 0;} + +adr0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= regx1) return 1; else return 0;} + +adrreg0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= reg1) return 1; else return 0;} + +adrreg0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= indreg1) return 1; else return 0;} + +adrreg0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= imm1) return 1; else return 0;} + +adrreg0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= limm1) return 1; else return 0;} + +adrreg0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= adr1) return 1; else return 0;} + +adrreg0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= adrreg1) return 1; else return 0;} + +adrreg0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= adrx1) return 1; else return 0;} + +adrreg0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= regx1) return 1; else return 0;} + +adrx0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= reg1) return 1; else return 0;} + +adrx0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= indreg1) return 1; else return 0;} + +adrx0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= imm1) return 1; else return 0;} + +adrx0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= limm1) return 1; else return 0;} + +adrx0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= adr1) return 1; else return 0;} + +adrx0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= adrreg1) return 1; else return 0;} + +adrx0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= adrx1) return 1; else return 0;} + +adrx0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= regx1) return 1; else return 0;} + +regx0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= reg1) return 1; else return 0;} + +regx0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= indreg1) return 1; else return 0;} + +regx0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= imm1) return 1; else return 0;} + +regx0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= limm1) return 1; else return 0;} + +regx0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= adr1) return 1; else return 0;} + +regx0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= adrreg1) return 1; else return 0;} + +regx0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= adrx1) return 1; else return 0;} + +regx0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= regx1) return 1; else return 0;} + diff --git a/gcc/testsuite/gcc.c-torture/unsorted/QIset.c b/gcc/testsuite/gcc.c-torture/unsorted/QIset.c new file mode 100644 index 000000000..212609dc8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/QIset.c @@ -0,0 +1,216 @@ +#define E0 ((type *)10000000) +#define reg0 r0 +#define indreg0 (*p0) +#define imm0 22 +#define limm0 ((type)(int)&glob0) +#define adr0 (*E0) +#define adrreg0 (p0[10000000]) +#define adrx0 (E0[x0]) +#define regx0 (p0[x0]) + +#define E1 ((type *)11111111) +#define reg1 r1 +#define indreg1 (*p1) +#define imm1 33 +#define limm1 ((type)(int)&glob1) +#define adr1 (*E1) +#define adrreg1 (p1[1111111/4]) +#define adrx1 (E1[x1]) +#define regx1 (p1[x1]) + +int glob0, glob1; + +#define type char + +reg0reg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = reg1; } + +reg0indreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = indreg1; } + +reg0imm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = imm1; } + +reg0limm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = limm1; } + +reg0adr1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = adr1; } + +reg0adrreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = adrreg1; } + +reg0adrx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = adrx1; } + +reg0regx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = regx1; } + +indreg0reg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = reg1; } + +indreg0indreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = indreg1; } + +indreg0imm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = imm1; } + +indreg0limm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = limm1; } + +indreg0adr1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = adr1; } + +indreg0adrreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = adrreg1; } + +indreg0adrx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = adrx1; } + +indreg0regx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = regx1; } + +adr0reg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = reg1; } + +adr0indreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = indreg1; } + +adr0imm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = imm1; } + +adr0limm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = limm1; } + +adr0adr1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = adr1; } + +adr0adrreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = adrreg1; } + +adr0adrx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = adrx1; } + +adr0regx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = regx1; } + +adrreg0reg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = reg1; } + +adrreg0indreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = indreg1; } + +adrreg0imm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = imm1; } + +adrreg0limm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = limm1; } + +adrreg0adr1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = adr1; } + +adrreg0adrreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = adrreg1; } + +adrreg0adrx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = adrx1; } + +adrreg0regx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = regx1; } + +adrx0reg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = reg1; } + +adrx0indreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = indreg1; } + +adrx0imm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = imm1; } + +adrx0limm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = limm1; } + +adrx0adr1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = adr1; } + +adrx0adrreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = adrreg1; } + +adrx0adrx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = adrx1; } + +adrx0regx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = regx1; } + +regx0reg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = reg1; } + +regx0indreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = indreg1; } + +regx0imm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = imm1; } + +regx0limm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = limm1; } + +regx0adr1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = adr1; } + +regx0adrreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = adrreg1; } + +regx0adrx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = adrx1; } + +regx0regx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = regx1; } + diff --git a/gcc/testsuite/gcc.c-torture/unsorted/SFset.c b/gcc/testsuite/gcc.c-torture/unsorted/SFset.c new file mode 100644 index 000000000..ad3e41b83 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/SFset.c @@ -0,0 +1,216 @@ +#define E0 ((type *)10000000) +#define reg0 r0 +#define indreg0 (*p0) +#define imm0 22 +#define limm0 ((type)(int)&glob0) +#define adr0 (*E0) +#define adrreg0 (p0[10000000]) +#define adrx0 (E0[x0]) +#define regx0 (p0[x0]) + +#define E1 ((type *)11111111) +#define reg1 r1 +#define indreg1 (*p1) +#define imm1 33 +#define limm1 ((type)(int)&glob1) +#define adr1 (*E1) +#define adrreg1 (p1[1111111/4]) +#define adrx1 (E1[x1]) +#define regx1 (p1[x1]) + +int glob0, glob1; + +#define type float + +reg0reg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = reg1; } + +reg0indreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = indreg1; } + +reg0imm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = imm1; } + +reg0limm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = limm1; } + +reg0adr1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = adr1; } + +reg0adrreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = adrreg1; } + +reg0adrx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = adrx1; } + +reg0regx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = regx1; } + +indreg0reg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = reg1; } + +indreg0indreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = indreg1; } + +indreg0imm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = imm1; } + +indreg0limm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = limm1; } + +indreg0adr1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = adr1; } + +indreg0adrreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = adrreg1; } + +indreg0adrx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = adrx1; } + +indreg0regx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = regx1; } + +adr0reg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = reg1; } + +adr0indreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = indreg1; } + +adr0imm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = imm1; } + +adr0limm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = limm1; } + +adr0adr1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = adr1; } + +adr0adrreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = adrreg1; } + +adr0adrx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = adrx1; } + +adr0regx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = regx1; } + +adrreg0reg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = reg1; } + +adrreg0indreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = indreg1; } + +adrreg0imm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = imm1; } + +adrreg0limm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = limm1; } + +adrreg0adr1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = adr1; } + +adrreg0adrreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = adrreg1; } + +adrreg0adrx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = adrx1; } + +adrreg0regx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = regx1; } + +adrx0reg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = reg1; } + +adrx0indreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = indreg1; } + +adrx0imm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = imm1; } + +adrx0limm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = limm1; } + +adrx0adr1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = adr1; } + +adrx0adrreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = adrreg1; } + +adrx0adrx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = adrx1; } + +adrx0regx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = regx1; } + +regx0reg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = reg1; } + +regx0indreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = indreg1; } + +regx0imm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = imm1; } + +regx0limm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = limm1; } + +regx0adr1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = adr1; } + +regx0adrreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = adrreg1; } + +regx0adrx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = adrx1; } + +regx0regx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = regx1; } + diff --git a/gcc/testsuite/gcc.c-torture/unsorted/SIcmp.c b/gcc/testsuite/gcc.c-torture/unsorted/SIcmp.c new file mode 100644 index 000000000..30e073924 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/SIcmp.c @@ -0,0 +1,280 @@ +#define type int + +type glob0, glob1; + +#define E0 ((type *)10000000) +#define reg0 r0 +#define indreg0 (*p0) +#define imm0 22 +#define limm0 ((type)&glob0) +#define adr0 (*E0) +#define adrreg0 (p0[10000000]) +#define adrx0 (E0[x0]) +#define regx0 (p0[x0]) + +#define E1 ((type *)11111111) +#define reg1 r1 +#define indreg1 (*p1) +#define imm1 33 +#define limm1 ((type)&glob1) +#define adr1 (*E1) +#define adrreg1 (p1[1111111/4]) +#define adrx1 (E1[x1]) +#define regx1 (p1[x1]) + +reg0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= reg1) return 1; else return 0;} + +reg0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= indreg1) return 1; else return 0;} + +reg0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= imm1) return 1; else return 0;} + +reg0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= limm1) return 1; else return 0;} + +reg0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= adr1) return 1; else return 0;} + +reg0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= adrreg1) return 1; else return 0;} + +reg0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= adrx1) return 1; else return 0;} + +reg0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= regx1) return 1; else return 0;} + +indreg0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= reg1) return 1; else return 0;} + +indreg0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= indreg1) return 1; else return 0;} + +indreg0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= imm1) return 1; else return 0;} + +indreg0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= limm1) return 1; else return 0;} + +indreg0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= adr1) return 1; else return 0;} + +indreg0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= adrreg1) return 1; else return 0;} + +indreg0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= adrx1) return 1; else return 0;} + +indreg0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= regx1) return 1; else return 0;} + +imm0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= reg1) return 1; else return 0;} + +imm0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= indreg1) return 1; else return 0;} + +imm0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= imm1) return 1; else return 0;} + +imm0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= limm1) return 1; else return 0;} + +imm0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= adr1) return 1; else return 0;} + +imm0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= adrreg1) return 1; else return 0;} + +imm0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= adrx1) return 1; else return 0;} + +imm0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= regx1) return 1; else return 0;} + +limm0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= reg1) return 1; else return 0;} + +limm0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= indreg1) return 1; else return 0;} + +limm0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= imm1) return 1; else return 0;} + +limm0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= limm1) return 1; else return 0;} + +limm0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= adr1) return 1; else return 0;} + +limm0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= adrreg1) return 1; else return 0;} + +limm0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= adrx1) return 1; else return 0;} + +limm0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= regx1) return 1; else return 0;} + +adr0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= reg1) return 1; else return 0;} + +adr0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= indreg1) return 1; else return 0;} + +adr0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= imm1) return 1; else return 0;} + +adr0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= limm1) return 1; else return 0;} + +adr0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= adr1) return 1; else return 0;} + +adr0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= adrreg1) return 1; else return 0;} + +adr0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= adrx1) return 1; else return 0;} + +adr0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= regx1) return 1; else return 0;} + +adrreg0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= reg1) return 1; else return 0;} + +adrreg0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= indreg1) return 1; else return 0;} + +adrreg0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= imm1) return 1; else return 0;} + +adrreg0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= limm1) return 1; else return 0;} + +adrreg0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= adr1) return 1; else return 0;} + +adrreg0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= adrreg1) return 1; else return 0;} + +adrreg0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= adrx1) return 1; else return 0;} + +adrreg0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= regx1) return 1; else return 0;} + +adrx0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= reg1) return 1; else return 0;} + +adrx0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= indreg1) return 1; else return 0;} + +adrx0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= imm1) return 1; else return 0;} + +adrx0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= limm1) return 1; else return 0;} + +adrx0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= adr1) return 1; else return 0;} + +adrx0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= adrreg1) return 1; else return 0;} + +adrx0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= adrx1) return 1; else return 0;} + +adrx0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= regx1) return 1; else return 0;} + +regx0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= reg1) return 1; else return 0;} + +regx0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= indreg1) return 1; else return 0;} + +regx0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= imm1) return 1; else return 0;} + +regx0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= limm1) return 1; else return 0;} + +regx0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= adr1) return 1; else return 0;} + +regx0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= adrreg1) return 1; else return 0;} + +regx0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= adrx1) return 1; else return 0;} + +regx0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= regx1) return 1; else return 0;} + diff --git a/gcc/testsuite/gcc.c-torture/unsorted/SIset.c b/gcc/testsuite/gcc.c-torture/unsorted/SIset.c new file mode 100644 index 000000000..74a51cd0f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/SIset.c @@ -0,0 +1,216 @@ +#define E0 ((type *)10000000) +#define reg0 r0 +#define indreg0 (*p0) +#define imm0 22 +#define limm0 ((type)(int)&glob0) +#define adr0 (*E0) +#define adrreg0 (p0[10000000]) +#define adrx0 (E0[x0]) +#define regx0 (p0[x0]) + +#define E1 ((type *)11111111) +#define reg1 r1 +#define indreg1 (*p1) +#define imm1 33 +#define limm1 ((type)(int)&glob1) +#define adr1 (*E1) +#define adrreg1 (p1[1111111/4]) +#define adrx1 (E1[x1]) +#define regx1 (p1[x1]) + +int glob0, glob1; + +#define type int + +reg0reg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = reg1; } + +reg0indreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = indreg1; } + +reg0imm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = imm1; } + +reg0limm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = limm1; } + +reg0adr1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = adr1; } + +reg0adrreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = adrreg1; } + +reg0adrx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = adrx1; } + +reg0regx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{reg0 = regx1; } + +indreg0reg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = reg1; } + +indreg0indreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = indreg1; } + +indreg0imm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = imm1; } + +indreg0limm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = limm1; } + +indreg0adr1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = adr1; } + +indreg0adrreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = adrreg1; } + +indreg0adrx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = adrx1; } + +indreg0regx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{indreg0 = regx1; } + +adr0reg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = reg1; } + +adr0indreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = indreg1; } + +adr0imm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = imm1; } + +adr0limm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = limm1; } + +adr0adr1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = adr1; } + +adr0adrreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = adrreg1; } + +adr0adrx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = adrx1; } + +adr0regx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adr0 = regx1; } + +adrreg0reg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = reg1; } + +adrreg0indreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = indreg1; } + +adrreg0imm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = imm1; } + +adrreg0limm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = limm1; } + +adrreg0adr1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = adr1; } + +adrreg0adrreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = adrreg1; } + +adrreg0adrx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = adrx1; } + +adrreg0regx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrreg0 = regx1; } + +adrx0reg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = reg1; } + +adrx0indreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = indreg1; } + +adrx0imm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = imm1; } + +adrx0limm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = limm1; } + +adrx0adr1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = adr1; } + +adrx0adrreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = adrreg1; } + +adrx0adrx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = adrx1; } + +adrx0regx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{adrx0 = regx1; } + +regx0reg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = reg1; } + +regx0indreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = indreg1; } + +regx0imm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = imm1; } + +regx0limm1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = limm1; } + +regx0adr1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = adr1; } + +regx0adrreg1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = adrreg1; } + +regx0adrx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = adrx1; } + +regx0regx1_set (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{regx0 = regx1; } + diff --git a/gcc/testsuite/gcc.c-torture/unsorted/UHIcmp.c b/gcc/testsuite/gcc.c-torture/unsorted/UHIcmp.c new file mode 100644 index 000000000..1e969e710 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/UHIcmp.c @@ -0,0 +1,280 @@ +#define type unsigned short + +type glob0, glob1; + +#define E0 ((type *)10000000) +#define reg0 r0 +#define indreg0 (*p0) +#define imm0 22 +#define limm0 ((type)&glob0) +#define adr0 (*E0) +#define adrreg0 (p0[10000000]) +#define adrx0 (E0[x0]) +#define regx0 (p0[x0]) + +#define E1 ((type *)11111111) +#define reg1 r1 +#define indreg1 (*p1) +#define imm1 33 +#define limm1 ((type)&glob1) +#define adr1 (*E1) +#define adrreg1 (p1[1111111/4]) +#define adrx1 (E1[x1]) +#define regx1 (p1[x1]) + +reg0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= reg1) return 1; else return 0;} + +reg0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= indreg1) return 1; else return 0;} + +reg0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= imm1) return 1; else return 0;} + +reg0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= limm1) return 1; else return 0;} + +reg0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= adr1) return 1; else return 0;} + +reg0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= adrreg1) return 1; else return 0;} + +reg0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= adrx1) return 1; else return 0;} + +reg0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= regx1) return 1; else return 0;} + +indreg0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= reg1) return 1; else return 0;} + +indreg0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= indreg1) return 1; else return 0;} + +indreg0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= imm1) return 1; else return 0;} + +indreg0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= limm1) return 1; else return 0;} + +indreg0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= adr1) return 1; else return 0;} + +indreg0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= adrreg1) return 1; else return 0;} + +indreg0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= adrx1) return 1; else return 0;} + +indreg0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= regx1) return 1; else return 0;} + +imm0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= reg1) return 1; else return 0;} + +imm0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= indreg1) return 1; else return 0;} + +imm0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= imm1) return 1; else return 0;} + +imm0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= limm1) return 1; else return 0;} + +imm0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= adr1) return 1; else return 0;} + +imm0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= adrreg1) return 1; else return 0;} + +imm0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= adrx1) return 1; else return 0;} + +imm0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= regx1) return 1; else return 0;} + +limm0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= reg1) return 1; else return 0;} + +limm0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= indreg1) return 1; else return 0;} + +limm0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= imm1) return 1; else return 0;} + +limm0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= limm1) return 1; else return 0;} + +limm0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= adr1) return 1; else return 0;} + +limm0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= adrreg1) return 1; else return 0;} + +limm0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= adrx1) return 1; else return 0;} + +limm0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= regx1) return 1; else return 0;} + +adr0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= reg1) return 1; else return 0;} + +adr0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= indreg1) return 1; else return 0;} + +adr0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= imm1) return 1; else return 0;} + +adr0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= limm1) return 1; else return 0;} + +adr0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= adr1) return 1; else return 0;} + +adr0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= adrreg1) return 1; else return 0;} + +adr0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= adrx1) return 1; else return 0;} + +adr0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= regx1) return 1; else return 0;} + +adrreg0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= reg1) return 1; else return 0;} + +adrreg0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= indreg1) return 1; else return 0;} + +adrreg0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= imm1) return 1; else return 0;} + +adrreg0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= limm1) return 1; else return 0;} + +adrreg0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= adr1) return 1; else return 0;} + +adrreg0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= adrreg1) return 1; else return 0;} + +adrreg0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= adrx1) return 1; else return 0;} + +adrreg0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= regx1) return 1; else return 0;} + +adrx0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= reg1) return 1; else return 0;} + +adrx0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= indreg1) return 1; else return 0;} + +adrx0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= imm1) return 1; else return 0;} + +adrx0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= limm1) return 1; else return 0;} + +adrx0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= adr1) return 1; else return 0;} + +adrx0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= adrreg1) return 1; else return 0;} + +adrx0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= adrx1) return 1; else return 0;} + +adrx0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= regx1) return 1; else return 0;} + +regx0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= reg1) return 1; else return 0;} + +regx0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= indreg1) return 1; else return 0;} + +regx0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= imm1) return 1; else return 0;} + +regx0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= limm1) return 1; else return 0;} + +regx0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= adr1) return 1; else return 0;} + +regx0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= adrreg1) return 1; else return 0;} + +regx0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= adrx1) return 1; else return 0;} + +regx0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= regx1) return 1; else return 0;} + diff --git a/gcc/testsuite/gcc.c-torture/unsorted/UQIcmp.c b/gcc/testsuite/gcc.c-torture/unsorted/UQIcmp.c new file mode 100644 index 000000000..3e9cdebc9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/UQIcmp.c @@ -0,0 +1,280 @@ +#define type unsigned char + +type glob0, glob1; + +#define E0 ((type *)10000000) +#define reg0 r0 +#define indreg0 (*p0) +#define imm0 22 +#define limm0 ((type)&glob0) +#define adr0 (*E0) +#define adrreg0 (p0[10000000]) +#define adrx0 (E0[x0]) +#define regx0 (p0[x0]) + +#define E1 ((type *)11111111) +#define reg1 r1 +#define indreg1 (*p1) +#define imm1 33 +#define limm1 ((type)&glob1) +#define adr1 (*E1) +#define adrreg1 (p1[1111111/4]) +#define adrx1 (E1[x1]) +#define regx1 (p1[x1]) + +reg0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= reg1) return 1; else return 0;} + +reg0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= indreg1) return 1; else return 0;} + +reg0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= imm1) return 1; else return 0;} + +reg0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= limm1) return 1; else return 0;} + +reg0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= adr1) return 1; else return 0;} + +reg0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= adrreg1) return 1; else return 0;} + +reg0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= adrx1) return 1; else return 0;} + +reg0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= regx1) return 1; else return 0;} + +indreg0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= reg1) return 1; else return 0;} + +indreg0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= indreg1) return 1; else return 0;} + +indreg0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= imm1) return 1; else return 0;} + +indreg0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= limm1) return 1; else return 0;} + +indreg0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= adr1) return 1; else return 0;} + +indreg0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= adrreg1) return 1; else return 0;} + +indreg0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= adrx1) return 1; else return 0;} + +indreg0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= regx1) return 1; else return 0;} + +imm0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= reg1) return 1; else return 0;} + +imm0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= indreg1) return 1; else return 0;} + +imm0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= imm1) return 1; else return 0;} + +imm0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= limm1) return 1; else return 0;} + +imm0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= adr1) return 1; else return 0;} + +imm0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= adrreg1) return 1; else return 0;} + +imm0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= adrx1) return 1; else return 0;} + +imm0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= regx1) return 1; else return 0;} + +limm0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= reg1) return 1; else return 0;} + +limm0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= indreg1) return 1; else return 0;} + +limm0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= imm1) return 1; else return 0;} + +limm0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= limm1) return 1; else return 0;} + +limm0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= adr1) return 1; else return 0;} + +limm0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= adrreg1) return 1; else return 0;} + +limm0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= adrx1) return 1; else return 0;} + +limm0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= regx1) return 1; else return 0;} + +adr0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= reg1) return 1; else return 0;} + +adr0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= indreg1) return 1; else return 0;} + +adr0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= imm1) return 1; else return 0;} + +adr0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= limm1) return 1; else return 0;} + +adr0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= adr1) return 1; else return 0;} + +adr0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= adrreg1) return 1; else return 0;} + +adr0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= adrx1) return 1; else return 0;} + +adr0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= regx1) return 1; else return 0;} + +adrreg0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= reg1) return 1; else return 0;} + +adrreg0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= indreg1) return 1; else return 0;} + +adrreg0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= imm1) return 1; else return 0;} + +adrreg0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= limm1) return 1; else return 0;} + +adrreg0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= adr1) return 1; else return 0;} + +adrreg0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= adrreg1) return 1; else return 0;} + +adrreg0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= adrx1) return 1; else return 0;} + +adrreg0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= regx1) return 1; else return 0;} + +adrx0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= reg1) return 1; else return 0;} + +adrx0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= indreg1) return 1; else return 0;} + +adrx0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= imm1) return 1; else return 0;} + +adrx0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= limm1) return 1; else return 0;} + +adrx0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= adr1) return 1; else return 0;} + +adrx0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= adrreg1) return 1; else return 0;} + +adrx0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= adrx1) return 1; else return 0;} + +adrx0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= regx1) return 1; else return 0;} + +regx0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= reg1) return 1; else return 0;} + +regx0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= indreg1) return 1; else return 0;} + +regx0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= imm1) return 1; else return 0;} + +regx0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= limm1) return 1; else return 0;} + +regx0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= adr1) return 1; else return 0;} + +regx0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= adrreg1) return 1; else return 0;} + +regx0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= adrx1) return 1; else return 0;} + +regx0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= regx1) return 1; else return 0;} + diff --git a/gcc/testsuite/gcc.c-torture/unsorted/USIcmp.c b/gcc/testsuite/gcc.c-torture/unsorted/USIcmp.c new file mode 100644 index 000000000..e2175262a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/USIcmp.c @@ -0,0 +1,280 @@ +#define type unsigned int + +type glob0, glob1; + +#define E0 ((type *)10000000) +#define reg0 r0 +#define indreg0 (*p0) +#define imm0 22 +#define limm0 ((type)&glob0) +#define adr0 (*E0) +#define adrreg0 (p0[10000000]) +#define adrx0 (E0[x0]) +#define regx0 (p0[x0]) + +#define E1 ((type *)11111111) +#define reg1 r1 +#define indreg1 (*p1) +#define imm1 33 +#define limm1 ((type)&glob1) +#define adr1 (*E1) +#define adrreg1 (p1[1111111/4]) +#define adrx1 (E1[x1]) +#define regx1 (p1[x1]) + +reg0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= reg1) return 1; else return 0;} + +reg0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= indreg1) return 1; else return 0;} + +reg0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= imm1) return 1; else return 0;} + +reg0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= limm1) return 1; else return 0;} + +reg0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= adr1) return 1; else return 0;} + +reg0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= adrreg1) return 1; else return 0;} + +reg0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= adrx1) return 1; else return 0;} + +reg0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (reg0 <= regx1) return 1; else return 0;} + +indreg0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= reg1) return 1; else return 0;} + +indreg0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= indreg1) return 1; else return 0;} + +indreg0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= imm1) return 1; else return 0;} + +indreg0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= limm1) return 1; else return 0;} + +indreg0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= adr1) return 1; else return 0;} + +indreg0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= adrreg1) return 1; else return 0;} + +indreg0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= adrx1) return 1; else return 0;} + +indreg0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (indreg0 <= regx1) return 1; else return 0;} + +imm0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= reg1) return 1; else return 0;} + +imm0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= indreg1) return 1; else return 0;} + +imm0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= imm1) return 1; else return 0;} + +imm0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= limm1) return 1; else return 0;} + +imm0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= adr1) return 1; else return 0;} + +imm0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= adrreg1) return 1; else return 0;} + +imm0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= adrx1) return 1; else return 0;} + +imm0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (imm0 <= regx1) return 1; else return 0;} + +limm0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= reg1) return 1; else return 0;} + +limm0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= indreg1) return 1; else return 0;} + +limm0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= imm1) return 1; else return 0;} + +limm0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= limm1) return 1; else return 0;} + +limm0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= adr1) return 1; else return 0;} + +limm0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= adrreg1) return 1; else return 0;} + +limm0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= adrx1) return 1; else return 0;} + +limm0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (limm0 <= regx1) return 1; else return 0;} + +adr0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= reg1) return 1; else return 0;} + +adr0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= indreg1) return 1; else return 0;} + +adr0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= imm1) return 1; else return 0;} + +adr0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= limm1) return 1; else return 0;} + +adr0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= adr1) return 1; else return 0;} + +adr0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= adrreg1) return 1; else return 0;} + +adr0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= adrx1) return 1; else return 0;} + +adr0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adr0 <= regx1) return 1; else return 0;} + +adrreg0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= reg1) return 1; else return 0;} + +adrreg0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= indreg1) return 1; else return 0;} + +adrreg0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= imm1) return 1; else return 0;} + +adrreg0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= limm1) return 1; else return 0;} + +adrreg0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= adr1) return 1; else return 0;} + +adrreg0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= adrreg1) return 1; else return 0;} + +adrreg0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= adrx1) return 1; else return 0;} + +adrreg0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrreg0 <= regx1) return 1; else return 0;} + +adrx0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= reg1) return 1; else return 0;} + +adrx0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= indreg1) return 1; else return 0;} + +adrx0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= imm1) return 1; else return 0;} + +adrx0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= limm1) return 1; else return 0;} + +adrx0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= adr1) return 1; else return 0;} + +adrx0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= adrreg1) return 1; else return 0;} + +adrx0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= adrx1) return 1; else return 0;} + +adrx0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (adrx0 <= regx1) return 1; else return 0;} + +regx0reg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= reg1) return 1; else return 0;} + +regx0indreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= indreg1) return 1; else return 0;} + +regx0imm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= imm1) return 1; else return 0;} + +regx0limm1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= limm1) return 1; else return 0;} + +regx0adr1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= adr1) return 1; else return 0;} + +regx0adrreg1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= adrreg1) return 1; else return 0;} + +regx0adrx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= adrx1) return 1; else return 0;} + +regx0regx1 (r0, r1, x0, x1, p0, p1) +type r0, r1; type *p0, *p1; +{if (regx0 <= regx1) return 1; else return 0;} + diff --git a/gcc/testsuite/gcc.c-torture/unsorted/a.c b/gcc/testsuite/gcc.c-torture/unsorted/a.c new file mode 100644 index 000000000..47fb1f493 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/a.c @@ -0,0 +1,4 @@ +foo (a) +{ + return a & 65535; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/a1.c b/gcc/testsuite/gcc.c-torture/unsorted/a1.c new file mode 100644 index 000000000..654781d05 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/a1.c @@ -0,0 +1,7 @@ +int +foo (a, p) + int *p; +{ + p[0] = 85 * a; + p[1] = -86 * a; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/a3.c b/gcc/testsuite/gcc.c-torture/unsorted/a3.c new file mode 100644 index 000000000..85d2a2426 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/a3.c @@ -0,0 +1,12 @@ +foo (a) +{ + int i; + + for (i = 1; i < a; i++) + ; + { + int b = (int) &foo; + + return (a & b) == 0; + } +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/aa.c b/gcc/testsuite/gcc.c-torture/unsorted/aa.c new file mode 100644 index 000000000..61a4147af --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/aa.c @@ -0,0 +1,8 @@ +#define w 20 +#define c 1 + +foo (a) + unsigned a; +{ + return ((a & ((1 << w) - 1)) << c) > 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/aaa.c b/gcc/testsuite/gcc.c-torture/unsorted/aaa.c new file mode 100644 index 000000000..e31fb567c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/aaa.c @@ -0,0 +1,11 @@ +foo (a, b) +{ + int t; + while (b < 0) + { + t = a; + a = b; + b = t; + } + return a + b; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/abs.c b/gcc/testsuite/gcc.c-torture/unsorted/abs.c new file mode 100644 index 000000000..6a746b126 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/abs.c @@ -0,0 +1,9 @@ +foo (a) +{ + return __builtin_abs (a); +} + +main () +{ + printf ("%d %d\n", foo (0x80000000), foo (12)); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/ac.c b/gcc/testsuite/gcc.c-torture/unsorted/ac.c new file mode 100644 index 000000000..1d3c085ee --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/ac.c @@ -0,0 +1,30 @@ +barfoo (a) +{ + return (a << 16) & ~0xffff; +} + +foobar (a) +{ + return ((unsigned short) a) << 15;} + +foo (a) +{ + return (a & 0x121) << 31; +} + +bar (a) +{ + return (a & ~0xffff) << 16; +} + +main () +{ + int a; + + for (a = 1; a; a += a) + { + printf ("%d", (foo (a))); + } + puts (""); +} + diff --git a/gcc/testsuite/gcc.c-torture/unsorted/acc.c b/gcc/testsuite/gcc.c-torture/unsorted/acc.c new file mode 100644 index 000000000..a4a027a5f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/acc.c @@ -0,0 +1,8 @@ +foo (a) +{ + int b = a + 1; + int c = (short) a; + if (b) + return b; + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/add.c b/gcc/testsuite/gcc.c-torture/unsorted/add.c new file mode 100644 index 000000000..d796e41c7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/add.c @@ -0,0 +1,5 @@ +foo (a, b, p) + int *p; +{ + return 34 + *p; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/add386.c b/gcc/testsuite/gcc.c-torture/unsorted/add386.c new file mode 100644 index 000000000..bfdffbfe2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/add386.c @@ -0,0 +1,4 @@ +main (a) +{ + return a + 128; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/addcc.c b/gcc/testsuite/gcc.c-torture/unsorted/addcc.c new file mode 100644 index 000000000..cf52307aa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/addcc.c @@ -0,0 +1,18 @@ +foo (p, a, b) + int *p; + int a; + int b; +{ + + a += p[0]; + b += p[1]; + if (a == 0) + return b; + return a; +} + + +bar (a) +{ + return -a > 0 ? 1 : 2; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/andm.c b/gcc/testsuite/gcc.c-torture/unsorted/andm.c new file mode 100644 index 000000000..17101ae30 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/andm.c @@ -0,0 +1,15 @@ +foo (p) + int *p; +{ + return (*p & 255) == 0; +} + +bar (a) +{ + return (a & 0xfff00000) == 0; +} + +main () +{ + printf ("%d%d\n", bar (-1), bar(0)); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/andmem.c b/gcc/testsuite/gcc.c-torture/unsorted/andmem.c new file mode 100644 index 000000000..10bad00f4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/andmem.c @@ -0,0 +1,22 @@ +void p1 (p) int *p; +{ *p &= ~0xff; +} +void p2 (p) int *p; +{ *p &= ~0xff00; +} +void p3 (p) int *p; +{ *p &= ~0xffff0000; +} +void p4 (p) int *p; +{ *p &= ~0xffff; +} + +main () +{ + int a; + + a = 0x12345678; p1 (&a); printf ("%x\n", a); + a = 0x12345678; p2 (&a); printf ("%x\n", a); + a = 0x12345678; p3 (&a); printf ("%x\n", a); + a = 0x12345678; p4 (&a); printf ("%x\n", a); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/andn.c b/gcc/testsuite/gcc.c-torture/unsorted/andn.c new file mode 100644 index 000000000..2e38dd0e3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/andn.c @@ -0,0 +1,5 @@ +foo (a) +{ + int b = 0x1fff; + return a & ~b; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/andok.c b/gcc/testsuite/gcc.c-torture/unsorted/andok.c new file mode 100644 index 000000000..d55bd01b7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/andok.c @@ -0,0 +1,6 @@ +foo (a, b, p) + int *p; +{ + p[1] = a & 0xfff0000; + p[2] = b & 0xfff0000; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/andsi.c b/gcc/testsuite/gcc.c-torture/unsorted/andsi.c new file mode 100644 index 000000000..b9c3c76de --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/andsi.c @@ -0,0 +1,4 @@ +foo () +{ + return (int)&foo; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/andsparc.c b/gcc/testsuite/gcc.c-torture/unsorted/andsparc.c new file mode 100644 index 000000000..62f0de003 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/andsparc.c @@ -0,0 +1,11 @@ +foo (int *p) +{ + int a, b; + + a = 123456; + a += p[0]; + b = p[0]; + if (a == 0) + return b; + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/aos.c b/gcc/testsuite/gcc.c-torture/unsorted/aos.c new file mode 100644 index 000000000..77c92f677 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/aos.c @@ -0,0 +1,8 @@ +foo (p) + int *p; +{ + if ((int) p > 0) + return 1; + else + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/arr.c b/gcc/testsuite/gcc.c-torture/unsorted/arr.c new file mode 100644 index 000000000..ed56667dd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/arr.c @@ -0,0 +1,9 @@ +foo (a, b, c) +{ + bar (a, b); + { + int arr[10]; + arr[c] = b; + bar (arr[0], arr[1]); + } +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/as.c b/gcc/testsuite/gcc.c-torture/unsorted/as.c new file mode 100644 index 000000000..172f88355 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/as.c @@ -0,0 +1,14 @@ + +#define S 31 +#define A 17 + +foo (a) + unsigned a; +{ + return (a >> S) & ((1 << A) - 1); +} + +main () +{ + printf ("%d%d\n", foo (-1), foo (0)); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/ase.c b/gcc/testsuite/gcc.c-torture/unsorted/ase.c new file mode 100644 index 000000000..2d3d8edbd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/ase.c @@ -0,0 +1,10 @@ +ase (p) + short *p; +{ + int a; + a = p[1]; + p[2] = a; + if ((short) a) + p[a]++; + return (a == 0); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/b.c b/gcc/testsuite/gcc.c-torture/unsorted/b.c new file mode 100644 index 000000000..498d7552a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/b.c @@ -0,0 +1,4 @@ +main () +{ + *(short *) 25 = 123; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/b1.c b/gcc/testsuite/gcc.c-torture/unsorted/b1.c new file mode 100644 index 000000000..b6737594c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/b1.c @@ -0,0 +1,11 @@ +foo (long long x) +{ + if (x--) + return 255; + return 0; +} + +main () +{ + printf ("%d\n", foo (0)); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/b2.c b/gcc/testsuite/gcc.c-torture/unsorted/b2.c new file mode 100644 index 000000000..96e4556a5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/b2.c @@ -0,0 +1,24 @@ + +struct s +{ + unsigned a : 8; + unsigned b : 8; + unsigned c : 8; + unsigned d : 8; +}; + +/* +struct +{ + unsigned a : 8; + unsigned b : 16; + unsigned c : 8; +}; +*/ + +struct s +foo (struct s s, int i) +{ + s.b = i; + return s; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/b3.c b/gcc/testsuite/gcc.c-torture/unsorted/b3.c new file mode 100644 index 000000000..af693f779 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/b3.c @@ -0,0 +1,12 @@ +struct tree_common +{ + unsigned int code : 9; + unsigned int code2 : 7; +}; + +static int +duplicate_decls (x) + register struct tree_common x; +{ + return x.code2; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/b88.c b/gcc/testsuite/gcc.c-torture/unsorted/b88.c new file mode 100644 index 000000000..971c7c76d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/b88.c @@ -0,0 +1,12 @@ +foo (double d) +{ + d = -d; + if (d < 0.0) + return 1; + return 2; +} + +main () +{ + foo (0.0); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/bad.c b/gcc/testsuite/gcc.c-torture/unsorted/bad.c new file mode 100644 index 000000000..8cc84973b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/bad.c @@ -0,0 +1,26 @@ +typedef union longlong +{ + struct {unsigned short h0, h1, h2, h3;} h; + struct {signed long low, high;} si; + struct {unsigned long low, high;} ui; + signed long long sll; + unsigned long long ull; +} long_long; + + +long long +__negdi2 (u) + long long u; +{ + long_long uu; + + uu.sll = u; + + uu.si.low = -uu.si.low; + if (uu.si.low == 0) + uu.si.high = -uu.si.high; + else + uu.si.high = ~uu.si.high; + + return uu.sll; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/band.c b/gcc/testsuite/gcc.c-torture/unsorted/band.c new file mode 100644 index 000000000..74b02fd3b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/band.c @@ -0,0 +1,16 @@ +foo (a) +{ + return (a & (1 << 31)) != 0; +} + +main () +{ + if (foo (0)) + puts ("foo"); + else + puts ("bar"); + if (foo (~0)) + puts ("foo"); + else + puts ("bar"); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/bb0.c b/gcc/testsuite/gcc.c-torture/unsorted/bb0.c new file mode 100644 index 000000000..aab6d683f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/bb0.c @@ -0,0 +1,5 @@ +foo (a) +{ + return (a & 0xfff000) != 0; + +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/bb1.c b/gcc/testsuite/gcc.c-torture/unsorted/bb1.c new file mode 100644 index 000000000..3f9aebe03 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/bb1.c @@ -0,0 +1,8 @@ +foo (a) +{ + int b = 32; + if (b & a) + return 1; + else + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/bbb.c b/gcc/testsuite/gcc.c-torture/unsorted/bbb.c new file mode 100644 index 000000000..837dd9ecf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/bbb.c @@ -0,0 +1,12 @@ +struct looksets + { + int lset[10]; + }; + +struct looksets lkst[]; + +flset( p ) +struct looksets *p; +{ + p-- > lkst; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/bc.c b/gcc/testsuite/gcc.c-torture/unsorted/bc.c new file mode 100644 index 000000000..c713bb61b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/bc.c @@ -0,0 +1,4 @@ +foo (a, b) +{ + return a % (1 << b); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/bcopy.c b/gcc/testsuite/gcc.c-torture/unsorted/bcopy.c new file mode 100644 index 000000000..aed994e57 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/bcopy.c @@ -0,0 +1,68 @@ +void +bcopy1 (s, d, c) + long long *s; + long long *d; + int c; +{ + int i; + c = c / 8; + for (i = 0; i < c; i++) + d[i] = s[i]; +} + +void +bcopy2 (s, d, c) + long *s; + long *d; + int c; +{ + int i; + c = c / 4; + for (i = 0; i < c; i++) + d[i] = s[i]; +} + + +void +bcopy3 (s, d, c) + char *s; + char *d; + int c; +{ + long long z0, z1; + int r = d - s; + + int i; + + c /= 16; + + z0 = *((long long *) s); + s += 8; + z1 = *((long long *) s); + s += 8; + for (i = 0; i < c; i++) + { + *(long long *)(s + r) = z0; + z0 = *((long long *) s); + s += 8; + *(long long *)(s + r) = z1; + z1 = *((long long *) s); + s += 8; + } +} + +#if defined(STACK_SIZE) && STACK_SIZE < 16384 +#define BYTES STACK_SIZE +#else +#define BYTES 16384 +#endif + +main () +{ + long long s[BYTES / 8]; + long long d[BYTES / 8]; + int i; + + for (i = 1; i < 67108864 / BYTES; i++) + bcopy (s, d, BYTES); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/bf.c b/gcc/testsuite/gcc.c-torture/unsorted/bf.c new file mode 100644 index 000000000..821623df0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/bf.c @@ -0,0 +1,31 @@ +typedef unsigned long uint32; +typedef signed long sint32; + +uint32 +ext (sint32 src, unsigned o5, unsigned w5) +{ + return (w5 == 0) ? src >> o5 : (src << (( - o5 - w5) & 31)) >> (32 - w5); +} + +uint32 +extu (uint32 src, unsigned o5, unsigned w5) +{ + return (w5 == 0) ? src >> o5 : (src << (( - o5 - w5) & 31)) >> (32 - w5); +} + +uint32 +mak (uint32 src, unsigned o5, unsigned w5) +{ + return (w5 == 0) ? src << o5 : (src << (32 - w5)) >> (( - o5 - w5) & 31); +} + +uint32 +rot (uint32 src, unsigned o5) +{ + return (src >> o5) | (src << (( - o5) & 31)); +} + +main (int argc, char **argv) +{ + printf ("%x\n", clr (0xffffffff, atoi (argv[2]), atoi (argv[1]))); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/bfins.c b/gcc/testsuite/gcc.c-torture/unsorted/bfins.c new file mode 100644 index 000000000..e626d82b3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/bfins.c @@ -0,0 +1,15 @@ +struct foo +{ + unsigned j : 16; + unsigned i : 16; +}; + +struct foo +foo (a, b) + struct foo a; + int b; +{ + a.j = 123; + a.i = b; + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/bfx.c b/gcc/testsuite/gcc.c-torture/unsorted/bfx.c new file mode 100644 index 000000000..d47bd7d18 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/bfx.c @@ -0,0 +1,9 @@ +foo (x, c) +{ + return x << -c; +} + +main () +{ + printf ("%x\n", foo (0xf05, -4)); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/bge.c b/gcc/testsuite/gcc.c-torture/unsorted/bge.c new file mode 100644 index 000000000..55f478829 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/bge.c @@ -0,0 +1,7 @@ +foo (a) + double a; +{ + if (a >= 0) + return 1; + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/bit.c b/gcc/testsuite/gcc.c-torture/unsorted/bit.c new file mode 100644 index 000000000..e76bb45e7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/bit.c @@ -0,0 +1,13 @@ +bar (a) +{ + return (a == 0); +} + +foo (a) + int a; +{ + if ((a & (1 << 26)) >= 0) + return 1; + else + return 2; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/bitf.c b/gcc/testsuite/gcc.c-torture/unsorted/bitf.c new file mode 100644 index 000000000..5b0aefc83 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/bitf.c @@ -0,0 +1,17 @@ +#define int unsigned + +struct foo +{ + int aa : 1; + int a : 9; + int c : 16; + int d : 6; +}; + + +int +foo (a, b) + struct foo a; +{ + return a.d == 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/bitw.c b/gcc/testsuite/gcc.c-torture/unsorted/bitw.c new file mode 100644 index 000000000..585cd32e6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/bitw.c @@ -0,0 +1,9 @@ +foo (a) + unsigned a; +{ + unsigned b = 0; + + if ((a & 12345678) > b) + return 1; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/blk.c b/gcc/testsuite/gcc.c-torture/unsorted/blk.c new file mode 100644 index 000000000..18a9545cc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/blk.c @@ -0,0 +1,18 @@ +struct +{ + double a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t; +} foo, bar; + +foobar () +{ + foo = bar; + xxx (&foo, &bar); +} + +main () +{ + bar.g = 1.0; + foo.g = 2.0; + foobar (); + printf ("%lf\n", foo.g); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/bt.c b/gcc/testsuite/gcc.c-torture/unsorted/bt.c new file mode 100644 index 000000000..ac20c0567 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/bt.c @@ -0,0 +1,7 @@ +main () +{ + int i; + + for (i = 1000000; --i;) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/bt386.c b/gcc/testsuite/gcc.c-torture/unsorted/bt386.c new file mode 100644 index 000000000..283ab5fa6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/bt386.c @@ -0,0 +1,18 @@ +foo (a, b) +{ + return (a & (1 << b)) != 0; +} + +bar (a, b) +{ + a ^= (1 << b); + return a != 0; +} + +main () +{ + int i; + for (i = 0; i < 32; i++) + printf ("%d ", foo (0x8000000f, i)); + puts (""); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/bug.c b/gcc/testsuite/gcc.c-torture/unsorted/bug.c new file mode 100644 index 000000000..447eb7af2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/bug.c @@ -0,0 +1,4 @@ +foo (a, b) +{ + return a - 65536; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/bugc.c b/gcc/testsuite/gcc.c-torture/unsorted/bugc.c new file mode 100644 index 000000000..b2ce1fad8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/bugc.c @@ -0,0 +1,7 @@ + +int +reg0indreg1 (r0, p1) + short r0; short *p1; +{ + return (r0); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/buns.c b/gcc/testsuite/gcc.c-torture/unsorted/buns.c new file mode 100644 index 000000000..f206bfaed --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/buns.c @@ -0,0 +1,12 @@ +foo (a) +{ + int bar = 0; + + return (unsigned) (a - 1) <= (unsigned) bar; +} + +main () +{ + if (foo (-1)) + puts ("The largest possible unsigned <= 0 on this machine..."); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/bx.c b/gcc/testsuite/gcc.c-torture/unsorted/bx.c new file mode 100644 index 000000000..274fb015c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/bx.c @@ -0,0 +1,12 @@ +unsigned +good (unsigned src, unsigned o5, unsigned w5) +{ + return src & ~((w5 == 0) ? (~0 << o5) : (1 << o5)); +} + +unsigned +bad (unsigned src, unsigned o5, unsigned w5) +{ + return src & ((w5 == 0) ? ~(~0 << o5) : ~(1 << o5)); +} + diff --git a/gcc/testsuite/gcc.c-torture/unsorted/c.c b/gcc/testsuite/gcc.c-torture/unsorted/c.c new file mode 100644 index 000000000..384ee3e3c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/c.c @@ -0,0 +1,17 @@ +foo (a, b) + long long a, b; +{ + if (a & ~b) + return 1; + else + return 0; +} + +bar (a, b) + long long a, b; +{ + if (a & ~b & ((long long) 87612378)) + return 1; + else + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/c1.c b/gcc/testsuite/gcc.c-torture/unsorted/c1.c new file mode 100644 index 000000000..f50d437f6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/c1.c @@ -0,0 +1,7 @@ +unsigned +rec (a, b) + unsigned a; + unsigned b; +{ + return a * rec (a - 1, b + 1); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/c2.c b/gcc/testsuite/gcc.c-torture/unsorted/c2.c new file mode 100644 index 000000000..ef5a71188 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/c2.c @@ -0,0 +1,5 @@ +foo (a) +{ + bar (a); + bar (a); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/call.c b/gcc/testsuite/gcc.c-torture/unsorted/call.c new file mode 100644 index 000000000..c81060383 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/call.c @@ -0,0 +1,7 @@ +int foo () {} + +main (a, b) +{ + foo (foo (a, b), foo (b, a)); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/call386.c b/gcc/testsuite/gcc.c-torture/unsorted/call386.c new file mode 100644 index 000000000..c82a3be34 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/call386.c @@ -0,0 +1,20 @@ +void foo () {} + +int main () +{ + int i; + for (i = 100000; i >= 0; i--) + { + foo (); + foo (); + foo (); + foo (); + foo (); + foo (); + foo (); + foo (); + foo (); + foo (); + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/callind.c b/gcc/testsuite/gcc.c-torture/unsorted/callind.c new file mode 100644 index 000000000..74c0f1f9c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/callind.c @@ -0,0 +1,8 @@ +call (foo, a) + int (**foo) (); +{ + + (foo)[1] = call; + + foo[a] (1); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/cc.c b/gcc/testsuite/gcc.c-torture/unsorted/cc.c new file mode 100644 index 000000000..e29bec49d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/cc.c @@ -0,0 +1,96 @@ +cc8 (a, b) +{ + if (a < 0) + goto L1; + if (a == 0) + goto L2; + L1:b++; + L2:b++; + return b; +} + +cc7 (a) + long long a; +{ + if (a < 0) + return 1; + else + return 0; +} + +cc6 (float a, double p) +{ + p = a; + if (p < 0) + return p; + else + return p + 1; +} + +cc5 (p, a) + char *p; + char a; +{ + p[2] = a; + if (a) + return 0; + else + return 1; +} + + +cc4 (a, b, p) + int a, b; + int *p; +{ + a = (int short)b; + *p = a; + if ((int) a < 0) + return 0; + else + return 1; +} + + +cc1 (a, b) +{ + int x = 0; + + if ((int) a < (int) b) + { + if ((unsigned) a < (unsigned) b) + x++; + x++; + } + + return x; +} + +cc2 (a, b) +{ + int x = 0; + + if ((int) a <= (int) b) + { + if ((int) a < (int) b) + x++; + x++; + } + + return x; +} + +cc3 (a, b) +{ + int x = 0; + + a += b; + if ((unsigned) a > 0) + { + if (a == 0) + x++; + x++; + } + + return x; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/charmtst.c b/gcc/testsuite/gcc.c-torture/unsorted/charmtst.c new file mode 100644 index 000000000..2945f198e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/charmtst.c @@ -0,0 +1,15 @@ +c_move_tst (char b) +{ + char a; + + a = b; + b = 'b'; + foo (a); + foo (b); + foo (a); + bar (a, b); + b = a; + if (b == 0) + a++; + return a + b; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/cmb.c b/gcc/testsuite/gcc.c-torture/unsorted/cmb.c new file mode 100644 index 000000000..1fd946182 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/cmb.c @@ -0,0 +1,6 @@ +foo (p1, p2) + short p1, *p2; +{ + int a; + return (int) p1 + (int) *p2; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/cmp.c b/gcc/testsuite/gcc.c-torture/unsorted/cmp.c new file mode 100644 index 000000000..a82fe4247 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/cmp.c @@ -0,0 +1,11 @@ +struct fooalign {char x; double d;}; +union fooround {long x; double d;}; + +int +foo () +{ + int extra = 4; + if (extra < sizeof (union fooround)) + extra = sizeof (union fooround); + return extra; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/cmphi.c b/gcc/testsuite/gcc.c-torture/unsorted/cmphi.c new file mode 100644 index 000000000..1ffc2140f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/cmphi.c @@ -0,0 +1,4 @@ +foo (short *p, short a) +{ + return a < *p; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/cmpsi386.c b/gcc/testsuite/gcc.c-torture/unsorted/cmpsi386.c new file mode 100644 index 000000000..50b08d712 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/cmpsi386.c @@ -0,0 +1,14 @@ +foo (a, p) + register int a; + int *p; +{ + + for (a = 10000000; a >= *p; a--) + ; +} + +main () +{ + int a; + foo (a, a); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/cmul.c b/gcc/testsuite/gcc.c-torture/unsorted/cmul.c new file mode 100644 index 000000000..cce20bc35 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/cmul.c @@ -0,0 +1,4 @@ +foo (a) +{ + return a * 84; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/cn1.c b/gcc/testsuite/gcc.c-torture/unsorted/cn1.c new file mode 100644 index 000000000..866778ca1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/cn1.c @@ -0,0 +1,5 @@ +int +foo () +{ + return 7561; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/comb.c b/gcc/testsuite/gcc.c-torture/unsorted/comb.c new file mode 100644 index 000000000..a4689079b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/comb.c @@ -0,0 +1,7 @@ +foo (a, b) +{ + int c = a & b; + if ((a & b) == 0) + return 0; + return c; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/consec.c b/gcc/testsuite/gcc.c-torture/unsorted/consec.c new file mode 100644 index 000000000..fd76cd2ee --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/consec.c @@ -0,0 +1,17 @@ +int glob; + +conseq (a, b, c, d) + int *a, *b; +{ + a[2] = d; + a[1] = c; + sequence (a, b, c, d); + sequence (d, c, b, a); + b[0] = 0; + b[1] = 123; + a[0] = 321; + a[1] = 0; + sequence (111, 0, 0, 222, 0, 333); + ((int *)glob)[2] = c; + ((int *)glob)[3] = d; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/const.c b/gcc/testsuite/gcc.c-torture/unsorted/const.c new file mode 100644 index 000000000..209fc7688 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/const.c @@ -0,0 +1,4 @@ +main (a) +{ + return a + (~0 - 240); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/conv.c b/gcc/testsuite/gcc.c-torture/unsorted/conv.c new file mode 100644 index 000000000..70fc02412 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/conv.c @@ -0,0 +1,32 @@ +double +u2d (unsigned int u) +{ + return u; +} + +double +i2d (signed int i) +{ + return i; +} + +unsigned int +d2u (double d) +{ + return d; +} + +signed int +d2i (double d) +{ + return d; +} + +main () +{ + printf ("%lf, %lf, %lf\n", u2d (~0), u2d (1 << 31), u2d (1)); + printf ("%lf, %lf, %lf\n", i2d (~0), i2d (1 << 31), i2d (1)); + + printf ("%u, %u, %u\n", d2u (u2d (~0)), d2u (u2d (1 << 31)), d2u (u2d (1))); + printf ("%d, %d, %d\n", d2i (i2d (~0)), d2i (i2d (1 << 31)), d2i (i2d (1))); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/conv_tst.c b/gcc/testsuite/gcc.c-torture/unsorted/conv_tst.c new file mode 100644 index 000000000..513d6a247 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/conv_tst.c @@ -0,0 +1,66 @@ +#define ID_1 2400000000.0 +#define ID_2 1.7 +#define ID_3 -1.7 + +unsigned ui; +int si; + +conv_i1 () +{ +/* + ui = (unsigned) ID_1; + si = (int) ID_1; +*/ +} + +conv_i2 () +{ + ui = (unsigned) ID_2; + si = (int) ID_2; +} + +conv_i3 () +{ +/* ui = (unsigned) ID_3;*/ + si = (int) ID_3; +} + +conv_1 (d) + double d; +{ + ui = (unsigned) d; +/* + si = (int) d; +*/ +} + +double +foo (u) + unsigned u; +{ + return u; +} + +main () +{ + printf ("%lf\n", foo (2400000000)); + + conv_i1 (); + printf ("%lf, %u, %d\n", ID_1, ui, si); + + conv_i2 (); + printf ("%lf, %u, %d\n", ID_2, ui, si); + + conv_i3 (); + printf ("%lf, %u, %d\n", ID_3, ui, si); + + conv_1 (ID_1); + printf ("%lf, %u, %d\n", ID_1, ui, si); + + conv_1 (ID_2); + printf ("%lf, %u, %d\n", ID_2, ui, si); + + conv_1 (ID_3); + printf ("%lf, %u, %d\n", ID_3, ui, si); + +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/cp.c b/gcc/testsuite/gcc.c-torture/unsorted/cp.c new file mode 100644 index 000000000..04b1420cb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/cp.c @@ -0,0 +1,42 @@ +struct _obstack_chunk +{ + char *limit; + struct _obstack_chunk *prev; + char contents[4]; +}; + +struct obstack +{ + long chunk_size; + struct _obstack_chunk* chunk; + char *object_base; + char *next_free; + char *chunk_limit; + int temp; + int alignment_mask; + struct _obstack_chunk *(*chunkfun) (); + void (*freefun) (); +}; + +struct fooalign {char x; double d;}; +union fooround {long x; double d;}; + +void +_obstack_begin (h, size, alignment, chunkfun, freefun) + struct obstack *h; + int size; + int alignment; + void * (*chunkfun) (); + void (*freefun) (); +{ + register struct _obstack_chunk* chunk; + + if (alignment == 0) + alignment = ((char *)&((struct fooalign *) 0)->d - (char *)0); + if (size == 0) + { + int extra = 4; + if (extra < (sizeof (union fooround))) + extra = (sizeof (union fooround)); + } +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/csebug.c b/gcc/testsuite/gcc.c-torture/unsorted/csebug.c new file mode 100644 index 000000000..f49f6842c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/csebug.c @@ -0,0 +1,7 @@ + +int +reg0indreg1 (r0, p1) + short r0; short *p1; +{ + return (r0 + *p1); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/cvt.c b/gcc/testsuite/gcc.c-torture/unsorted/cvt.c new file mode 100644 index 000000000..716659c47 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/cvt.c @@ -0,0 +1,9 @@ +foo (p) + unsigned char *p; +{ + unsigned char a = 0; + + if (*p > 0) + return 1; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/d.c b/gcc/testsuite/gcc.c-torture/unsorted/d.c new file mode 100644 index 000000000..5fca120d8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/d.c @@ -0,0 +1,19 @@ +long long unsigned +str2llu (str) + char *str; +{ + long long unsigned acc; + long long b = 10; + char d; + acc = *str++ - '0'; + for (;;) + { + d = *str++; + if (d == '\0') + break; + d -= '0'; + acc = acc * 10 + d; + } + + return acc; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/dbl_parm.c b/gcc/testsuite/gcc.c-torture/unsorted/dbl_parm.c new file mode 100644 index 000000000..ce5ba4f16 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/dbl_parm.c @@ -0,0 +1,10 @@ +foo (a, b, c) + double a; + int b; + double c; +{ + if (b) + return a + c; + else + return a - c; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/dblbug.c b/gcc/testsuite/gcc.c-torture/unsorted/dblbug.c new file mode 100644 index 000000000..cd13b7962 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/dblbug.c @@ -0,0 +1,21 @@ +union real_extract +{ + double d; + int i[sizeof (double ) / sizeof (int)]; +}; + +typedef struct +{ + int zzzz; +} *rtx; + +rtx +immed_real_const_1 (d) + double d; +{ + union real_extract u; + register rtx r; + + u.d = d; + foo (&(r->zzzz), &u); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/ddd.c b/gcc/testsuite/gcc.c-torture/unsorted/ddd.c new file mode 100644 index 000000000..b0b6809dd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/ddd.c @@ -0,0 +1,7 @@ +int foo; +int bar; + +main () +{ + return foo + bar; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/dead.c b/gcc/testsuite/gcc.c-torture/unsorted/dead.c new file mode 100644 index 000000000..795f7c7e4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/dead.c @@ -0,0 +1,5 @@ +foo (a) +{ + ++a; + return a == 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/delay.c b/gcc/testsuite/gcc.c-torture/unsorted/delay.c new file mode 100644 index 000000000..c77638352 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/delay.c @@ -0,0 +1,11 @@ +foo (a, b) +{ + if (a == 1) + goto foo1; + if (a == 2) + goto foo2; + foo1: + return 2; + foo2: + return 3; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/di.c b/gcc/testsuite/gcc.c-torture/unsorted/di.c new file mode 100644 index 000000000..476bf700f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/di.c @@ -0,0 +1,12 @@ +long long +foo (a, b) + long long a, b; +{ + return a * b; +} + +main () +{ + int a = foo ((long long) 2, (long long) 3); + printf ("%d\n", a); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/dic.c b/gcc/testsuite/gcc.c-torture/unsorted/dic.c new file mode 100644 index 000000000..9c2c9f90f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/dic.c @@ -0,0 +1,5 @@ +unsigned long long +main () +{ + return (unsigned long long) 7816234 << 671111; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/dilayout.c b/gcc/testsuite/gcc.c-torture/unsorted/dilayout.c new file mode 100644 index 000000000..4bba661c0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/dilayout.c @@ -0,0 +1,33 @@ +struct ii +{ + int a; + int b; +}; + +struct foo +{ + int a; + struct ii ab; + int b; +}; + +struct ii +foo (int *p, struct foo a) +{ + p[0] = a.a; + p[1] = a.ab.a; + p[2] = a.ab.b; + p[3] = a.b; + return a.ab; +} + +str (struct ii ab, struct ii *p) +{ + *p = ab; +} + +ll (long long ab, long long *p) +{ + *p = ab; +} + diff --git a/gcc/testsuite/gcc.c-torture/unsorted/dimove.c b/gcc/testsuite/gcc.c-torture/unsorted/dimove.c new file mode 100644 index 000000000..7caf3fa46 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/dimove.c @@ -0,0 +1,4 @@ +foo (long long *p) +{ + p[0] = p[1]; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/dimul.c b/gcc/testsuite/gcc.c-torture/unsorted/dimul.c new file mode 100644 index 000000000..c8529565f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/dimul.c @@ -0,0 +1,6 @@ +long long +foo (a, b) + long long a, b; +{ + return a * b; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/div.c b/gcc/testsuite/gcc.c-torture/unsorted/div.c new file mode 100644 index 000000000..1f0904a64 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/div.c @@ -0,0 +1,4 @@ +foo (a, b) +{ + return a / b; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/divdf.c b/gcc/testsuite/gcc.c-torture/unsorted/divdf.c new file mode 100644 index 000000000..5ea89ae3d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/divdf.c @@ -0,0 +1,5 @@ +double +foo (float a, float b) +{ + return (double)a / (double)b; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/dm.c b/gcc/testsuite/gcc.c-torture/unsorted/dm.c new file mode 100644 index 000000000..67c60ee98 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/dm.c @@ -0,0 +1,24 @@ +struct dm +{ + unsigned q; + unsigned r; +}; + +struct dm +dm (a, b) + unsigned a, b; +{ + struct dm qr; + + qr.q = a / b; + qr.r = a % b; + return qr; +} + +main () +{ + struct dm qr; + + qr = dm (100, 30); + printf ("%u, %u\n", qr.q, qr.r); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/dshift.c b/gcc/testsuite/gcc.c-torture/unsorted/dshift.c new file mode 100644 index 000000000..94750cc3c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/dshift.c @@ -0,0 +1,10 @@ +foo (b, c) + unsigned b, c; +{ + return (b << 12) | (c >> 20); +} + +main () +{ + printf ("0x%x\n", foo (0x11223344, 0xaabbccdd)); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.c b/gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.c new file mode 100644 index 000000000..d9f7d2ed2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.c @@ -0,0 +1,59 @@ +#include + +#if MASK & 1 +#define t11(x) x x x x x x x x x x x +#define t16(x) x x x x x x x x x x x x x x x x +#if INT_MAX < 2147483647 +#define M (sizeof (t11(t11(t16(t16(" "))))) - 1) +#else +#define M (sizeof (t16(t16(t16(t16(t16(" ")))))) - 1) +#endif +#endif +#if MASK & 2 +#if INT_MAX < 2147483647 +#define M 30976 +#else +#define M 1048576 +#endif +#endif + +typedef struct s { + int c; + void *vp; + struct s *s; +}s; + +typedef int (*fpt) (const char *, void *, int *); + +int M_var = M; + +extern void exit (int); + +int +f (int start, int end, int *a, int *b, int c, s *sp) +{ + int count = 0; + int i; + + for (i = start; i <= end; i++) + { + a[i] = b[i] + c; + count ++; + } + (*(fpt)sp->s->vp) ("Hello World!\n", &exit, &M_var); + return count; +} + +int +g (int i) +{ + switch (i) + { + case 1: return 42; + case 2: return 60; + case 3: return 7; + case 4: return 3; + case 5: return M; + default: return 0; + } +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.x b/gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.x new file mode 100644 index 000000000..a8174e05c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.x @@ -0,0 +1,40 @@ +# This checks if -fdump-noaddr dumps are done consistently. +proc dump_compare { src options } { + global srcdir subdir + global tmpdir + + global torture_with_loops + set option_list $torture_with_loops + set dumpbase [file tail $src] + + # loop through all the options + foreach option $option_list { + file delete -force dump1 + file mkdir dump1 + c-torture-compile $src "$option $options -dumpbase dump1/$dumpbase -DMASK=1 -x c --param ggc-min-heapsize=1 -fdump-ipa-all -fdump-rtl-all -fdump-tree-all -fdump-noaddr" + file delete -force dump2 + file mkdir dump2 + c-torture-compile $src "$option $options -dumpbase dump2/$dumpbase -DMASK=2 -x c -fdump-ipa-all -fdump-rtl-all -fdump-tree-all -fdump-noaddr" + foreach dump1 [lsort [glob -nocomplain dump1/*]] { + regsub dump1/ $dump1 dump2/ dump2 + set dumptail "gcc.c-torture/unsorted/[file tail $dump1]" + #puts "$option $dump1" + set tmp [ diff "$dump1" "$dump2" ] + if { $tmp == 0 } { + untested "$dumptail, $option comparison" + } elseif { $tmp == 1 } { + pass "$dumptail, $option comparison" + } else { + fail "$dumptail, $option comparison" + } + #exec diff $dump1 $dump2 + } + } + file delete -force dump1 + file delete -force dump2 +} + +catch {dump_compare $src $options} result +puts $result +verbose result +return 1 diff --git a/gcc/testsuite/gcc.c-torture/unsorted/e.c b/gcc/testsuite/gcc.c-torture/unsorted/e.c new file mode 100644 index 000000000..fa20e00ef --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/e.c @@ -0,0 +1,10 @@ +foo (short a, int *p, short *s) +{ + int i; + for (i = 10; i >= 0; i--) + { + a = (short) bar (); + p[i] = a; + s[i] = a; + } +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/ex.c b/gcc/testsuite/gcc.c-torture/unsorted/ex.c new file mode 100644 index 000000000..f5d90fd2e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/ex.c @@ -0,0 +1,11 @@ +foo (a, b) +{ + if ((a & (1 << b)) == 0) + return 1; + return 0; +} + +main () +{ + printf ("%d\n", foo ()); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/ext.c b/gcc/testsuite/gcc.c-torture/unsorted/ext.c new file mode 100644 index 000000000..9e8604ef2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/ext.c @@ -0,0 +1,23 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int +main (void) +{ + exit (0); +} +#else +struct foo +{ + unsigned b31 : 1; + unsigned b30 : 1; + unsigned b29 : 1; + unsigned b28 : 1; + unsigned rest : 28; +}; +foo(a) + struct foo a; +{ + return a.b30; +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/unsorted/f1.c b/gcc/testsuite/gcc.c-torture/unsorted/f1.c new file mode 100644 index 000000000..446acc6e1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/f1.c @@ -0,0 +1,5 @@ +double +foo () +{ + return 1.2587624368724; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/f2.c b/gcc/testsuite/gcc.c-torture/unsorted/f2.c new file mode 100644 index 000000000..8bb384902 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/f2.c @@ -0,0 +1,4 @@ +foo (double *p) +{ + p[0] = p[1]; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/fdmul.c b/gcc/testsuite/gcc.c-torture/unsorted/fdmul.c new file mode 100644 index 000000000..711707b51 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/fdmul.c @@ -0,0 +1,2 @@ +double +foo (float a, float b) { return (double) a * (double) b; } diff --git a/gcc/testsuite/gcc.c-torture/unsorted/flo.c b/gcc/testsuite/gcc.c-torture/unsorted/flo.c new file mode 100644 index 000000000..2a213b7ab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/flo.c @@ -0,0 +1,7 @@ +foo (a) + double a; +{ + double b = 0.0; + + return (a == 0); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/float.c b/gcc/testsuite/gcc.c-torture/unsorted/float.c new file mode 100644 index 000000000..b6789203b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/float.c @@ -0,0 +1,6 @@ +double +foo (a, b, c) + double a, b, c; +{ + return a * b + c * a; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/flt_const.c b/gcc/testsuite/gcc.c-torture/unsorted/flt_const.c new file mode 100644 index 000000000..65700ba77 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/flt_const.c @@ -0,0 +1,5 @@ +double +foo () +{ + return 3.141592653589793238462643; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/fnul.c b/gcc/testsuite/gcc.c-torture/unsorted/fnul.c new file mode 100644 index 000000000..b0c9816ad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/fnul.c @@ -0,0 +1,23 @@ +main () +{ + int i; + int f; + + for (i = 0;; i--) + { + f = 0; + + if ((i & (i - 1)) == 0) + { + printf ("d"); + f = 1; + } + if ((i & -i) == i) + { + printf ("t"); + f = 1; + } + if (f) + printf ("%d\n", i); + } +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/foo.c b/gcc/testsuite/gcc.c-torture/unsorted/foo.c new file mode 100644 index 000000000..762d7e457 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/foo.c @@ -0,0 +1,8 @@ +int * +main (s1, s2) + int *s1; int *s2; +{ + while ((*s1++ = *s2++) != '\0') + ; + return s1 - 1; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/forgetcc.c b/gcc/testsuite/gcc.c-torture/unsorted/forgetcc.c new file mode 100644 index 000000000..4105408a0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/forgetcc.c @@ -0,0 +1,11 @@ +foo (hp, p, a) + short *hp; + int *p; + int a; +{ + hp[10] = a; + p[0] = 10; + if (hp[10] > 0) + return 1; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/fq.c b/gcc/testsuite/gcc.c-torture/unsorted/fq.c new file mode 100644 index 000000000..c4ac36960 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/fq.c @@ -0,0 +1,25 @@ +expand_to_ascii (int *i, int *o) +{ + unsigned x, y, out; + unsigned x1; + + /* Big endian code. */ + + x = *i++; + + y = x >> (32 - 13); + out = (y / 91); + out = (out << 8) | (y % 91); + + x <<= 13; + y = x >> (32 - 13); + out = (out << 8) | (y / 91); + out = (out << 8) | (y % 91); + + *o++ = out + 0x20202020; + + /* 6 bits left in x. */ + + x1 = *i++; + x = (x << 26) | (x1 >> 6); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/g.c b/gcc/testsuite/gcc.c-torture/unsorted/g.c new file mode 100644 index 000000000..e00f1244f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/g.c @@ -0,0 +1,9 @@ +foo (a, b) + long long a, b; + +{ + if (a == b) + return 0; + else + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/gen_tst.c b/gcc/testsuite/gcc.c-torture/unsorted/gen_tst.c new file mode 100644 index 000000000..5a7a3763a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/gen_tst.c @@ -0,0 +1,67 @@ +/* Compiler Test Generator Program. + Copyright (C) 1989 FSF. */ + + +#define E0 ((type *)10000000) +#define reg0 r0 +#define indreg0 (*p0) +#define imm0 22 +#define limm0 ((type)(int)&glob0) +#define adr0 (*E0) +#define adrreg0 (p0[10000000]) +#define adrx0 (E0[x0]) +#define regx0 (p0[x0]) + +#define E1 ((type *)11111111) +#define reg1 r1 +#define indreg1 (*p1) +#define imm1 33 +#define limm1 ((type)(int)&glob1) +#define adr1 (*E1) +#define adrreg1 (p1[1111111/4]) +#define adrx1 (E1[x1]) +#define regx1 (p1[x1]) + +int glob0, glob1; + +#define type double + +char *a0[] = {"reg0", "indreg0", "imm0", "limm0", + "adr0", "adrreg0", "adrx0", "regx0"}; +char *a1[] = {"reg1", "indreg1", "imm1", "limm1", + "adr1", "adrreg1", "adrx1", "regx1"}; + +main_compare () +{ + int i0, i1; + + for (i0 = 0; i0 < 8; i0++) + { + for (i1 = 0; i1 < 8; i1++) + { + printf ("%s%s_cmp (r0, r1, x0, x1, p0, p1)\n", a0[i0], a1[i1]); + printf ("type r0, r1; type *p0, *p1;\n"); + printf ("{if (%s <= %s) return 1; else return 0;}\n\n", + a0[i0], a1[i1], a0[i0]); + } + } +} + +main_assign () +{ + int i0, i1; + + for (i0 = 0; i0 < 8; i0++) + { + if (i0 < 2 || i0 > 3) + for (i1 = 0; i1 < 8; i1++) + { + printf ("%s%s_set (r0, r1, x0, x1, p0, p1)\n", a0[i0], a1[i1]); + printf ("type r0, r1; type *p0, *p1;\n"); + printf ("{%s = %s; }\n\n", + a0[i0], a1[i1]); + } + } +} + +main () {main_assign ();} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/glob.c b/gcc/testsuite/gcc.c-torture/unsorted/glob.c new file mode 100644 index 000000000..e3206154f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/glob.c @@ -0,0 +1,12 @@ +typedef int tt; + +tt a1; +tt a2; +tt a3; + +foo () +{ + a1++; + a2++; + a1++; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/gronk.c b/gcc/testsuite/gcc.c-torture/unsorted/gronk.c new file mode 100644 index 000000000..c1bb767e5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/gronk.c @@ -0,0 +1,8 @@ +test_opt (a, b) + unsigned a, b; +{ + a = a / b; + if (a == 0) + a++; + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/hi.c b/gcc/testsuite/gcc.c-torture/unsorted/hi.c new file mode 100644 index 000000000..1624f7779 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/hi.c @@ -0,0 +1,5 @@ +foo (a, b) + short a, b; +{ + return a < b; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/hibug.c b/gcc/testsuite/gcc.c-torture/unsorted/hibug.c new file mode 100644 index 000000000..ad5c82679 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/hibug.c @@ -0,0 +1,15 @@ +struct foo +{ + short d; + int a; +}; + +int +bar (d, u) + short d; + struct foo u; +{ + + u.d = d; + return (int) (&u); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/i++.c b/gcc/testsuite/gcc.c-torture/unsorted/i++.c new file mode 100644 index 000000000..01d9ca95a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/i++.c @@ -0,0 +1,7 @@ +int main () +{ + int i = 2; + + i = i++; + printf ("%d\n",i); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/i.c b/gcc/testsuite/gcc.c-torture/unsorted/i.c new file mode 100644 index 000000000..3bee8eacb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/i.c @@ -0,0 +1,8 @@ +ase (p) + short *p; +{ + int a; + + a = *p; + *p = a + 1; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/ic.c b/gcc/testsuite/gcc.c-torture/unsorted/ic.c new file mode 100644 index 000000000..150e1e8ed --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/ic.c @@ -0,0 +1,7 @@ +foo (int *ip, int a) +{ + a++; + if (a < ip[a]) + return 1; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/icmp.c b/gcc/testsuite/gcc.c-torture/unsorted/icmp.c new file mode 100644 index 000000000..dc9678ec3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/icmp.c @@ -0,0 +1,10 @@ +foo (a, b) +{ + b++; + if (a <= b) + if ((int) a < (int) b) + b--; + else + b++; + return b; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/ifreg.c b/gcc/testsuite/gcc.c-torture/unsorted/ifreg.c new file mode 100644 index 000000000..9e2f9562e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/ifreg.c @@ -0,0 +1,12 @@ +union foo +{ + float f; + int i; +}; + +foo (int a, float c) +{ + union foo b; + b.i = a; + return b.f + c; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/imm.c b/gcc/testsuite/gcc.c-torture/unsorted/imm.c new file mode 100644 index 000000000..c3efba45e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/imm.c @@ -0,0 +1,7 @@ +int +imm () + +{ + return 11234; + +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/isinf.c b/gcc/testsuite/gcc.c-torture/unsorted/isinf.c new file mode 100644 index 000000000..12a828374 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/isinf.c @@ -0,0 +1,5 @@ +int +isinf () +{ + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/jmp.c b/gcc/testsuite/gcc.c-torture/unsorted/jmp.c new file mode 100644 index 000000000..474206a1f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/jmp.c @@ -0,0 +1,20 @@ +foo (a) +{ + if (a) + goto a1; + goto a2; + a1: goto a3; + a2: goto a4; + a3: goto a5; + a4: goto a6; + a5: goto a7; + a6: goto a8; + a7: goto a9; + a8: goto a10; + a9: goto a11; + a10: goto a12; + a11: goto a13; + a12:; + a13:; + return -a; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/jumptab.c b/gcc/testsuite/gcc.c-torture/unsorted/jumptab.c new file mode 100644 index 000000000..d86c30e40 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/jumptab.c @@ -0,0 +1,20 @@ +jumptab (a) +{ + int b; + switch (a) + { + case 0: + b = 6;break; + case 1: + b = 5;break; + case 2: + b = 4;break; + case 3: + b = 3;break; + case 4: + b = 2;break; + case 5: + b = 1;break; + } + return b; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/l.c b/gcc/testsuite/gcc.c-torture/unsorted/l.c new file mode 100644 index 000000000..cc23b190b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/l.c @@ -0,0 +1,4 @@ +main (a) +{ + return - 256 + a; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/layout.c b/gcc/testsuite/gcc.c-torture/unsorted/layout.c new file mode 100644 index 000000000..04c825df6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/layout.c @@ -0,0 +1,13 @@ +struct foo +{ + char a; +}; + +foo () +{ + struct foo bar[3]; + bar[0].a = '0'; + bar[1].a = '1'; + bar[2].a = '2'; + foof (bar); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/lbug.c b/gcc/testsuite/gcc.c-torture/unsorted/lbug.c new file mode 100644 index 000000000..0440a0a7a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/lbug.c @@ -0,0 +1,7 @@ +long long x = 0; +main() +{ + if (x--) + return 255; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/ll1.c b/gcc/testsuite/gcc.c-torture/unsorted/ll1.c new file mode 100644 index 000000000..9009e77b6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/ll1.c @@ -0,0 +1,5 @@ +long long +foo (long long a) +{ + return a + ((long long) 10230101 << 32) + 7561; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/llbug.c b/gcc/testsuite/gcc.c-torture/unsorted/llbug.c new file mode 100644 index 000000000..8c56dfbe7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/llbug.c @@ -0,0 +1,13 @@ +union foo +{ + long long d; +}; + +int +bar (long long d) +{ + union foo u; + + u.d = d; + return (int) &u; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/lll.c b/gcc/testsuite/gcc.c-torture/unsorted/lll.c new file mode 100644 index 000000000..dee9dc37d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/lll.c @@ -0,0 +1,45 @@ + +byte_match_count2 (buf, n, xm, m1, m2, m3, m4) + unsigned *buf; + unsigned n; + unsigned xm; + unsigned m1, m2, m3, m4; +{ + unsigned w, cnt = 0; + unsigned *bp; + + n /= 4; + + bp = buf; + while (bp < buf + n) + { + w = *bp++; + w ^= xm; + cnt += ((m1 & w) == 0); + cnt += ((m2 & w) == 0); + cnt += ((m3 & w) == 0); + cnt += ((m4 & w) == 0); + + w = *bp++; + w ^= xm; + cnt += ((m1 & w) == 0); + cnt += ((m2 & w) == 0); + cnt += ((m3 & w) == 0); + cnt += ((m4 & w) == 0); + + w = *bp++; + w ^= xm; + cnt += ((m1 & w) == 0); + cnt += ((m2 & w) == 0); + cnt += ((m3 & w) == 0); + cnt += ((m4 & w) == 0); + + w = *bp++; + w ^= xm; + cnt += ((m1 & w) == 0); + cnt += ((m2 & w) == 0); + cnt += ((m3 & w) == 0); + cnt += ((m4 & w) == 0); + } + return cnt; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/load8.c b/gcc/testsuite/gcc.c-torture/unsorted/load8.c new file mode 100644 index 000000000..947a8165c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/load8.c @@ -0,0 +1,4 @@ +foo () +{ + return *(short *) 126; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/loadhicc.c b/gcc/testsuite/gcc.c-torture/unsorted/loadhicc.c new file mode 100644 index 000000000..a7540894f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/loadhicc.c @@ -0,0 +1,15 @@ +typedef int xtype; + +foo (p, pc) + xtype *p; + char *pc; +{ + xtype a; + unsigned b = 0; + + a = *p; + p[1] = a; + if ((unsigned) p[1] > 0) + return 1; + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/log2.c b/gcc/testsuite/gcc.c-torture/unsorted/log2.c new file mode 100644 index 000000000..39b857840 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/log2.c @@ -0,0 +1,6 @@ +log2 (a, b) +{ + int c; + c = ~(~a & ~b); + return c; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/logic.c b/gcc/testsuite/gcc.c-torture/unsorted/logic.c new file mode 100644 index 000000000..a9d6e9d0c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/logic.c @@ -0,0 +1,37 @@ +logic (a, b) + int *a, b; +{ + if (*a & 123) + b = 1; + if (*a & ~222) + b = 2; + if (124 & *a) + b = 3; + if (~111 & *a) + b = 4; + + if (~*a & 23) + b = 1; + if (~*a & ~22) + b = 2; + if (24 & ~*a) + b = 3; + if (~11 & ~*a) + b = 4; + + if (~*a & b) + b = 1; + if (~*a & ~b) + b = 2; + if (*a & ~*a) + b = 3; + return b; +} + +x (a, b, c) +{ + for (a = 0; --a > 0;); + for (b = -1; --b > 0;); + for (c = -65536; --c > 0;); + return a + b + c; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/loop-1.c b/gcc/testsuite/gcc.c-torture/unsorted/loop-1.c new file mode 100644 index 000000000..e50687a9f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/loop-1.c @@ -0,0 +1,11 @@ +foo (a) +{ + while ((a -= 1) != -1) + bar (270000); + putchar ('\n'); +} + +main () +{ + foo (5); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/loop386.c b/gcc/testsuite/gcc.c-torture/unsorted/loop386.c new file mode 100644 index 000000000..429a320ab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/loop386.c @@ -0,0 +1,15 @@ +foo (a) +{ + do + { + puts ("a"); + a -= 1; + } + while (a != 0); +} + +main () +{ + int p[100]; + printf ("%d\n", foo (3)); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/lop.c b/gcc/testsuite/gcc.c-torture/unsorted/lop.c new file mode 100644 index 000000000..72464111d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/lop.c @@ -0,0 +1,6 @@ +lop (a) +{ + do + a--; + while (a >= -1); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/m1.c b/gcc/testsuite/gcc.c-torture/unsorted/m1.c new file mode 100644 index 000000000..8660f60c9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/m1.c @@ -0,0 +1,5 @@ +foo (p) + int *p; +{ + *p = 1234; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/m2.c b/gcc/testsuite/gcc.c-torture/unsorted/m2.c new file mode 100644 index 000000000..203c855b5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/m2.c @@ -0,0 +1,44 @@ +void +store16 (p, a) + short *p; + short a; +{ + *p = a; +} + +signed int +sign_extend16 (p) + signed short *p; +{ + return *p; +} + +unsigned int +zero_extend16 (p) + unsigned short *p; +{ + return *p; +} + +void +store8 (p, a) + char *p; + char a; +{ + *p = a; +} + +signed int +sign_extend8 (p) + signed char *p; +{ + return *p; +} + +unsigned int +zero_extend8 (p) + unsigned char *p; +{ + return *p; +} + diff --git a/gcc/testsuite/gcc.c-torture/unsorted/m5.c b/gcc/testsuite/gcc.c-torture/unsorted/m5.c new file mode 100644 index 000000000..23ad8445d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/m5.c @@ -0,0 +1,4 @@ +foo (a) +{ + return a * 5 + 12; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/m68.c b/gcc/testsuite/gcc.c-torture/unsorted/m68.c new file mode 100644 index 000000000..a1ee486d4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/m68.c @@ -0,0 +1,14 @@ +foo (a) +{ + return a | 12345; +} + +bar (a) +{ + return a & (0xffff0000 | 12345); +} + +foobar (a) +{ + return a - 128; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/mbyte.c b/gcc/testsuite/gcc.c-torture/unsorted/mbyte.c new file mode 100644 index 000000000..a8a23eab9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/mbyte.c @@ -0,0 +1,14 @@ +foo1 (p) + char *p; +{ + p[0] = p[1]; + return p[0]; +} + +foo2 (p, x) + char *p; +{ + p[0] = x; + return p[0]; +} + diff --git a/gcc/testsuite/gcc.c-torture/unsorted/mchar.c b/gcc/testsuite/gcc.c-torture/unsorted/mchar.c new file mode 100644 index 000000000..a1b106037 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/mchar.c @@ -0,0 +1,11 @@ +int +foo (char *a, char *b) +{ + int x; + *a = *b; + x = *b; + if ((char) x) + return 1; + else + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/mcmp.c b/gcc/testsuite/gcc.c-torture/unsorted/mcmp.c new file mode 100644 index 000000000..6008008e1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/mcmp.c @@ -0,0 +1,9 @@ +foo (ip, a, x) + int a; + int *ip; + int x; +{ + if (a >= 1) + x++; + return x; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/mdouble.c b/gcc/testsuite/gcc.c-torture/unsorted/mdouble.c new file mode 100644 index 000000000..992db2205 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/mdouble.c @@ -0,0 +1,6 @@ +double +foo (double a) +{ + + return 1.123486712; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/memtst.c b/gcc/testsuite/gcc.c-torture/unsorted/memtst.c new file mode 100644 index 000000000..b5ef26070 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/memtst.c @@ -0,0 +1,26 @@ +#ifdef STACK_SIZE +#define SIZE STACK_SIZE / 8 +#else +#define SIZE 65536 +#endif + +memtst (int *p, int a) +{ + do + { + if (p[a] == 1) + break; + } + while (--a); +} + +main () +{ + int a[SIZE]; + int i; + bzero (a, SIZE * 4); + for (i = 0; i < 100; i++) + { + memtst (a, SIZE); + } +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/miscomp.c b/gcc/testsuite/gcc.c-torture/unsorted/miscomp.c new file mode 100644 index 000000000..0bcb568d5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/miscomp.c @@ -0,0 +1,15 @@ +unsigned char foo(unsigned long); +main() +{ + unsigned char AChar; + unsigned long ALong = 0x12345678; + + AChar = foo(ALong); + + printf("AChar = %x\n",(int)AChar); +} +unsigned char +foo( unsigned long TheLong) +{ + return( (unsigned char) (TheLong & 0xff) ); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/mm.c b/gcc/testsuite/gcc.c-torture/unsorted/mm.c new file mode 100644 index 000000000..a8efaae21 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/mm.c @@ -0,0 +1,4 @@ +foo (a, b) +{ + return a * 2; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/mod.c b/gcc/testsuite/gcc.c-torture/unsorted/mod.c new file mode 100644 index 000000000..c33211dc7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/mod.c @@ -0,0 +1,4 @@ +foo (a, b) +{ + return a % b; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/modcc.c b/gcc/testsuite/gcc.c-torture/unsorted/modcc.c new file mode 100644 index 000000000..2574090e9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/modcc.c @@ -0,0 +1,4 @@ +foo (a, b) +{ + return (a % b) == 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/move.c b/gcc/testsuite/gcc.c-torture/unsorted/move.c new file mode 100644 index 000000000..78e00ff21 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/move.c @@ -0,0 +1,9 @@ +typedef char type; + +type +foo (b) +{ + type a; + for (a = 10; a < b; a++) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/move_qhi.c b/gcc/testsuite/gcc.c-torture/unsorted/move_qhi.c new file mode 100644 index 000000000..9bc9cb663 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/move_qhi.c @@ -0,0 +1,12 @@ +move (a, b) + char a, b; +{ + char s; + s = a; + if (s) + gurka (s); + foo (b, a); + a = bar (); + b = bar (); + gra (s); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/mregtst.c b/gcc/testsuite/gcc.c-torture/unsorted/mregtst.c new file mode 100644 index 000000000..b6bb6c21f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/mregtst.c @@ -0,0 +1,17 @@ +foo (a, p) + int *p; +{ + int old, new, i; + + old = 0; + for (i = 1; i < 100; i++) + { + new = p[i]; + if (new < old) + a++; + old = new; + if (old == 0) + return 0; + } + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/msp.c b/gcc/testsuite/gcc.c-torture/unsorted/msp.c new file mode 100644 index 000000000..5d350fd5e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/msp.c @@ -0,0 +1,10 @@ +#ifdef STACK_SIZE +# define A_SIZE (STACK_SIZE/sizeof(int)) +#else +# define A_SIZE 16384 +#endif +foo () +{ + int a[A_SIZE]; + bar (a); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/mtst.c b/gcc/testsuite/gcc.c-torture/unsorted/mtst.c new file mode 100644 index 000000000..4f43137b7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/mtst.c @@ -0,0 +1,17 @@ +foo (int *p, int c) +{ + int a, b; + a = p[0]; + b = p[1]; + c = p[2]; + if (b == 0) + goto foo1; + if (b < 0) + goto foo2;; + + return a + b + c; + foo1: + return 1; + foo2: + return 2; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/mu.c b/gcc/testsuite/gcc.c-torture/unsorted/mu.c new file mode 100644 index 000000000..c469a6e3a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/mu.c @@ -0,0 +1,4 @@ +foo (a, b) +{ + return a * b; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/mul.c b/gcc/testsuite/gcc.c-torture/unsorted/mul.c new file mode 100644 index 000000000..cc5d06b5f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/mul.c @@ -0,0 +1,5 @@ +void +mulqi (char *p, char a, char b) +{ + p[0] = a/b; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/mword.c b/gcc/testsuite/gcc.c-torture/unsorted/mword.c new file mode 100644 index 000000000..873e08868 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/mword.c @@ -0,0 +1,29 @@ +int +foo (a, b) +int *a, *b; +{ + int x, y; + x++; + *a = *b; + y = *b; + + if ((int) x) + return 1; + else + return y; +} + +foo1 (p) + int *p; +{ + p[0] = p[1]; + return p[0]; +} + +foo2 (p, x) + int *p; +{ + p[0] = x; + return p[0]; +} + diff --git a/gcc/testsuite/gcc.c-torture/unsorted/mword1.c b/gcc/testsuite/gcc.c-torture/unsorted/mword1.c new file mode 100644 index 000000000..690703eb8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/mword1.c @@ -0,0 +1,12 @@ +int +foo (a, b) +int *a, *b; +{ + int x; + *a = (*b + 1); + x = *b; + if ((int) x) + return 1; + else + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/n.c b/gcc/testsuite/gcc.c-torture/unsorted/n.c new file mode 100644 index 000000000..1a9a86974 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/n.c @@ -0,0 +1,6 @@ +char_autoincr (b1, c) + short *b1; + short c; +{ + *b1 = c; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/n1.c b/gcc/testsuite/gcc.c-torture/unsorted/n1.c new file mode 100644 index 000000000..dfa93cebe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/n1.c @@ -0,0 +1,10 @@ +foo (a, p) + long long a; + int *p; +{ + int b = (int)-a; + if (b > 32) + return 1; + else + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/nand.c b/gcc/testsuite/gcc.c-torture/unsorted/nand.c new file mode 100644 index 000000000..8228a3c3a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/nand.c @@ -0,0 +1,4 @@ +nadn (a, b) +{ + return (~a) | (~b); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/neg.c b/gcc/testsuite/gcc.c-torture/unsorted/neg.c new file mode 100644 index 000000000..c005b1327 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/neg.c @@ -0,0 +1 @@ +foo (a) {return -a;} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/o.c b/gcc/testsuite/gcc.c-torture/unsorted/o.c new file mode 100644 index 000000000..e8b78e383 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/o.c @@ -0,0 +1,12 @@ +foo (a, p) + char a; + int *p; +{ + int b = a; + *p = b; + a = (char) a; + if (a) + return b; + else + return b + 1; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/omit.c b/gcc/testsuite/gcc.c-torture/unsorted/omit.c new file mode 100644 index 000000000..f59d6ee8f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/omit.c @@ -0,0 +1,11 @@ +omit (a, b) + char a; + char *b; +{ + char x; + int i; + x = *b; + b[1] = x; + foo ((int)x); + return x + 1; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/opout.c b/gcc/testsuite/gcc.c-torture/unsorted/opout.c new file mode 100644 index 000000000..6d3736e05 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/opout.c @@ -0,0 +1,10 @@ +x () +{} + +y () +{} + +z (a, b) +{ + return (int) &a + (int) &b + (int) x + (int) z; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/opt.c b/gcc/testsuite/gcc.c-torture/unsorted/opt.c new file mode 100644 index 000000000..faad10e48 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/opt.c @@ -0,0 +1,5 @@ +int +foo (a) +{ + return (a == 2); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/or.c b/gcc/testsuite/gcc.c-torture/unsorted/or.c new file mode 100644 index 000000000..2a2e3b668 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/or.c @@ -0,0 +1,4 @@ +foo (a) +{ + return a | 0xffff0101; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/or386.c b/gcc/testsuite/gcc.c-torture/unsorted/or386.c new file mode 100644 index 000000000..ad49f3504 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/or386.c @@ -0,0 +1,13 @@ +typedef int xtype; + +xtype +foo (a) + xtype a; +{ + return a | 0x7f; +} + +main () +{ + printf ("%08x\n", foo (-1)); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/p.c b/gcc/testsuite/gcc.c-torture/unsorted/p.c new file mode 100644 index 000000000..465e74159 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/p.c @@ -0,0 +1,6 @@ +foo (a, b, p) + short *p; +{ + p[0] = a; + p[1] = b; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/parms.c b/gcc/testsuite/gcc.c-torture/unsorted/parms.c new file mode 100644 index 000000000..26c2c7017 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/parms.c @@ -0,0 +1,7 @@ +#define alloca __builtin_alloca + +x (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, x, y) +{ + foo (alloca (8)); + return a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+x+y; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/pass.c b/gcc/testsuite/gcc.c-torture/unsorted/pass.c new file mode 100644 index 000000000..6b663828a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/pass.c @@ -0,0 +1,13 @@ +int +foo (a, b, c) +{ + return a + b + c; +} + +int +bar () +{ + int q, w, e, r, t, y; + + return foo ((int) & q, q, w, e, q, (int) &w); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/pmt.c b/gcc/testsuite/gcc.c-torture/unsorted/pmt.c new file mode 100644 index 000000000..b6aced6ec --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/pmt.c @@ -0,0 +1,6 @@ +long long +foo (a, b) + long long a, b; +{ + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/poor.c b/gcc/testsuite/gcc.c-torture/unsorted/poor.c new file mode 100644 index 000000000..66d584aff --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/poor.c @@ -0,0 +1,34 @@ +typedef struct +{ + char c[510]; +} s510; + +typedef struct +{ + char c[511]; +} s511; + +s510 G510, s1; +s511 G511; +int I, J; +double D; + +void main(void); +void f0(double D, ...); +s510 f1(double D, ...); +void f2a(s510 S); +void f2b(s511 S); + + +void main(void) +{ + + f0(D, I, J); + + s1 = f1(D, I, D); + + f2a(G510); + + f2b(G511); + +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/pp.c b/gcc/testsuite/gcc.c-torture/unsorted/pp.c new file mode 100644 index 000000000..7d38d53de --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/pp.c @@ -0,0 +1,9 @@ +foo (a, b, c, d, e, i0, f, i1) + double a, b, c, d, e, f; + int i0, i1; +{} + +main () +{ + foo (1.0, 2.0, 3.0, 4.0, 5.0, 1, 6.0, 2); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/pret-arg.c b/gcc/testsuite/gcc.c-torture/unsorted/pret-arg.c new file mode 100644 index 000000000..a7fa85628 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/pret-arg.c @@ -0,0 +1,5 @@ +foo (a, b, c, d, e, f, g, h, i, j, xx) + double xx; +{ + return xx + 1.2345; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/pyr.c b/gcc/testsuite/gcc.c-torture/unsorted/pyr.c new file mode 100644 index 000000000..d25b2a99a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/pyr.c @@ -0,0 +1,11 @@ +foo (char *a) +{ + char b; + int c; + b = *a; + c = b; + if (c < 0) + return 1; + a[1] = b; + +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/pyr2.c b/gcc/testsuite/gcc.c-torture/unsorted/pyr2.c new file mode 100644 index 000000000..12e2ccd24 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/pyr2.c @@ -0,0 +1,4 @@ +foo (a) +{ + return ((int *)0)[a]; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/q.c b/gcc/testsuite/gcc.c-torture/unsorted/q.c new file mode 100644 index 000000000..fa08e758a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/q.c @@ -0,0 +1,7 @@ + +unsigned +reg0indreg1 (r0, p1) + unsigned short r0; unsigned short p1; +{ + return (r0 + p1); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/r.c b/gcc/testsuite/gcc.c-torture/unsorted/r.c new file mode 100644 index 000000000..19eeda7ab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/r.c @@ -0,0 +1,7 @@ +r (a, b) +{ + if (a < b) + return 1; + else + return 2; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/r1.c b/gcc/testsuite/gcc.c-torture/unsorted/r1.c new file mode 100644 index 000000000..0b277b0f8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/r1.c @@ -0,0 +1,29 @@ +void assert (a) {if (a != 1) abort ();} + +int h1 (int *p) {return *p & 255;} + +void p1 () {int a = 0x01020304; assert (h1 (&a) == 0x04);} + + +int h2 (a) {return a > 0;} + +p2 () {assert (h2 (1));} + +h3 (int *p) +{ + *p |= 255; +} + +p3 () +{ + int *p; + h3 (p); +} + +main () +{ + p1 (); + p2 (); + p3 (); + puts ("Compiler test passed."); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/rel.c b/gcc/testsuite/gcc.c-torture/unsorted/rel.c new file mode 100644 index 000000000..54d36052e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/rel.c @@ -0,0 +1,8 @@ +foo (int *c, int b) +{ + int a; + + a = *c + b; + c[1] = a; + return b; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/rmsc.c b/gcc/testsuite/gcc.c-torture/unsorted/rmsc.c new file mode 100644 index 000000000..5c97c6dae --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/rmsc.c @@ -0,0 +1,46 @@ + +cc1 (x, y) + int x, y; +{ + int z; + z = x - y; + if (x >= y) + return z + 1; + else + return z + 0; +} + +cc2 (x, y) + int x, y; +{ + int z; + + z = x - y; + if (z >= 0) + return z + 1; + else + return z + 0; +} + +cc3 (x, y) + unsigned x, y; +{ + unsigned z; + z = x - y; + if (x >= y) + return z + 1; + else + return z + 0; +} + +cc4 (x, y) + unsigned x, y; +{ + unsigned z; + + z = x - y; + if (z >= 0) + return z + 1; + else + return z + 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/round.c b/gcc/testsuite/gcc.c-torture/unsorted/round.c new file mode 100644 index 000000000..5233e65ea --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/round.c @@ -0,0 +1,13 @@ +foo (a) + double a; +{ + printf ("%d\n", (int) a); +} + +main () +{ + foo (1.6); + foo (1.4); + foo (-1.4); + foo (-1.6); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/run.c b/gcc/testsuite/gcc.c-torture/unsorted/run.c new file mode 100644 index 000000000..40892f603 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/run.c @@ -0,0 +1,11 @@ +main () +{ + typedef short int xtype; + + xtype i; + xtype ii; + + for (i = 0; i < 100; i++) + for (ii = 65535; --ii;) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/s.c b/gcc/testsuite/gcc.c-torture/unsorted/s.c new file mode 100644 index 000000000..e0c842622 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/s.c @@ -0,0 +1,24 @@ +struct foo +{ + int a, b, c, d; + double doubl; +} s1, s2; + +struct foo +structret (s1, i1, i2, s2) + struct foo s1, s2; + int i1, i2; +{ + if (i1 != i2) + { + if (i1 < i2) + return s1; + else + return s2; + } + s2.a = 11; + s2.b = 22; + s2.c = s1.c; + s2.d = s1.d; + return s2; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/sar.c b/gcc/testsuite/gcc.c-torture/unsorted/sar.c new file mode 100644 index 000000000..9bf9bec06 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/sar.c @@ -0,0 +1,10 @@ +struct foo +{ + char a; +} foo[100]; + +main () +{ + foo[1].a = '1'; + foo[2].a = '2'; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/sc.c b/gcc/testsuite/gcc.c-torture/unsorted/sc.c new file mode 100644 index 000000000..84dc60f7e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/sc.c @@ -0,0 +1,5 @@ +foo (a, b) + int a, b; +{ + return (a < 0) | (a <= 0) | (a == 0) | (a != 0) | (a >= 0) | (a > 0); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/scal.c b/gcc/testsuite/gcc.c-torture/unsorted/scal.c new file mode 100644 index 000000000..94e22aa80 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/scal.c @@ -0,0 +1,19 @@ +int g1, g2; + +void +write_at (addr, off, val) + int *addr; + int off; + int val; +{ + g2 = 1; + addr[off] = val; + g2++; +} + +main () +{ + g2 = 12; + write_at (&g1, &g2 - &g1, 12345); + printf ("%d\n", g2); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/scc.c b/gcc/testsuite/gcc.c-torture/unsorted/scc.c new file mode 100644 index 000000000..79ae4e12f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/scc.c @@ -0,0 +1,11 @@ +foo (a, b) +{ + if (a < 0) + goto ret1; + if (a == 0) + return 2; + return 3; + ret1: + return 1; +} + diff --git a/gcc/testsuite/gcc.c-torture/unsorted/scond.c b/gcc/testsuite/gcc.c-torture/unsorted/scond.c new file mode 100644 index 000000000..087b0a66e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/scond.c @@ -0,0 +1,4 @@ +scond (a, b, c, d) +{ + return (a > b) & (c < d); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/selfrec.c b/gcc/testsuite/gcc.c-torture/unsorted/selfrec.c new file mode 100644 index 000000000..c7aaca552 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/selfrec.c @@ -0,0 +1,5 @@ +int +foo (a) +{ + return foo (a - 1) * a; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/seq.c b/gcc/testsuite/gcc.c-torture/unsorted/seq.c new file mode 100644 index 000000000..0793228b4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/seq.c @@ -0,0 +1,4 @@ +foo (a) +{ + return a < 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/set386.c b/gcc/testsuite/gcc.c-torture/unsorted/set386.c new file mode 100644 index 000000000..c16ae8dbd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/set386.c @@ -0,0 +1,5 @@ +foo (a, p) + int *p; +{ + *p = a > 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/set88.c b/gcc/testsuite/gcc.c-torture/unsorted/set88.c new file mode 100644 index 000000000..8069ea622 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/set88.c @@ -0,0 +1,9 @@ +foo (a) +{ + return -1 << a; +} + +bar (a, b) +{ + return b | (-1 << a); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/sh.c b/gcc/testsuite/gcc.c-torture/unsorted/sh.c new file mode 100644 index 000000000..8d3265f83 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/sh.c @@ -0,0 +1,4 @@ +foo (a, b) +{ + return a << b; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/shand.c b/gcc/testsuite/gcc.c-torture/unsorted/shand.c new file mode 100644 index 000000000..5a4019613 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/shand.c @@ -0,0 +1,11 @@ +int +foo (x, c) + int x; +{ + return x >> 24 & 0xff; +} + +bar (x) +{ + return (int)(x & 0xfffff) << 13; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/shft.c b/gcc/testsuite/gcc.c-torture/unsorted/shft.c new file mode 100644 index 000000000..7d318c863 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/shft.c @@ -0,0 +1,15 @@ +foo (a) + int a; +{ + int b = 8; + + if ((a << b) >= 0) + return 1; + return a; +} + +main () +{ + if (foo (0x00ffffff) == 1) + puts ("y"); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/shift.c b/gcc/testsuite/gcc.c-torture/unsorted/shift.c new file mode 100644 index 000000000..1ed1879c6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/shift.c @@ -0,0 +1,7 @@ +foo (a) +{ + if (a >= 0) + return (unsigned) a << 10; + else + return (int) a << 10; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/shloop.c b/gcc/testsuite/gcc.c-torture/unsorted/shloop.c new file mode 100644 index 000000000..f4c936639 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/shloop.c @@ -0,0 +1,7 @@ +main () +{ + int volatile p; + int i; + for (i = 10000000; i > 0; i--) + p = i >> 10; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/shm.c b/gcc/testsuite/gcc.c-torture/unsorted/shm.c new file mode 100644 index 000000000..b667b26ab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/shm.c @@ -0,0 +1,5 @@ +foo (int *p) +{ + int a = *p; + return a >> 24; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/signext.c b/gcc/testsuite/gcc.c-torture/unsorted/signext.c new file mode 100644 index 000000000..2724098d0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/signext.c @@ -0,0 +1,27 @@ +void longprint (x) + long long x; +{ + printf (" %d, %d\n", (unsigned) ((unsigned long long) x >> 32), + (unsigned) x); +} + +void +k_min (p, qa, d) + int d; +{ + int s = 1; + long long x; + + if (s >= d) + s -= d; + + x = ((long long)((8 * s) % 3) + qa) % d; + longprint (x); +} + +int +main () +{ + k_min (100003, -600017, 3); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/signext2.c b/gcc/testsuite/gcc.c-torture/unsorted/signext2.c new file mode 100644 index 000000000..d2eb6370d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/signext2.c @@ -0,0 +1,11 @@ +long long +foo (a) + int a; +{ + return a; +} + +main () +{ + printf ("%d\n", (int) (foo (-1) >> 32)); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/sim.c b/gcc/testsuite/gcc.c-torture/unsorted/sim.c new file mode 100644 index 000000000..e8c4fb42f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/sim.c @@ -0,0 +1,7 @@ +main () +{ + int i; + + for (i = 1; i < 10000; i++) + ; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/simple.c b/gcc/testsuite/gcc.c-torture/unsorted/simple.c new file mode 100644 index 000000000..614acba82 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/simple.c @@ -0,0 +1,4 @@ +foo (a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/sne.c b/gcc/testsuite/gcc.c-torture/unsorted/sne.c new file mode 100644 index 000000000..6844a6e53 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/sne.c @@ -0,0 +1,4 @@ +foo (double a) +{ + return (a != 0); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/sound.c b/gcc/testsuite/gcc.c-torture/unsorted/sound.c new file mode 100644 index 000000000..be727e3fe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/sound.c @@ -0,0 +1,13 @@ + +main () +{ + char audio[8192]; + int i; + + for (i = 0; i < 4095; i += 1) + audio[i] = i / 8, + audio[8191 - i] = i / 8; + + for (;;) + write (1, audio, 8192); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/sparcbug.c b/gcc/testsuite/gcc.c-torture/unsorted/sparcbug.c new file mode 100644 index 000000000..cd42a86cc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/sparcbug.c @@ -0,0 +1,5 @@ +foo (a) +{ + int b = a; + return b + 8762345; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/speed.c b/gcc/testsuite/gcc.c-torture/unsorted/speed.c new file mode 100644 index 000000000..d61407e32 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/speed.c @@ -0,0 +1,8 @@ +main () +{ + int i; + + for (i = 5000000; i >=0; i--) + { + } +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/stor.c b/gcc/testsuite/gcc.c-torture/unsorted/stor.c new file mode 100644 index 000000000..57981eff5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/stor.c @@ -0,0 +1,12 @@ +#define C 1 + +foo (p) + int *p; +{ + p[0] = C; + p[1] = C; + p[2] = C; + p[3] = C; + p[4] = C; + p[5] = C; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/store0.c b/gcc/testsuite/gcc.c-torture/unsorted/store0.c new file mode 100644 index 000000000..3b7b16ef3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/store0.c @@ -0,0 +1,4 @@ +foo (int *p) +{ + p[10] = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/storecc.c b/gcc/testsuite/gcc.c-torture/unsorted/storecc.c new file mode 100644 index 000000000..116346910 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/storecc.c @@ -0,0 +1,6 @@ +foo (char *p, int a) +{ + *p = a; + if ((char) a) + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/str.c b/gcc/testsuite/gcc.c-torture/unsorted/str.c new file mode 100644 index 000000000..d2dec4b23 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/str.c @@ -0,0 +1,13 @@ +typedef struct +{ + char a; + char b; +} foo; + +bar () +{ + foo foobar[100]; + foobar[1].a = 'a'; + foobar[2].a = 'b'; + barfoo (foobar); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/stru.c b/gcc/testsuite/gcc.c-torture/unsorted/stru.c new file mode 100644 index 000000000..042c52217 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/stru.c @@ -0,0 +1,9 @@ +struct foo +{ + int a, b, c; +}; + +foo (struct foo *a) +{ + a[0] = a[1]; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/structret.c b/gcc/testsuite/gcc.c-torture/unsorted/structret.c new file mode 100644 index 000000000..9c705d4c0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/structret.c @@ -0,0 +1,69 @@ +struct foo +{ + int a, b, c, d; + double doubl; +} s1, s2; + +#ifndef ONLY2 + +struct foo +structret (s1, i1, i2, s2) + struct foo s1, s2; + int i1, i2; +{ + if (i1 != i2) + { + if (i1 < i2) + return s1; + else + return s2; + } + s2.a = 11; + s2.b = 22; + s2.c = s1.c; + s2.d = s1.d; + return s2; +} + +#endif + +#ifndef ONLY1 + +struct foo +mani (a, b) +{ + return structret (s1, a, b, s2); +} + +init () +{ + s1.a = 1; + s1.b = 2; + s1.c = 3; + s1.d = 4; + s1.doubl = 3.1415; + s2.a = -1; + s2.b = -2; + s2.c = -3; + s2.d = -4; + s2.doubl = 2.71818; +} + +main () +{ + struct foo s; + + init (); + s = mani (1, 1); + printf ("%d, %d, %d, %d : %f\n", s.a, s.b, s.c, s.d, s.doubl); + + init (); + s = mani (2, 1); + printf ("%d, %d, %d, %d : %f\n", s.a, s.b, s.c, s.d, s.doubl); + + init (); + s = mani (1, 2); + printf ("%d, %d, %d, %d : %f\n", s.a, s.b, s.c, s.d, s.doubl); +} + +#endif diff --git a/gcc/testsuite/gcc.c-torture/unsorted/stuct.c b/gcc/testsuite/gcc.c-torture/unsorted/stuct.c new file mode 100644 index 000000000..deb838d80 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/stuct.c @@ -0,0 +1,22 @@ +#ifdef STACK_SIZE +#define SIZE STACK_SIZE / 8 +#else +#define SIZE 10000000 +#endif + +struct foo +{ + int a, b, c; + int arr[SIZE]; +}; + +struct foo s, ss; + +main () +{ + + s.b = 2; + s.c = 3; + ss.b = 2; + ss.c = 3; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/sub32.c b/gcc/testsuite/gcc.c-torture/unsorted/sub32.c new file mode 100644 index 000000000..93114d96c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/sub32.c @@ -0,0 +1,4 @@ +foo (a) +{ + return a + 32; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/subcc.c b/gcc/testsuite/gcc.c-torture/unsorted/subcc.c new file mode 100644 index 000000000..d89b50dbd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/subcc.c @@ -0,0 +1,33 @@ +int foo (a, c) +{ + int b; + + if (a + c >= 0) /* b < 0 ==== a < 10? */ + return a | 0x80000000; + return 0; +} + +void bar (a) + int a; +{ + if (foo (a, 10) & 0x80000000) + printf ("y"); + else + printf ("n"); +} + +int main () +{ + bar (0); + bar (1); + bar (-1); + bar (10); + bar (-10); + bar (11); + bar (-11); + bar (0x7fffffff); + bar (-0x7fffffff); + + puts (""); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/subcse.c b/gcc/testsuite/gcc.c-torture/unsorted/subcse.c new file mode 100644 index 000000000..0a10991f1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/subcse.c @@ -0,0 +1,6 @@ +foo (a, b, p) + int *p; +{ + p[0] = 1230 - a; + p[1] = 1230 - b; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/sym.c b/gcc/testsuite/gcc.c-torture/unsorted/sym.c new file mode 100644 index 000000000..8a0fe323b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/sym.c @@ -0,0 +1,4 @@ +foo () +{ + return (int) &foo; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/symconst.c b/gcc/testsuite/gcc.c-torture/unsorted/symconst.c new file mode 100644 index 000000000..7add21810 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/symconst.c @@ -0,0 +1,4 @@ +foo () +{ + return (int)foo; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/t.c b/gcc/testsuite/gcc.c-torture/unsorted/t.c new file mode 100644 index 000000000..48095e7c3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/t.c @@ -0,0 +1,18 @@ +#define B 95 + +foo (a, b, p) + unsigned a, b; + int *p; +{ + p[1] = a % B; + p[0] = a / B; +} + +bar (a, b, p) + unsigned a, b; + int *p; +{ + p[0] = a / B; + p[1] = a % B; +} + diff --git a/gcc/testsuite/gcc.c-torture/unsorted/test-flow.c b/gcc/testsuite/gcc.c-torture/unsorted/test-flow.c new file mode 100644 index 000000000..01ec724eb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/test-flow.c @@ -0,0 +1,12 @@ +foo (a, b, c, d) +{ + if (a < 0) + { + b = c; + } + else + { + b = d; + } + return b + 75; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/test-loop.c b/gcc/testsuite/gcc.c-torture/unsorted/test-loop.c new file mode 100644 index 000000000..d441dde0c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/test-loop.c @@ -0,0 +1,7 @@ +main () +{ + int i; + for (i = 100; i >= -1; i--) + foo (); + +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/test.c b/gcc/testsuite/gcc.c-torture/unsorted/test.c new file mode 100644 index 000000000..46e830a35 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/test.c @@ -0,0 +1,6 @@ +foo (a) +{ + if (a & 38) + return 1; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/time.c b/gcc/testsuite/gcc.c-torture/unsorted/time.c new file mode 100644 index 000000000..7e22681d9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/time.c @@ -0,0 +1,7 @@ +main () +{ + int i; + for (i = 3000000; --i;) + { + } +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/tmp.c b/gcc/testsuite/gcc.c-torture/unsorted/tmp.c new file mode 100644 index 000000000..463d9fb53 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/tmp.c @@ -0,0 +1,5 @@ +foo (a, b) +{ + return (a - b) == 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/unsorted/trivial.c b/gcc/testsuite/gcc.c-torture/unsorted/trivial.c new file mode 100644 index 000000000..e9665cd8d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/trivial.c @@ -0,0 +1 @@ +foo () {} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/trunc.c b/gcc/testsuite/gcc.c-torture/unsorted/trunc.c new file mode 100644 index 000000000..dee0e1587 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/trunc.c @@ -0,0 +1,11 @@ +main () +{ + printf ("%x, %x\n", (unsigned char) main, main); +} + +foo (p) + char *p; +{ + p[0] = (char)foo; + p[1] = (char)foo; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/u.c b/gcc/testsuite/gcc.c-torture/unsorted/u.c new file mode 100644 index 000000000..7fc0dda37 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/u.c @@ -0,0 +1 @@ +foo (a, b) { return a % b; } diff --git a/gcc/testsuite/gcc.c-torture/unsorted/udconvert.c b/gcc/testsuite/gcc.c-torture/unsorted/udconvert.c new file mode 100644 index 000000000..31b494fe0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/udconvert.c @@ -0,0 +1,30 @@ +double +unsigned_to_double1 (u) + unsigned u; +{ + double d; + d = (int) u; /* convert as from a *signed* integer */ + return ((int) u < 0) + ? d + 4294967296.0 + : d; +} + +/* Alternatively */ + +double +unsigned_to_double2 (u) + unsigned u; +{ + double d; + u -= 2147483648; /* complement sign bit */ + d = (int) u; /* convert as from a *signed* integer */ + return d + 2147483648.0; +} + +unsigned +double_to_unsigned (d) + double d; +{ + d += 2147483648.0; + return ((int) d) - 2147483648; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/udivmod4.c b/gcc/testsuite/gcc.c-torture/unsorted/udivmod4.c new file mode 100644 index 000000000..40d2fa8d0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/udivmod4.c @@ -0,0 +1,56 @@ +long long +xlrandom () +{ + long long x; + unsigned a; + int bits = 64; + unsigned b; + + do + { + a = random (); + b = (a & 15) + 1; + x <<= b; /* shift up 1-16 steps */ + a = (a >> 18) & 1; + if (a) + x |= (unsigned) (1 << b) - 1; + bits -= b; + } + while (bits >= 0); + return x; +} + + +unsigned long long __udivmoddi4(); + +main () +{ + int i; + unsigned long long n, d, q, r, rr; + + for (i = 0; ;i++) + { + n = xlrandom (); + d = xlrandom (); + if (d == 0) + continue; + + q = __udivmoddi4 (n, d, &r); + + if (i % 1000000 == 0) + printf ("Testing udivmoddi4: %d iterations made\n", i); + + rr = n - q * d; + if (rr != r || r >= d) + { + printf ("Testing udivmoddi4: failure after %d iterations\n", i); + printf ("n=%lX%08lX\n", (unsigned) (n >> 32), (unsigned) n); + printf ("d=%lX%08lX\n", (unsigned) (d >> 32), (unsigned) d); + printf ("q=%lX%08lX\n", (unsigned) (q >> 32), (unsigned) q); + printf ("r=%lX%08lX\n", (unsigned) (r >> 32), (unsigned) r); + printf ("rr=%lX%08lX\n", (unsigned) (rr >> 32), (unsigned) rr); + abort (); + } + } + +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/uns.c b/gcc/testsuite/gcc.c-torture/unsorted/uns.c new file mode 100644 index 000000000..314704f89 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/uns.c @@ -0,0 +1,5 @@ +foo (a) +{ + if ((unsigned) a < 234) + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/uns_tst.c b/gcc/testsuite/gcc.c-torture/unsorted/uns_tst.c new file mode 100644 index 000000000..e34ffaf30 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/uns_tst.c @@ -0,0 +1,19 @@ +a (c) + unsigned char c; +{ + unsigned u = c; + if ((int)u < 0) + return 1; + else + return 0; +} + +b (x, y) + unsigned x, y; +{ + x /= y; + if ((int)x < 0) + return 1; + else + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp b/gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp new file mode 100644 index 000000000..def4bc5af --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp @@ -0,0 +1,60 @@ +# +# Expect driver script for GCC Regression Tests +# Copyright (C) 1993, 1997, 2007, 2008 Free Software Foundation +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . +# +# Written by Jeffrey Wheat (cassidy@cygnus.com) +# + +# +# These tests come from Torbjorn Granlund's (tege@cygnus.com) +# C torture test suite, and other contributors. +# + +if $tracelevel then { + strace $tracelevel +} + +# load support procs +load_lib c-torture.exp +load_lib torture-options.exp + +torture-init +set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS + +# +# This loop will run c-torture on any *.c file found in this directory. +# If a *.c has a corresponding *.exp file, then the test is skipped as +# as the *.exp will drive the test itself. It is done this way so that +# generic tests do not need a separate .exp for it. Only the tests that +# require unique options need their own .exp file. +# + +foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.c]] { + if [file exists [file rootname $testcase].exp] then { + verbose "INFO:\"[file rootname $testcase].exp\" exists, skipping test" 3 + continue + } + + # If we're only testing specific files and this isn't one of them, skip it. + if ![runtest_file_p $runtests $testcase] then { + continue + } + + c-torture $testcase +} + +torture-finish diff --git a/gcc/testsuite/gcc.c-torture/unsorted/uuarg.c b/gcc/testsuite/gcc.c-torture/unsorted/uuarg.c new file mode 100644 index 000000000..8928b3e07 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/uuarg.c @@ -0,0 +1,4 @@ +foo (a, b, c, d, e, f, g, h, i) +{ + return foo () + i; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/v.c b/gcc/testsuite/gcc.c-torture/unsorted/v.c new file mode 100644 index 000000000..87ac00aef --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/v.c @@ -0,0 +1,11 @@ +main (int *p) +{ + int a; + + a = 0; + p[1] = a; + a = 0; + p[2] = a; + a = 123456; + p[3] = a; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/w.c b/gcc/testsuite/gcc.c-torture/unsorted/w.c new file mode 100644 index 000000000..1acfe1512 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/w.c @@ -0,0 +1 @@ +int foo (unsigned short a, unsigned short b) { return a + b; } diff --git a/gcc/testsuite/gcc.c-torture/unsorted/ww.c b/gcc/testsuite/gcc.c-torture/unsorted/ww.c new file mode 100644 index 000000000..657f8c6b8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/ww.c @@ -0,0 +1,7 @@ +foo (p) + short *p; +{ + static int *foo; + *p = 1234; + *foo = 1234; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/x.c b/gcc/testsuite/gcc.c-torture/unsorted/x.c new file mode 100644 index 000000000..baf98960c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/x.c @@ -0,0 +1 @@ +f(m){int i,s=0;for(i=0;i 10); + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/xmtst.c b/gcc/testsuite/gcc.c-torture/unsorted/xmtst.c new file mode 100644 index 000000000..ca78fcaac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/xmtst.c @@ -0,0 +1,26 @@ +p1 (int b, int *p, int a) +{ + p[0] = p[1]; + return p[0]; +} +p2 (int b, int *p, int a) +{ + p[0] = p[1]; + return p[0] == 0; +} +p3 (int b, int *p, int a) +{ + p[0] = p[1]; + a = p[0]; + if (a) + return 0; + return a; +} +p4 (int b, int *p, int a) +{ + a = p[1]; + p[0] = p[1]; + if (a) + return 0; + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/xneg.c b/gcc/testsuite/gcc.c-torture/unsorted/xneg.c new file mode 100644 index 000000000..ff5b85034 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/xneg.c @@ -0,0 +1,5 @@ +foo (a) + double a; +{ + return -a; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/xopt.c b/gcc/testsuite/gcc.c-torture/unsorted/xopt.c new file mode 100644 index 000000000..b1a50f86c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/xopt.c @@ -0,0 +1,35 @@ +proc1 (a) + unsigned a; +{ + return (a >> 20) & 0x010fffff; +} + +proc2 (a) + unsigned a; +{ + return (a << 17) & 0xfffff001; +} + +proc3 (a) + unsigned a; +{ + return (a & 0xff00000a) >> 25; +} + +proc4 (a) + unsigned a; +{ + return (a & 0x100000ff) << 25; +} + +proc5 (a) + unsigned a; +{ + return (unsigned char) (a >> 24); +} + +proc6 (a) + unsigned a; +{ + return ((unsigned char) a) << 30; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/xor.c b/gcc/testsuite/gcc.c-torture/unsorted/xor.c new file mode 100644 index 000000000..435f2231e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/xor.c @@ -0,0 +1,4 @@ +foo (a, b) +{ + return ~(a ^ ~123); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/xorn.c b/gcc/testsuite/gcc.c-torture/unsorted/xorn.c new file mode 100644 index 000000000..d7b75f936 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/xorn.c @@ -0,0 +1,31 @@ +int +xorn (a, b) + int a, b; +{ + return a ^ ~b; +} + +int +not (a) + int a; +{ + return ~a; +} + +int +xor (a, b) + int a, b; +{ + return a ^ b; +} + +main () +{ + int i, j; + + for (i = 0; i <= 1; i++) + for (j = 0; j <= 1; j++) + printf ("%d op %d = %d = %d?\n", i, j, + 1 & xor (i, not (j)), + 1 & xorn (i, j)); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/xp.c b/gcc/testsuite/gcc.c-torture/unsorted/xp.c new file mode 100644 index 000000000..139335c02 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/xp.c @@ -0,0 +1,4 @@ +foo (a) +{ + return a & 255; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/xpp.c b/gcc/testsuite/gcc.c-torture/unsorted/xpp.c new file mode 100644 index 000000000..daf3399a3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/xpp.c @@ -0,0 +1,12 @@ +foo (a) +{ + a++; + if (a < 10) + return 1; + return a; +} + +main () +{ + printf ("%d\n", foo ((1 << 31) - 1)); +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/xs.c b/gcc/testsuite/gcc.c-torture/unsorted/xs.c new file mode 100644 index 000000000..24f773e75 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/xs.c @@ -0,0 +1,9 @@ +foo (a, b) +{ + for (b = 0; b < 10; b++) + ; + for (a = 0; a < 10; a++) + ; + a = b << 1; + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/xsh.c b/gcc/testsuite/gcc.c-torture/unsorted/xsh.c new file mode 100644 index 000000000..9ba0b6c9e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/xsh.c @@ -0,0 +1,7 @@ +foo (a, b) +{ + a = b + b; + if (a) + return a; + return b; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/xz.c b/gcc/testsuite/gcc.c-torture/unsorted/xz.c new file mode 100644 index 000000000..97a1d1e2c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/xz.c @@ -0,0 +1,4 @@ +foo (int *p) +{ + *p = (unsigned short) *p; +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/xzz.c b/gcc/testsuite/gcc.c-torture/unsorted/xzz.c new file mode 100644 index 000000000..f1972b6c6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/xzz.c @@ -0,0 +1,4 @@ +foo (a, b) +{ + return a >> (char) b; +} -- cgit v1.2.3