aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/torture
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
committerBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
commit1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch)
treec607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/g++.dg/torture
parent283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff)
downloadtoolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/torture')
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/20070621-1.C117
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/20080625-1.C27
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/20090329-1.C59
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/20090706-1.C41
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/20100702-1.C37
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/20100825.C15
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/20120420-1.C29
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/20121105-1.C44
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/PR58294.C20
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/Wsizeof-pointer-memaccess1.C716
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/Wsizeof-pointer-memaccess2.C730
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/builtin-location.C31
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/covariant-1.C33
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/darwin-cfstring-3.C30
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/dg-torture.exp7
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/ipa-cp-1.C18
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr27218.C16
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr30252.C226
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr30567.C32
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr31081-1.C23
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr31081-2.C48
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr31579.C10
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr31863.C778
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr32304.C9
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr32563.C8
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr32950.C19
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr33134.C21
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr33340.C27
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr33572.C17
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr33589-1.C22
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr33589-2.C13
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr33627.C57
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr33735.C21
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr33819.C22
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr33887-1.C44
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr33887-2.C21
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr33887-3.C26
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr34099.C25
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr34222.C65
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr34235.C11
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr34241.C18
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr34641.C177
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr34651.C25
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr34850.C76
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr34953.C17
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr35164-1.C69
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr35164-2.C27
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr35400.C13
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr35526.C20
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr35634.C19
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr36191.C17
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr36444.C22
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr36445.C23
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr36745.C122
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr36826.C166
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr36960.C22
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr37146-1.C83
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr37146-2.C67
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr37343.C19
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr37345.C15
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr37354.C14
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr37421.C39
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr37456.C14
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr37716.C56
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr37922.C502
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr38565.C12
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr38705.C27
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr38745.C36
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr38747.C19
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr38811.C73
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr39002.C88
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr39259.C40
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr39362.C105
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr39417.C56
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr39678.C26
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr39713.C25
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr39732.C30
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr39764.C14
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr40081.C16
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr40102.C41
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr40321.C25
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr40323.C68
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr40335.C16
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr40388.C21
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr40389.C84
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr40460.C9
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr40492.C26
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr40642.C27
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr40834.C52
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr40924.C111
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr40991.C113
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr41144.C23
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr41183.C30
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr41186.C29
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr41257-2.C16
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr41257.C20
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr41273.C18
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr41680.C23
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr41775.C284
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr42110.C27
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr42183.C51
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr42357.C30
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr42450.C112
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr42462.C47
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr42704.C44
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr42714.C37
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr42739.C16
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr42760.C46
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr42773.C54
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr42871.C40
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr42883.C63
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr42890.C25
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr43068.C10
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr43257.C30
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr43611.C22
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr43784.C24
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr43801.C22
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr43879-1_0.C11
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr43879-1_1.C48
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr43880.C16
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr43905.C13
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr44069.C25
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr44148.C60
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr44206.C21
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr44295.C170
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr44357.C228
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr44492.C31
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr44535.C34
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr44809.C6
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr44813.C60
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr44826.C44
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr44900.C76
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr44915.C13
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr44972.C142
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr45393.C38
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr45580.C50
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr45699.C61
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr45709-2.C20
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr45709.C19
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr45843.C28
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr45854.C30
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr45874.C58
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr45875.C25
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr45877.C141
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr45934.C23
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr46111.C32
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr46149.C51
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr46154.C17
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr46287.C66
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr46364.C20
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr46367.C11
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr46383.C252
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr46469.C13
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr47290.C19
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr47313.C53
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr47382.C30
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr47541.C27
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr47559.C8
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr47714.C16
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr48165.C38
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr48271.C119
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr48600.C16
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr48661.C77
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr48695.C38
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr48954.C30
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr49039.C76
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr49115.C25
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr49394.C50
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr49519.C135
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr49615.C29
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr49628.C37
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr49644.C17
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr49720.C10
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr49770.C86
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr49938.C48
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr50189.C121
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr50672.C22
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr51198.C29
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr51344.C11
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr51436.C60
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr51482.C30
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr51600.C16
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr51737.C30
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr51903.C9
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr51959.C80
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr52582.C23
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr52638.C15
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr52772.C85
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr52918-1.C39
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr52918-2.C40
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr53011.C66
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr53085.C17
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr53161.C22
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr53321.C36
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr53336.C45
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr53364.C37
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr53602.C364
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr53693.C21
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr53752.C156
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr53970.C17
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr54563.C14
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr54647.C25
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr54684.C63
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr54735.C179
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr54838.C102
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr54902.C131
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr55260-1.C24
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr55260-2.C16
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr55355.C23
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr55740.C19
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr55789.C30
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr55875.C55
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr56029.C126
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr56302.C41
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr56398.C22
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr56403.C12
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr56635.C17
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr56694.C31
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr56768.C40
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr56817.C38
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr56837.C20
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr56854.C24
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr57107.C193
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr57140.C186
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr57190.C42
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr57235.C156
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr57499.C14
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr58201.h24
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr58201_0.C9
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr58201_1.C10
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr58252.C142
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr58369.C109
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr58380.C173
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr58464.C268
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr58552.C29
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr58555.C114
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr58585.C20
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr59163.C30
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr59208.C25
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr59226.C27
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr59265.C22
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr59775.C21
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr59822.C14
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr59882.C30
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr59918.C18
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr60058.C30
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr60131.C23
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr60438-1.C26
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr60438-2.C3
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pr60474.C16
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/predcom-1.C29
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/pushpop_macro.C19
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/check.h36
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-alloca-1.C57
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-fastcall-1.C43
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-global-1.C40
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-1.C40
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-2.C58
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-thiscall-1.C43
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-1.C73
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-2.C79
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/stackalign.exp57
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/stdcall-1.C17
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/test-unwind.h142
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/throw-1.C62
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/throw-2.C53
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/throw-3.C52
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/throw-4.C55
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-0.C12
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-1.C16
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-2.C29
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-3.C35
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-4.C17
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-5.C31
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-6.C31
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/str_empty.C15
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/type-generic-1.C13
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-16.inc50
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-2.inc22
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-4.inc25
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-8.inc56
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-main.inc28
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v16hi.C7
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v16qi.C7
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v2df.C16
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v2di.C17
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v2sf.C22
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v2si.C19
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v4df.C21
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v4di.C21
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v4sf.C28
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v4si.C24
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v8hi.C25
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v8qi.C25
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v8si.C32
295 files changed, 16213 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/20070621-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/20070621-1.C
new file mode 100644
index 000000000..15d1ac74c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/20070621-1.C
@@ -0,0 +1,117 @@
+// { dg-do compile }
+/* Reduced from libstdc++-v3/testsuite/25_algorithms/equal/1.cc
+
+1.2.ii: In function 'void test1()':
+1.2.ii:104: error: true/false edge after a non-COND_EXPR in bb 15
+1.2.ii:104: internal compiler error: verify_flow_info failed
+
+*/
+
+__extension__ typedef __PTRDIFF_TYPE__ ptrdiff_t;
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<typename, typename> struct __are_same {
+ enum {
+ __value = 0 };
+ };
+ template<typename _Tp> struct __is_integer {
+ enum {
+ __value = 0 };
+ };
+ template<typename _Tp> struct __is_pointer {
+ enum {
+ __value = 0 };
+ };
+ template<typename _Tp> struct __is_normal_iterator {
+ enum {
+ __value = 0 };
+ };
+ struct input_iterator_tag {
+ };
+ template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t, typename _Pointer = _Tp*, typename _Reference = _Tp&> struct iterator {
+ typedef _Tp value_type;
+ };
+ template<typename _Iterator> struct iterator_traits {
+ typedef typename _Iterator::value_type value_type;
+ };
+ template<typename _Iterator, bool _BoolType = __is_normal_iterator<_Iterator>::__value> struct __niter_base {
+ static const _Iterator& __b(const _Iterator& __it) {
+ return __it;
+ }
+ };
+ template<bool _BoolType> struct __equal {
+ template<typename _II1, typename _II2> static bool equal(_II1 __first1, _II1 __last1, _II2 __first2) {
+ for (;
+ __first1 != __last1;
+ ++__first1, ++__first2) if (!(*__first1 == *__first2)) return false;
+ }
+ };
+ template<typename _II1, typename _II2> inline bool __equal_aux(_II1 __first1, _II1 __last1, _II2 __first2) {
+ typedef typename iterator_traits<_II1>::value_type _ValueType1;
+ typedef typename iterator_traits<_II2>::value_type _ValueType2;
+ const bool __simple = (__is_integer<_ValueType1>::__value && __is_pointer<_II1>::__value && __is_pointer<_II2>::__value && __are_same<_ValueType1, _ValueType2>::__value);
+ return std::__equal<__simple>::equal(__first1, __last1, __first2);
+ }
+ template<typename _II1, typename _II2> inline bool equal(_II1 __first1, _II1 __last1, _II2 __first2) {
+ return std::__equal_aux(__niter_base<_II1>::__b(__first1), __niter_base<_II1>::__b(__last1), __niter_base<_II2>::__b(__first2));
+ }
+ }
+extern "C" {
+ extern void __assert_fail (__const char *__assertion, __const char *__file, unsigned int __line, __const char *__function) throw () __attribute__ ((__noreturn__));
+ }
+namespace __gnu_test {
+ template<typename T> struct BoundsContainer {
+ T* first;
+ T* last;
+ BoundsContainer(T* _first, T* _last) : first(_first), last(_last) {
+ }
+ };
+ template<class T> class input_iterator_wrapper:public std::iterator <std::input_iterator_tag, T, ptrdiff_t, T*, T&> {
+ public:
+ typedef BoundsContainer<T> ContainerType;
+ T* ptr;
+ ContainerType* SharedInfo;
+ input_iterator_wrapper(T* _ptr, ContainerType* SharedInfo_in) : ptr(_ptr), SharedInfo(SharedInfo_in) {
+ }
+ bool operator==(const input_iterator_wrapper& in) const {
+ (static_cast<void> (__builtin_expect (!!(SharedInfo != __null && SharedInfo == in.SharedInfo), 1) ? 0 : (__assert_fail ("SharedInfo != __null && SharedInfo == in.SharedInfo", "/abuild/rguenther/gcc/libstdc++-v3/testsuite/util/testsuite_iterators.h", 201, __PRETTY_FUNCTION__), 0)));
+ (static_cast<void> (__builtin_expect (!!(ptr>=SharedInfo->first && in.ptr>=SharedInfo->first), 1) ? 0 : (__assert_fail ("ptr>=SharedInfo->first && in.ptr>=SharedInfo->first", "/abuild/rguenther/gcc/libstdc++-v3/testsuite/util/testsuite_iterators.h", 202, __PRETTY_FUNCTION__), 0)));
+ }
+ bool operator!=(const input_iterator_wrapper& in) const {
+ return !(*this == in);
+ }
+ T& operator*() const {
+ (static_cast<void> (__builtin_expect (!!(SharedInfo && ptr < SharedInfo->last), 1) ? 0 : (__assert_fail ("SharedInfo && ptr < SharedInfo->last", "/abuild/rguenther/gcc/libstdc++-v3/testsuite/util/testsuite_iterators.h", 215, __PRETTY_FUNCTION__), 0)));
+ (static_cast<void> (__builtin_expect (!!(ptr >= SharedInfo->first), 1) ? 0 : (__assert_fail ("ptr >= SharedInfo->first", "/abuild/rguenther/gcc/libstdc++-v3/testsuite/util/testsuite_iterators.h", 216, __PRETTY_FUNCTION__), 0)));
+ }
+ input_iterator_wrapper& operator++() {
+ (static_cast<void> (__builtin_expect (!!(SharedInfo && ptr < SharedInfo->last), 1) ? 0 : (__assert_fail ("SharedInfo && ptr < SharedInfo->last", "/abuild/rguenther/gcc/libstdc++-v3/testsuite/util/testsuite_iterators.h", 237, __PRETTY_FUNCTION__), 0)));
+ ptr++;
+ SharedInfo->first=ptr;
+ }
+ };
+ template <class T, template<class T> class ItType> struct test_container {
+ typename ItType<T>::ContainerType bounds;
+ test_container(T* _first, T* _last):bounds(_first, _last) {
+ }
+ ItType<T> it(T* pos) {
+ return ItType<T>(pos, &bounds);
+ }
+ ItType<T> begin() {
+ return it(bounds.first);
+ }
+ ItType<T> end() {
+ }
+ };
+ }
+using __gnu_test::test_container;
+using __gnu_test::input_iterator_wrapper;
+typedef test_container<int, input_iterator_wrapper> Container;
+int array1[] = {
+ 0, 1};
+int array2[] = {
+ 1, 0};
+void test1() {
+ Container con1(array1, array1);
+ Container con2(array2, array2);
+ (static_cast<void> (__builtin_expect (!!(std::equal(con1.begin(), con1.end(), con2.begin())), 1) ? 0 : (__assert_fail ("std::equal(con1.begin(), con1.end(), con2.begin())", "/abuild/rguenther/gcc/libstdc++-v3/testsuite/25_algorithms/equal/1.cc", 35, __PRETTY_FUNCTION__), 0)));
+ }
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/20080625-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/20080625-1.C
new file mode 100644
index 000000000..b18c28226
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/20080625-1.C
@@ -0,0 +1,27 @@
+extern "C" {
+ typedef unsigned char sal_Bool;
+ typedef struct _rtl_uString {
+ } rtl_uString;
+ void rtl_uString_release( rtl_uString * str ) throw ();
+}
+class OUString {
+ rtl_uString * pData;
+public:
+ OUString() {}
+ ~OUString() {
+ rtl_uString_release( pData );
+ }
+ sal_Bool equalsIgnoreAsciiCase( const OUString & str ) const;
+};
+bool findAndRemove();
+long getAttributeProps()
+{
+ long nAttrs = 0;
+ OUString aValue;
+ if (findAndRemove()
+ && aValue.equalsIgnoreAsciiCase(OUString()))
+ ;
+ else
+ nAttrs |= 1;
+ return nAttrs;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/20090329-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/20090329-1.C
new file mode 100644
index 000000000..0274a1944
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/20090329-1.C
@@ -0,0 +1,59 @@
+/* { dg-do compile } */
+
+struct input_iterator_tag { };
+template<typename _Category, typename _Tp, typename _Distance = long, typename _Pointer = _Tp*, typename _Reference = _Tp&>
+struct iterator {
+ typedef _Category iterator_category;
+};
+template<typename _Iterator> struct iterator_traits {
+ typedef typename _Iterator::iterator_category iterator_category;
+};
+template<typename, typename> struct __lc_rai {
+ template<typename _II1, typename _II2>
+ static _II1 __newlast1(_II1, _II1 __last1, _II2, _II2) {
+ return __last1;
+ }
+ template<typename _II>
+ static bool __cnd2(_II __first, _II __last) {
+ return __first != __last;
+ }
+};
+template<typename _II1, typename _II2, typename _Compare>
+bool lexicographical_compare(_II1 __first1, _II1 __last1, _II2 __first2,
+ _II2 __last2, _Compare __comp) {
+ typedef typename iterator_traits<_II1>::iterator_category _Category1;
+ typedef typename iterator_traits<_II2>::iterator_category _Category2;
+ typedef __lc_rai<_Category1, _Category2> __rai_type;
+ __last1 = __rai_type::__newlast1(__first1, __last1, __first2, __last2);
+ for (;
+ __first1 != __last1 && __rai_type::__cnd2(__first2, __last2);
+ ++__first1, ++__first2) {
+ if (__comp(*__first1, *__first2)) return true;
+ }
+}
+void __assert_fail () throw () __attribute__ ((__noreturn__));
+template<typename T> struct BoundsContainer { };
+template<class T> class input_iterator_wrapper : public iterator<input_iterator_tag, T, long, T*, T&> {
+public:
+ typedef BoundsContainer<T> ContainerType;
+ T* ptr;
+ ContainerType* SharedInfo;
+ input_iterator_wrapper(const input_iterator_wrapper& in) : ptr(in.ptr), SharedInfo(in.SharedInfo) { }
+ bool operator==(const input_iterator_wrapper& in) const {
+ (static_cast<void> ((SharedInfo != __null
+ && SharedInfo == in.SharedInfo)
+ ? 0 : (__assert_fail (), 0)));
+ }
+ bool operator!=(const input_iterator_wrapper& in) const {
+ return !(*this == in);
+ }
+ T& operator*() const { }
+ input_iterator_wrapper& operator++() { }
+};
+struct X { };
+bool predicate(const X&, const X&) {
+ return true;
+}
+bool test2(input_iterator_wrapper<X>& x) {
+ return lexicographical_compare(x, x, x, x, predicate);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/20090706-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/20090706-1.C
new file mode 100644
index 000000000..43a59f0e6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/20090706-1.C
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Tp> class new_allocator { };
+ template<typename _Tp> class allocator: public new_allocator<_Tp> { };
+ template<typename _Tp, typename _Alloc> struct _Vector_base { };
+ template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
+ class vector : protected _Vector_base<_Tp, _Alloc> { };
+};
+template<int Dim> class Vector { };
+enum CenteringType { VertexType, EdgeType, FaceType, CellType };
+enum ContinuityType { XDim = 1, YDim = XDim << 1, ZDim = YDim << 1 };
+template <int Dim> class Centering {
+public:
+ typedef Vector<Dim> Position;
+ typedef std::vector<Position> Positions;
+ Centering(const Positions &positions);
+ Positions positions_m;
+};
+template <int Dim> class CanonicalCentering {
+ CanonicalCentering();
+ template <class T> static T combine(const T &op1, const T &op2);
+ static Centering<Dim>*** centering_table_m;
+};
+template <int Dim> CanonicalCentering<Dim>::CanonicalCentering()
+{
+ typename Centering<Dim>::Positions positions[Dim][2];
+ enum { x = 0, y, z };
+ int cont = 0;
+ if (Dim > 1)
+ {
+ centering_table_m[EdgeType][cont][YDim] = Centering<Dim>(positions[y][cont]);
+ centering_table_m[EdgeType][cont][XDim|YDim] = Centering<Dim>(combine(positions[x][cont], positions[y][cont]));
+ }
+ if (Dim > 2)
+ {
+ centering_table_m[EdgeType][cont][ZDim] = Centering<Dim>(positions[z][cont]);
+ centering_table_m[EdgeType][cont][XDim|ZDim] = Centering<Dim>(combine(positions[x][cont], positions[z][cont]));
+ }
+}
+template class CanonicalCentering<2>;
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/20100702-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/20100702-1.C
new file mode 100644
index 000000000..3d223fffb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/20100702-1.C
@@ -0,0 +1,37 @@
+// { dg-do compile }
+// { dg-options "-fprefetch-loop-arrays -w" }
+
+class ggPoint3 {
+public:
+ ggPoint3();
+ inline double &x() {
+ return e[0];
+ }
+ inline double &y() {
+ return e[1];
+ }
+ ggPoint3(const ggPoint3 &p);
+ double e[3];
+};
+class ggBox3 {
+public:
+ ggPoint3 min() const;
+};
+class ggHAffineMatrix3;
+ggPoint3 operator*(const ggHAffineMatrix3 &m, const ggPoint3 &v);
+void foo (ggPoint3 *);
+void SetMatrix(ggHAffineMatrix3& toworld, ggBox3& box)
+{
+ ggPoint3 p[2][2][2];
+ int i, j, k;
+ for (i = 0; i < 2; j++)
+ for (k = 0; k < 2; k++)
+ {
+ if (i == 0)
+ p[i][j][k].x() = box.min().x();
+ if (j == 0)
+ p[i][j][k].y() = box.min().y();
+ p[i][j][k] = toworld * p[i][j][k];
+ }
+ foo (&p[0][0][0]);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/20100825.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/20100825.C
new file mode 100644
index 000000000..460c1b608
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/20100825.C
@@ -0,0 +1,15 @@
+// { dg-do run }
+
+typedef enum { zero = 0, one = 1, two = 2, ENUM_MAX = 3 } my_enum;
+my_enum e;
+extern "C" void abort (void);
+int __attribute__((noinline)) foo() { return 10; }
+int main()
+{
+ int r;
+ r = foo();
+ if ((r < 0) || (r >= ENUM_MAX))
+ return 0;
+ e = (my_enum)r;
+ abort ();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/20120420-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/20120420-1.C
new file mode 100644
index 000000000..ada0ab67e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/20120420-1.C
@@ -0,0 +1,29 @@
+// { dg-do compile }
+
+int g, *gp[100];
+struct V {
+ int* x;
+ int y;
+};
+
+void foo (V **p, V* end, int i)
+{
+ *p = 0;
+ V* pp = *p;
+ int s = 100;
+ for (; pp < end; )
+ {
+ pp++;
+ (pp-1)->x = &g;
+ if (g)
+ {
+ if (g>10)
+ g++;
+ int *t = (int*) operator new (100);
+ (pp-1)->x = t;
+ }
+ else
+ s--;
+ gp[end-pp] = (pp-1)->x + s;
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/20121105-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/20121105-1.C
new file mode 100644
index 000000000..10eeeb909
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/20121105-1.C
@@ -0,0 +1,44 @@
+// PR tree-optimization/54986
+// Reported by Remi Vanicat <vanicat@debian.org>
+// Reduced testcase by Markus Trippelsdorf <markus@trippelsdorf.de>
+
+__extension__ typedef __INTPTR_TYPE__ intptr_t;
+
+struct A;
+struct B
+{
+ int *_ptr;
+ bool operator==(B *p1)
+ {
+ return p1->_ptr;
+ }
+};
+struct C {
+ A* ref_SYMBptr();
+};
+struct A
+{
+ B sommet;
+};
+typedef C *gen_op_context;
+struct D
+{
+ D(gen_op_context) {}
+};
+
+D c(0);
+const intptr_t d = (intptr_t)&c;
+B *const e = (B *)&d;
+
+static bool
+fn1(C& p1)
+{
+ return p1.ref_SYMBptr()->sommet == e;
+}
+
+void
+fn2()
+{
+ C b;
+ fn1(b);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/PR58294.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/PR58294.C
new file mode 100644
index 000000000..e1fb95ae2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/PR58294.C
@@ -0,0 +1,20 @@
+// { dg-do compile }
+struct A {
+ virtual ~A();
+ virtual void m_fn1() { delete this; }
+ void m_fn2() { m_fn1(); }
+};
+
+struct B {
+ A *pi_;
+ B() { pi_->m_fn2(); }
+};
+struct C {
+ B pn;
+};
+void _setjmp();
+int png_decode() {
+ _setjmp();
+ C a;
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/Wsizeof-pointer-memaccess1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/Wsizeof-pointer-memaccess1.C
new file mode 100644
index 000000000..6cb39809d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/Wsizeof-pointer-memaccess1.C
@@ -0,0 +1,716 @@
+// Test -Wsizeof-pointer-memaccess warnings.
+// { dg-do compile }
+// { dg-options "-Wall" }
+// Test just twice, once with -O0 non-fortified, once with -O2 fortified.
+// { dg-skip-if "" { *-*-* } { "*" } { "-O0" "-O2" } }
+// { dg-skip-if "" { *-*-* } { "-flto" } { "" } }
+
+extern "C" {
+
+typedef __SIZE_TYPE__ size_t;
+extern void *memset (void *, int, size_t);
+extern void *memcpy (void *__restrict, const void *__restrict, size_t);
+extern void *memmove (void *__restrict, const void *__restrict, size_t);
+extern int memcmp (const void *, const void *, size_t);
+extern char *strncpy (char *__restrict, const char *__restrict, size_t);
+extern char *strncat (char *__restrict, const char *__restrict, size_t);
+extern char *stpncpy (char *__restrict, const char *__restrict, size_t);
+extern char *strndup (const char *, size_t);
+extern int strncmp (const char *, const char *, size_t);
+extern int strncasecmp (const char *, const char *, size_t);
+
+#ifdef __OPTIMIZE__
+# define bos(ptr) __builtin_object_size (ptr, 1)
+# define bos0(ptr) __builtin_object_size (ptr, 0)
+
+__attribute__((__always_inline__, __gnu_inline__, __artificial__))
+extern inline void *
+memset (void *dest, int c, size_t len)
+{
+ return __builtin___memset_chk (dest, c, len, bos0 (dest));
+}
+
+__attribute__((__always_inline__, __gnu_inline__, __artificial__))
+extern inline void *
+memcpy (void *__restrict dest, const void *__restrict src, size_t len)
+{
+ return __builtin___memcpy_chk (dest, src, len, bos0 (dest));
+}
+
+__attribute__((__always_inline__, __gnu_inline__, __artificial__))
+extern inline void *
+memmove (void *dest, const void *src, size_t len)
+{
+ return __builtin___memmove_chk (dest, src, len, bos0 (dest));
+}
+
+__attribute__((__always_inline__, __gnu_inline__, __artificial__))
+extern inline char *
+strncpy (char *__restrict dest, const char *__restrict src, size_t len)
+{
+ return __builtin___strncpy_chk (dest, src, len, bos (dest));
+}
+
+__attribute__((__always_inline__, __gnu_inline__, __artificial__))
+extern inline char *
+strncat (char *dest, const char *src, size_t len)
+{
+ return __builtin___strncat_chk (dest, src, len, bos (dest));
+}
+
+__attribute__((__always_inline__, __gnu_inline__, __artificial__))
+extern inline char *
+stpncpy (char *__restrict dest, const char *__restrict src, size_t len)
+{
+ return __builtin___stpncpy_chk (dest, src, len, bos (dest));
+}
+#endif
+
+}
+
+struct A { short a, b; int c, d; long e, f; };
+typedef struct A TA;
+typedef struct A *PA;
+typedef TA *PTA;
+struct B {};
+typedef struct B TB;
+typedef struct B *PB;
+typedef TB *PTB;
+typedef int X[3][3][3];
+
+int
+f1 (void *x, int z)
+{
+ struct A a, *pa1 = &a;
+ TA *pa2 = &a;
+ PA pa3 = &a;
+ PTA pa4 = &a;
+ memset (&a, 0, sizeof (&a)); // { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" }
+ memset (pa1, 0, sizeof (pa1)); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memset (pa2, 0, sizeof pa2); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memset (pa3, 0, sizeof (pa3)); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memset (pa4, 0, sizeof pa4); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memset (pa1, 0, sizeof (struct A *)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memset (pa2, 0, sizeof (PTA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memset (pa3, 0, sizeof (PA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memset (pa4, 0, sizeof (__typeof (pa4))); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+
+ memcpy (&a, x, sizeof (&a)); // { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" }
+ memcpy (pa1, x, sizeof (pa1)); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memcpy (pa2, x, sizeof pa2); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memcpy (pa3, x, sizeof (pa3)); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memcpy (pa4, x, sizeof pa4); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memcpy (pa1, x, sizeof (struct A *)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memcpy (pa2, x, sizeof (PTA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memcpy (pa3, x, sizeof (PA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memcpy (pa4, x, sizeof (__typeof (pa4))); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+
+ memcpy (x, &a, sizeof (&a)); // { dg-warning "call is the same expression as the source; did you mean to remove the addressof" }
+ memcpy (x, pa1, sizeof (pa1)); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memcpy (x, pa2, sizeof pa2); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memcpy (x, pa3, sizeof (pa3)); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memcpy (x, pa4, sizeof pa4); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memcpy (x, pa1, sizeof (struct A *)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+ memcpy (x, pa2, sizeof (PTA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+ memcpy (x, pa3, sizeof (PA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+ memcpy (x, pa4, sizeof (__typeof (pa4))); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+
+ memmove (&a, x, sizeof (&a)); // { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" }
+ memmove (pa1, x, sizeof (pa1)); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memmove (pa2, x, sizeof pa2); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memmove (pa3, x, sizeof (pa3)); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memmove (pa4, x, sizeof pa4); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memmove (pa1, x, sizeof (struct A *)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memmove (pa2, x, sizeof (PTA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memmove (pa3, x, sizeof (PA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memmove (pa4, x, sizeof (__typeof (pa4)));// { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+
+ memmove (x, &a, sizeof (&a)); // { dg-warning "call is the same expression as the source; did you mean to remove the addressof" }
+ memmove (x, pa1, sizeof (pa1)); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memmove (x, pa2, sizeof pa2); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memmove (x, pa3, sizeof (pa3)); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memmove (x, pa4, sizeof pa4); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memmove (x, pa1, sizeof (struct A *)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+ memmove (x, pa2, sizeof (PTA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+ memmove (x, pa3, sizeof (PA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+ memmove (x, pa4, sizeof (__typeof (pa4)));// { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+
+ z += memcmp (&a, x, sizeof (&a)); // { dg-warning "call is the same expression as the first source; did you mean to remove the addressof" }
+ z += memcmp (pa1, x, sizeof (pa1)); // { dg-warning "call is the same expression as the first source; did you mean to dereference it" }
+ z += memcmp (pa2, x, sizeof pa2); // { dg-warning "call is the same expression as the first source; did you mean to dereference it" }
+ z += memcmp (pa3, x, sizeof (pa3)); // { dg-warning "call is the same expression as the first source; did you mean to dereference it" }
+ z += memcmp (pa4, x, sizeof pa4); // { dg-warning "call is the same expression as the first source; did you mean to dereference it" }
+ z += memcmp (pa1, x, sizeof (struct A *));// { dg-warning "call is the same pointer type \[^\n\r\]* as the first source; expected \[^\n\r\]* or an explicit length" }
+ z += memcmp (pa2, x, sizeof (PTA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the first source; expected \[^\n\r\]* or an explicit length" }
+ z += memcmp (pa3, x, sizeof (PA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the first source; expected \[^\n\r\]* or an explicit length" }
+
+ z += memcmp (x, &a, sizeof (&a)); // { dg-warning "call is the same expression as the second source; did you mean to remove the addressof" }
+ z += memcmp (x, pa1, sizeof (pa1)); // { dg-warning "call is the same expression as the second source; did you mean to dereference it" }
+ z += memcmp (x, pa2, sizeof pa2); // { dg-warning "call is the same expression as the second source; did you mean to dereference it" }
+ z += memcmp (x, pa3, sizeof (pa3)); // { dg-warning "call is the same expression as the second source; did you mean to dereference it" }
+ z += memcmp (x, pa4, sizeof pa4); // { dg-warning "call is the same expression as the second source; did you mean to dereference it" }
+ z += memcmp (x, pa1, sizeof (struct A *));// { dg-warning "call is the same pointer type \[^\n\r\]* as the second source; expected \[^\n\r\]* or an explicit length" }
+ z += memcmp (x, pa2, sizeof (PTA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the second source; expected \[^\n\r\]* or an explicit length" }
+ z += memcmp (x, pa3, sizeof (PA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the second source; expected \[^\n\r\]* or an explicit length" }
+
+ // These are correct, no warning.
+ memset (&a, 0, sizeof a);
+ memset (&a, 0, sizeof (a));
+ memset (&a, 0, sizeof (struct A));
+ memset (&a, 0, sizeof (const struct A));
+ memset (&a, 0, sizeof (volatile struct A));
+ memset (&a, 0, sizeof (volatile const struct A));
+ memset (&a, 0, sizeof (TA));
+ memset (&a, 0, sizeof (__typeof (*&a)));
+ memset (pa1, 0, sizeof (*pa1));
+ memset (pa2, 0, sizeof (*pa3));
+ memset (pa3, 0, sizeof (__typeof (*pa3)));
+ // These are probably broken, but obfuscated, no warning.
+ memset ((void *) &a, 0, sizeof (&a));
+ memset ((char *) &a, 0, sizeof (&a));
+ memset (&a, 0, sizeof (&a) + 0);
+ memset (&a, 0, 0 + sizeof (&a));
+
+ // These are correct, no warning.
+ memcpy (&a, x, sizeof a);
+ memcpy (&a, x, sizeof (a));
+ memcpy (&a, x, sizeof (struct A));
+ memcpy (&a, x, sizeof (const struct A));
+ memcpy (&a, x, sizeof (volatile struct A));
+ memcpy (&a, x, sizeof (volatile const struct A));
+ memcpy (&a, x, sizeof (TA));
+ memcpy (&a, x, sizeof (__typeof (*&a)));
+ memcpy (pa1, x, sizeof (*pa1));
+ memcpy (pa2, x, sizeof (*pa3));
+ memcpy (pa3, x, sizeof (__typeof (*pa3)));
+ // These are probably broken, but obfuscated, no warning.
+ memcpy ((void *) &a, x, sizeof (&a));
+ memcpy ((char *) &a, x, sizeof (&a));
+ memcpy (&a, x, sizeof (&a) + 0);
+ memcpy (&a, x, 0 + sizeof (&a));
+
+ // These are correct, no warning.
+ memcpy (x, &a, sizeof a);
+ memcpy (x, &a, sizeof (a));
+ memcpy (x, &a, sizeof (struct A));
+ memcpy (x, &a, sizeof (const struct A));
+ memcpy (x, &a, sizeof (volatile struct A));
+ memcpy (x, &a, sizeof (volatile const struct A));
+ memcpy (x, &a, sizeof (TA));
+ memcpy (x, &a, sizeof (__typeof (*&a)));
+ memcpy (x, pa1, sizeof (*pa1));
+ memcpy (x, pa2, sizeof (*pa3));
+ memcpy (x, pa3, sizeof (__typeof (*pa3)));
+ // These are probably broken, but obfuscated, no warning.
+ memcpy (x, (void *) &a, sizeof (&a));
+ memcpy (x, (char *) &a, sizeof (&a));
+ memcpy (x, &a, sizeof (&a) + 0);
+ memcpy (x, &a, 0 + sizeof (&a));
+
+ // These are correct, no warning.
+ memmove (&a, x, sizeof a);
+ memmove (&a, x, sizeof (a));
+ memmove (&a, x, sizeof (struct A));
+ memmove (&a, x, sizeof (const struct A));
+ memmove (&a, x, sizeof (volatile struct A));
+ memmove (&a, x, sizeof (volatile const struct A));
+ memmove (&a, x, sizeof (TA));
+ memmove (&a, x, sizeof (__typeof (*&a)));
+ memmove (pa1, x, sizeof (*pa1));
+ memmove (pa2, x, sizeof (*pa3));
+ memmove (pa3, x, sizeof (__typeof (*pa3)));
+ // These are probably broken, but obfuscated, no warning.
+ memmove ((void *) &a, x, sizeof (&a));
+ memmove ((char *) &a, x, sizeof (&a));
+ memmove (&a, x, sizeof (&a) + 0);
+ memmove (&a, x, 0 + sizeof (&a));
+
+ // These are correct, no warning.
+ memmove (x, &a, sizeof a);
+ memmove (x, &a, sizeof (a));
+ memmove (x, &a, sizeof (struct A));
+ memmove (x, &a, sizeof (const struct A));
+ memmove (x, &a, sizeof (volatile struct A));
+ memmove (x, &a, sizeof (volatile const struct A));
+ memmove (x, &a, sizeof (TA));
+ memmove (x, &a, sizeof (__typeof (*&a)));
+ memmove (x, pa1, sizeof (*pa1));
+ memmove (x, pa2, sizeof (*pa3));
+ memmove (x, pa3, sizeof (__typeof (*pa3)));
+ // These are probably broken, but obfuscated, no warning.
+ memmove (x, (void *) &a, sizeof (&a));
+ memmove (x, (char *) &a, sizeof (&a));
+ memmove (x, &a, sizeof (&a) + 0);
+ memmove (x, &a, 0 + sizeof (&a));
+
+ // These are correct, no warning.
+ z += memcmp (&a, x, sizeof a);
+ z += memcmp (&a, x, sizeof (a));
+ z += memcmp (&a, x, sizeof (struct A));
+ z += memcmp (&a, x, sizeof (const struct A));
+ z += memcmp (&a, x, sizeof (volatile struct A));
+ z += memcmp (&a, x, sizeof (volatile const struct A));
+ z += memcmp (&a, x, sizeof (TA));
+ z += memcmp (&a, x, sizeof (__typeof (*&a)));
+ z += memcmp (pa1, x, sizeof (*pa1));
+ z += memcmp (pa2, x, sizeof (*pa3));
+ z += memcmp (pa3, x, sizeof (__typeof (*pa3)));
+ // These are probably broken, but obfuscated, no warning.
+ z += memcmp ((void *) &a, x, sizeof (&a));
+ z += memcmp ((char *) &a, x, sizeof (&a));
+ z += memcmp (&a, x, sizeof (&a) + 0);
+ z += memcmp (&a, x, 0 + sizeof (&a));
+
+ // These are correct, no warning.
+ z += memcmp (x, &a, sizeof a);
+ z += memcmp (x, &a, sizeof (a));
+ z += memcmp (x, &a, sizeof (struct A));
+ z += memcmp (x, &a, sizeof (const struct A));
+ z += memcmp (x, &a, sizeof (volatile struct A));
+ z += memcmp (x, &a, sizeof (volatile const struct A));
+ z += memcmp (x, &a, sizeof (TA));
+ z += memcmp (x, &a, sizeof (__typeof (*&a)));
+ z += memcmp (x, pa1, sizeof (*pa1));
+ z += memcmp (x, pa2, sizeof (*pa3));
+ z += memcmp (x, pa3, sizeof (__typeof (*pa3)));
+ // These are probably broken, but obfuscated, no warning.
+ z += memcmp (x, (void *) &a, sizeof (&a));
+ z += memcmp (x, (char *) &a, sizeof (&a));
+ z += memcmp (x, &a, sizeof (&a) + 0);
+ z += memcmp (x, &a, 0 + sizeof (&a));
+
+ return z;
+}
+
+int
+f2 (void *x, int z)
+{
+ struct B b, *pb1 = &b;
+ TB *pb2 = &b;
+ PB pb3 = &b;
+ PTB pb4 = &b;
+ memset (&b, 0, sizeof (&b)); // { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" }
+ memset (pb1, 0, sizeof (pb1)); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memset (pb2, 0, sizeof pb2); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memset (pb3, 0, sizeof (pb3)); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memset (pb4, 0, sizeof pb4); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memset (pb1, 0, sizeof (struct B *)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memset (pb2, 0, sizeof (PTB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memset (pb3, 0, sizeof (PB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memset (pb4, 0, sizeof (__typeof (pb4))); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+
+ memcpy (&b, x, sizeof (&b)); // { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" }
+ memcpy (pb1, x, sizeof (pb1)); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memcpy (pb2, x, sizeof pb2); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memcpy (pb3, x, sizeof (pb3)); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memcpy (pb4, x, sizeof pb4); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memcpy (pb1, x, sizeof (struct B *)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memcpy (pb2, x, sizeof (PTB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memcpy (pb3, x, sizeof (PB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memcpy (pb4, x, sizeof (__typeof (pb4))); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+
+ memcpy (x, &b, sizeof (&b)); // { dg-warning "call is the same expression as the source; did you mean to remove the addressof" }
+ memcpy (x, pb1, sizeof (pb1)); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memcpy (x, pb2, sizeof pb2); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memcpy (x, pb3, sizeof (pb3)); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memcpy (x, pb4, sizeof pb4); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memcpy (x, pb1, sizeof (struct B *)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+ memcpy (x, pb2, sizeof (PTB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+ memcpy (x, pb3, sizeof (PB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+ memcpy (x, pb4, sizeof (__typeof (pb4))); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+
+ memmove (&b, x, sizeof (&b)); // { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" }
+ memmove (pb1, x, sizeof (pb1)); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memmove (pb2, x, sizeof pb2); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memmove (pb3, x, sizeof (pb3)); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memmove (pb4, x, sizeof pb4); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memmove (pb1, x, sizeof (struct B *)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memmove (pb2, x, sizeof (PTB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memmove (pb3, x, sizeof (PB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memmove (pb4, x, sizeof (__typeof (pb4)));// { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+
+ memmove (x, &b, sizeof (&b)); // { dg-warning "call is the same expression as the source; did you mean to remove the addressof" }
+ memmove (x, pb1, sizeof (pb1)); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memmove (x, pb2, sizeof pb2); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memmove (x, pb3, sizeof (pb3)); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memmove (x, pb4, sizeof pb4); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memmove (x, pb1, sizeof (struct B *)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+ memmove (x, pb2, sizeof (PTB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+ memmove (x, pb3, sizeof (PB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+ memmove (x, pb4, sizeof (__typeof (pb4)));// { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+
+ z += memcmp (&b, x, sizeof (&b)); // { dg-warning "call is the same expression as the first source; did you mean to remove the addressof" }
+ z += memcmp (pb1, x, sizeof (pb1)); // { dg-warning "call is the same expression as the first source; did you mean to dereference it" }
+ z += memcmp (pb2, x, sizeof pb2); // { dg-warning "call is the same expression as the first source; did you mean to dereference it" }
+ z += memcmp (pb3, x, sizeof (pb3)); // { dg-warning "call is the same expression as the first source; did you mean to dereference it" }
+ z += memcmp (pb4, x, sizeof pb4); // { dg-warning "call is the same expression as the first source; did you mean to dereference it" }
+ z += memcmp (pb1, x, sizeof (struct B *));// { dg-warning "call is the same pointer type \[^\n\r\]* as the first source; expected \[^\n\r\]* or an explicit length" }
+ z += memcmp (pb2, x, sizeof (PTB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the first source; expected \[^\n\r\]* or an explicit length" }
+ z += memcmp (pb3, x, sizeof (PB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the first source; expected \[^\n\r\]* or an explicit length" }
+
+ z += memcmp (x, &b, sizeof (&b)); // { dg-warning "call is the same expression as the second source; did you mean to remove the addressof" }
+ z += memcmp (x, pb1, sizeof (pb1)); // { dg-warning "call is the same expression as the second source; did you mean to dereference it" }
+ z += memcmp (x, pb2, sizeof pb2); // { dg-warning "call is the same expression as the second source; did you mean to dereference it" }
+ z += memcmp (x, pb3, sizeof (pb3)); // { dg-warning "call is the same expression as the second source; did you mean to dereference it" }
+ z += memcmp (x, pb4, sizeof pb4); // { dg-warning "call is the same expression as the second source; did you mean to dereference it" }
+ z += memcmp (x, pb1, sizeof (struct B *));// { dg-warning "call is the same pointer type \[^\n\r\]* as the second source; expected \[^\n\r\]* or an explicit length" }
+ z += memcmp (x, pb2, sizeof (PTB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the second source; expected \[^\n\r\]* or an explicit length" }
+ z += memcmp (x, pb3, sizeof (PB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the second source; expected \[^\n\r\]* or an explicit length" }
+
+ // These are correct, no warning.
+ memset (&b, 0, sizeof b);
+ memset (&b, 0, sizeof (b));
+ memset (&b, 0, sizeof (struct B));
+ memset (&b, 0, sizeof (const struct B));
+ memset (&b, 0, sizeof (volatile struct B));
+ memset (&b, 0, sizeof (volatile const struct B));
+ memset (&b, 0, sizeof (TB));
+ memset (&b, 0, sizeof (__typeof (*&b)));
+ memset (pb1, 0, sizeof (*pb1));
+ memset (pb2, 0, sizeof (*pb3));
+ memset (pb3, 0, sizeof (__typeof (*pb3)));
+ // These are probably broken, but obfuscated, no warning.
+ memset ((void *) &b, 0, sizeof (&b));
+ memset ((char *) &b, 0, sizeof (&b));
+ memset (&b, 0, sizeof (&b) + 0);
+ memset (&b, 0, 0 + sizeof (&b));
+
+ // These are correct, no warning.
+ memcpy (&b, x, sizeof b);
+ memcpy (&b, x, sizeof (b));
+ memcpy (&b, x, sizeof (struct B));
+ memcpy (&b, x, sizeof (const struct B));
+ memcpy (&b, x, sizeof (volatile struct B));
+ memcpy (&b, x, sizeof (volatile const struct B));
+ memcpy (&b, x, sizeof (TB));
+ memcpy (&b, x, sizeof (__typeof (*&b)));
+ memcpy (pb1, x, sizeof (*pb1));
+ memcpy (pb2, x, sizeof (*pb3));
+ memcpy (pb3, x, sizeof (__typeof (*pb3)));
+ // These are probably broken, but obfuscated, no warning.
+ memcpy ((void *) &b, x, sizeof (&b));
+ memcpy ((char *) &b, x, sizeof (&b));
+ memcpy (&b, x, sizeof (&b) + 0);
+ memcpy (&b, x, 0 + sizeof (&b));
+
+ // These are correct, no warning.
+ memcpy (x, &b, sizeof b);
+ memcpy (x, &b, sizeof (b));
+ memcpy (x, &b, sizeof (struct B));
+ memcpy (x, &b, sizeof (const struct B));
+ memcpy (x, &b, sizeof (volatile struct B));
+ memcpy (x, &b, sizeof (volatile const struct B));
+ memcpy (x, &b, sizeof (TB));
+ memcpy (x, &b, sizeof (__typeof (*&b)));
+ memcpy (x, pb1, sizeof (*pb1));
+ memcpy (x, pb2, sizeof (*pb3));
+ memcpy (x, pb3, sizeof (__typeof (*pb3)));
+ // These are probably broken, but obfuscated, no warning.
+ memcpy (x, (void *) &b, sizeof (&b));
+ memcpy (x, (char *) &b, sizeof (&b));
+ memcpy (x, &b, sizeof (&b) + 0);
+ memcpy (x, &b, 0 + sizeof (&b));
+
+ // These are correct, no warning.
+ memmove (&b, x, sizeof b);
+ memmove (&b, x, sizeof (b));
+ memmove (&b, x, sizeof (struct B));
+ memmove (&b, x, sizeof (const struct B));
+ memmove (&b, x, sizeof (volatile struct B));
+ memmove (&b, x, sizeof (volatile const struct B));
+ memmove (&b, x, sizeof (TB));
+ memmove (&b, x, sizeof (__typeof (*&b)));
+ memmove (pb1, x, sizeof (*pb1));
+ memmove (pb2, x, sizeof (*pb3));
+ memmove (pb3, x, sizeof (__typeof (*pb3)));
+ // These are probably broken, but obfuscated, no warning.
+ memmove ((void *) &b, x, sizeof (&b));
+ memmove ((char *) &b, x, sizeof (&b));
+ memmove (&b, x, sizeof (&b) + 0);
+ memmove (&b, x, 0 + sizeof (&b));
+
+ // These are correct, no warning.
+ memmove (x, &b, sizeof b);
+ memmove (x, &b, sizeof (b));
+ memmove (x, &b, sizeof (struct B));
+ memmove (x, &b, sizeof (const struct B));
+ memmove (x, &b, sizeof (volatile struct B));
+ memmove (x, &b, sizeof (volatile const struct B));
+ memmove (x, &b, sizeof (TB));
+ memmove (x, &b, sizeof (__typeof (*&b)));
+ memmove (x, pb1, sizeof (*pb1));
+ memmove (x, pb2, sizeof (*pb3));
+ memmove (x, pb3, sizeof (__typeof (*pb3)));
+ // These are probably broken, but obfuscated, no warning.
+ memmove (x, (void *) &b, sizeof (&b));
+ memmove (x, (char *) &b, sizeof (&b));
+ memmove (x, &b, sizeof (&b) + 0);
+ memmove (x, &b, 0 + sizeof (&b));
+
+ // These are correct, no warning.
+ z += memcmp (&b, x, sizeof b);
+ z += memcmp (&b, x, sizeof (b));
+ z += memcmp (&b, x, sizeof (struct B));
+ z += memcmp (&b, x, sizeof (const struct B));
+ z += memcmp (&b, x, sizeof (volatile struct B));
+ z += memcmp (&b, x, sizeof (volatile const struct B));
+ z += memcmp (&b, x, sizeof (TB));
+ z += memcmp (&b, x, sizeof (__typeof (*&b)));
+ z += memcmp (pb1, x, sizeof (*pb1));
+ z += memcmp (pb2, x, sizeof (*pb3));
+ z += memcmp (pb3, x, sizeof (__typeof (*pb3)));
+ // These are probably broken, but obfuscated, no warning.
+ z += memcmp ((void *) &b, x, sizeof (&b));
+ z += memcmp ((char *) &b, x, sizeof (&b));
+ z += memcmp (&b, x, sizeof (&b) + 0);
+ z += memcmp (&b, x, 0 + sizeof (&b));
+
+ // These are correct, no warning.
+ z += memcmp (x, &b, sizeof b);
+ z += memcmp (x, &b, sizeof (b));
+ z += memcmp (x, &b, sizeof (struct B));
+ z += memcmp (x, &b, sizeof (const struct B));
+ z += memcmp (x, &b, sizeof (volatile struct B));
+ z += memcmp (x, &b, sizeof (volatile const struct B));
+ z += memcmp (x, &b, sizeof (TB));
+ z += memcmp (x, &b, sizeof (__typeof (*&b)));
+ z += memcmp (x, pb1, sizeof (*pb1));
+ z += memcmp (x, pb2, sizeof (*pb3));
+ z += memcmp (x, pb3, sizeof (__typeof (*pb3)));
+ // These are probably broken, but obfuscated, no warning.
+ z += memcmp (x, (void *) &b, sizeof (&b));
+ z += memcmp (x, (char *) &b, sizeof (&b));
+ z += memcmp (x, &b, sizeof (&b) + 0);
+ z += memcmp (x, &b, 0 + sizeof (&b));
+
+ return z;
+}
+
+int
+f3 (void *x, char *y, int z, X w)
+{
+ unsigned char *y1 = (unsigned char *) __builtin_alloca (z + 16);
+ char buf1[7];
+ signed char buf2[z + 32];
+ long buf3[17];
+ int *buf4[9];
+ signed char *y2 = buf2;
+ char c;
+ char *y3;
+ memset (y, 0, sizeof (y)); // { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" }
+ memset (y1, 0, sizeof (y1)); // { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" }
+ memset (y2, 0, sizeof (y2)); // { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" }
+ memset (&c, 0, sizeof (&c)); // { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" }
+ memset (w, 0, sizeof w); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+
+ memcpy (y, x, sizeof (y)); // { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" }
+ memcpy (y1, x, sizeof (y1)); // { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" }
+ memcpy (y2, x, sizeof (y2)); // { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" }
+ memcpy (&c, x, sizeof (&c)); // { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" }
+ memcpy (w, x, sizeof w); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+
+ memcpy (x, y, sizeof (y)); // { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" }
+ memcpy (x, y1, sizeof (y1)); // { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" }
+ memcpy (x, y2, sizeof (y2)); // { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" }
+ memcpy (x, &c, sizeof (&c)); // { dg-warning "call is the same expression as the source; did you mean to remove the addressof" }
+ memcpy (x, w, sizeof w); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+
+ memmove (y, x, sizeof (y)); // { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" }
+ memmove (y1, x, sizeof (y1)); // { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" }
+ memmove (y2, x, sizeof (y2)); // { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" }
+ memmove (&c, x, sizeof (&c)); // { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" }
+ memmove (w, x, sizeof w); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+
+ memmove (x, y, sizeof (y)); // { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" }
+ memmove (x, y1, sizeof (y1)); // { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" }
+ memmove (x, y2, sizeof (y2)); // { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" }
+ memmove (x, &c, sizeof (&c)); // { dg-warning "call is the same expression as the source; did you mean to remove the addressof" }
+ memmove (x, w, sizeof w); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+
+ z += memcmp (y, x, sizeof (y)); // { dg-warning "call is the same expression as the first source; did you mean to provide an explicit length" }
+ z += memcmp (y1, x, sizeof (y1)); // { dg-warning "call is the same expression as the first source; did you mean to provide an explicit length" }
+ z += memcmp (y2, x, sizeof (y2)); // { dg-warning "call is the same expression as the first source; did you mean to provide an explicit length" }
+ z += memcmp (&c, x, sizeof (&c)); // { dg-warning "call is the same expression as the first source; did you mean to remove the addressof" }
+ z += memcmp (w, x, sizeof w); // { dg-warning "call is the same expression as the first source; did you mean to dereference it" }
+
+ z += memcmp (x, y, sizeof (y)); // { dg-warning "call is the same expression as the second source; did you mean to provide an explicit length" }
+ z += memcmp (x, y1, sizeof (y1)); // { dg-warning "call is the same expression as the second source; did you mean to provide an explicit length" }
+ z += memcmp (x, y2, sizeof (y2)); // { dg-warning "call is the same expression as the second source; did you mean to provide an explicit length" }
+ z += memcmp (x, &c, sizeof (&c)); // { dg-warning "call is the same expression as the second source; did you mean to remove the addressof" }
+ z += memcmp (x, w, sizeof w); // { dg-warning "call is the same expression as the second source; did you mean to dereference it" }
+
+ // These are correct, no warning.
+ memset (y, 0, sizeof (*y));
+ memset (y1, 0, sizeof (*y2));
+ memset (buf1, 0, sizeof buf1);
+ memset (buf3, 0, sizeof (buf3));
+ memset (&buf3[0], 0, sizeof (buf3));
+ memset (&buf4[0], 0, sizeof (buf4));
+ memset (w, 0, sizeof (X));
+ // These are probably broken, but obfuscated, no warning.
+ memset ((void *) y, 0, sizeof (y));
+ memset ((char *) y1, 0, sizeof (y2));
+ memset (y, 0, sizeof (y) + 0);
+ memset (y1, 0, 0 + sizeof (y2));
+ memset ((void *) &c, 0, sizeof (&c));
+ memset ((signed char *) &c, 0, sizeof (&c));
+ memset (&c, 0, sizeof (&c) + 0);
+ memset (&c, 0, 0 + sizeof (&c));
+
+ // These are correct, no warning.
+ memcpy (y, x, sizeof (*y));
+ memcpy (y1, x, sizeof (*y2));
+ memcpy (buf1, x, sizeof buf1);
+ memcpy (buf3, x, sizeof (buf3));
+ memcpy (&buf3[0], x, sizeof (buf3));
+ memcpy (&buf4[0], x, sizeof (buf4));
+ memcpy (&y3, y, sizeof (y3));
+ memcpy ((char *) &y3, y, sizeof (y3));
+ memcpy (w, x, sizeof (X));
+ // These are probably broken, but obfuscated, no warning.
+ memcpy ((void *) y, x, sizeof (y));
+ memcpy ((char *) y1, x, sizeof (y2));
+ memcpy (y, x, sizeof (y) + 0);
+ memcpy (y1, x, 0 + sizeof (y2));
+ memcpy ((void *) &c, x, sizeof (&c));
+ memcpy ((signed char *) &c, x, sizeof (&c));
+ memcpy (&c, x, sizeof (&c) + 0);
+ memcpy (&c, x, 0 + sizeof (&c));
+
+ // These are correct, no warning.
+ memcpy (x, y, sizeof (*y));
+ memcpy (x, y1, sizeof (*y2));
+ memcpy (x, buf1, sizeof buf1);
+ memcpy (x, buf3, sizeof (buf3));
+ memcpy (x, &buf3[0], sizeof (buf3));
+ memcpy (x, &buf4[0], sizeof (buf4));
+ memcpy (y, &y3, sizeof (y3));
+ memcpy (y, (char *) &y3, sizeof (y3));
+ memcpy (x, w, sizeof (X));
+ // These are probably broken, but obfuscated, no warning.
+ memcpy (x, (void *) y, sizeof (y));
+ memcpy (x, (char *) y1, sizeof (y2));
+ memcpy (x, y, sizeof (y) + 0);
+ memcpy (x, y1, 0 + sizeof (y2));
+ memcpy (x, (void *) &c, sizeof (&c));
+ memcpy (x, (signed char *) &c, sizeof (&c));
+ memcpy (x, &c, sizeof (&c) + 0);
+ memcpy (x, &c, 0 + sizeof (&c));
+
+ // These are correct, no warning.
+ memmove (y, x, sizeof (*y));
+ memmove (y1, x, sizeof (*y2));
+ memmove (buf1, x, sizeof buf1);
+ memmove (buf3, x, sizeof (buf3));
+ memmove (&buf3[0], x, sizeof (buf3));
+ memmove (&buf4[0], x, sizeof (buf4));
+ memmove (&y3, y, sizeof (y3));
+ memmove ((char *) &y3, y, sizeof (y3));
+ memmove (w, x, sizeof (X));
+ // These are probably broken, but obfuscated, no warning.
+ memmove ((void *) y, x, sizeof (y));
+ memmove ((char *) y1, x, sizeof (y2));
+ memmove (y, x, sizeof (y) + 0);
+ memmove (y1, x, 0 + sizeof (y2));
+ memmove ((void *) &c, x, sizeof (&c));
+ memmove ((signed char *) &c, x, sizeof (&c));
+ memmove (&c, x, sizeof (&c) + 0);
+ memmove (&c, x, 0 + sizeof (&c));
+
+ // These are correct, no warning.
+ memmove (x, y, sizeof (*y));
+ memmove (x, y1, sizeof (*y2));
+ memmove (x, buf1, sizeof buf1);
+ memmove (x, buf3, sizeof (buf3));
+ memmove (x, &buf3[0], sizeof (buf3));
+ memmove (x, &buf4[0], sizeof (buf4));
+ memmove (y, &y3, sizeof (y3));
+ memmove (y, (char *) &y3, sizeof (y3));
+ memmove (x, w, sizeof (X));
+ // These are probably broken, but obfuscated, no warning.
+ memmove (x, (void *) y, sizeof (y));
+ memmove (x, (char *) y1, sizeof (y2));
+ memmove (x, y, sizeof (y) + 0);
+ memmove (x, y1, 0 + sizeof (y2));
+ memmove (x, (void *) &c, sizeof (&c));
+ memmove (x, (signed char *) &c, sizeof (&c));
+ memmove (x, &c, sizeof (&c) + 0);
+ memmove (x, &c, 0 + sizeof (&c));
+
+ // These are correct, no warning.
+ z += memcmp (y, x, sizeof (*y));
+ z += memcmp (y1, x, sizeof (*y2));
+ z += memcmp (buf1, x, sizeof buf1);
+ z += memcmp (buf3, x, sizeof (buf3));
+ z += memcmp (&buf3[0], x, sizeof (buf3));
+ z += memcmp (&buf4[0], x, sizeof (buf4));
+ z += memcmp (&y3, y, sizeof (y3));
+ z += memcmp ((char *) &y3, y, sizeof (y3));
+ z += memcmp (w, x, sizeof (X));
+ // These are probably broken, but obfuscated, no warning.
+ z += memcmp ((void *) y, x, sizeof (y));
+ z += memcmp ((char *) y1, x, sizeof (y2));
+ z += memcmp (y, x, sizeof (y) + 0);
+ z += memcmp (y1, x, 0 + sizeof (y2));
+ z += memcmp ((void *) &c, x, sizeof (&c));
+ z += memcmp ((signed char *) &c, x, sizeof (&c));
+ z += memcmp (&c, x, sizeof (&c) + 0);
+ z += memcmp (&c, x, 0 + sizeof (&c));
+
+ // These are correct, no warning.
+ z += memcmp (x, y, sizeof (*y));
+ z += memcmp (x, y1, sizeof (*y2));
+ z += memcmp (x, buf1, sizeof buf1);
+ z += memcmp (x, buf3, sizeof (buf3));
+ z += memcmp (x, &buf3[0], sizeof (buf3));
+ z += memcmp (x, &buf4[0], sizeof (buf4));
+ z += memcmp (y, &y3, sizeof (y3));
+ z += memcmp (y, (char *) &y3, sizeof (y3));
+ z += memcmp (x, w, sizeof (X));
+ // These are probably broken, but obfuscated, no warning.
+ z += memcmp (x, (void *) y, sizeof (y));
+ z += memcmp (x, (char *) y1, sizeof (y2));
+ z += memcmp (x, y, sizeof (y) + 0);
+ z += memcmp (x, y1, 0 + sizeof (y2));
+ z += memcmp (x, (void *) &c, sizeof (&c));
+ z += memcmp (x, (signed char *) &c, sizeof (&c));
+ z += memcmp (x, &c, sizeof (&c) + 0);
+ z += memcmp (x, &c, 0 + sizeof (&c));
+
+ return z;
+}
+
+int
+f4 (char *x, char **y, int z, char w[64])
+{
+ const char *s1 = "foobarbaz";
+ const char *s2 = "abcde12345678";
+ strncpy (x, s1, sizeof (s1)); // { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" }
+ strncat (x, s2, sizeof (s2)); // { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" }
+ stpncpy (x, s1, sizeof (s1)); // { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" }
+ y[0] = strndup (s1, sizeof (s1)); // { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" }
+ z += strncmp (s1, s2, sizeof (s1)); // { dg-warning "call is the same expression as the first source; did you mean to provide an explicit length" }
+ z += strncmp (s1, s2, sizeof (s2)); // { dg-warning "call is the same expression as the second source; did you mean to provide an explicit length" }
+ z += strncasecmp (s1, s2, sizeof (s1)); // { dg-warning "call is the same expression as the first source; did you mean to provide an explicit length" }
+ z += strncasecmp (s1, s2, sizeof (s2)); // { dg-warning "call is the same expression as the second source; did you mean to provide an explicit length" }
+
+ strncpy (w, s1, sizeof (w)); // { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" }
+ strncat (w, s2, sizeof (w)); // { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" }
+ stpncpy (w, s1, sizeof (w)); // { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" }
+
+ // These are correct, no warning.
+ const char s3[] = "foobarbaz";
+ const char s4[] = "abcde12345678";
+ strncpy (x, s3, sizeof (s3));
+ strncat (x, s4, sizeof (s4));
+ stpncpy (x, s3, sizeof (s3));
+ y[1] = strndup (s3, sizeof (s3));
+ z += strncmp (s3, s4, sizeof (s3));
+ z += strncmp (s3, s4, sizeof (s4));
+ z += strncasecmp (s3, s4, sizeof (s3));
+ z += strncasecmp (s3, s4, sizeof (s4));
+
+ return z;
+}
+
+// { dg-prune-output "\[\n\r\]*will always overflow\[\n\r\]*" }
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/Wsizeof-pointer-memaccess2.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/Wsizeof-pointer-memaccess2.C
new file mode 100644
index 000000000..9e2805d2b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/Wsizeof-pointer-memaccess2.C
@@ -0,0 +1,730 @@
+// Test -Wsizeof-pointer-memaccess warnings.
+// { dg-do compile }
+// { dg-options "-Wall" }
+// Test just twice, once with -O0 non-fortified, once with -O2 fortified.
+// { dg-skip-if "" { *-*-* } { "*" } { "-O0" "-O2" } }
+// { dg-skip-if "" { *-*-* } { "-flto" } { "" } }
+
+extern "C" {
+
+typedef __SIZE_TYPE__ size_t;
+extern void *memset (void *, int, size_t);
+extern void *memcpy (void *__restrict, const void *__restrict, size_t);
+extern void *memmove (void *__restrict, const void *__restrict, size_t);
+extern int memcmp (const void *, const void *, size_t);
+extern char *strncpy (char *__restrict, const char *__restrict, size_t);
+extern char *strncat (char *__restrict, const char *__restrict, size_t);
+extern char *stpncpy (char *__restrict, const char *__restrict, size_t);
+extern char *strndup (const char *, size_t);
+extern int strncmp (const char *, const char *, size_t);
+extern int strncasecmp (const char *, const char *, size_t);
+
+#ifdef __OPTIMIZE__
+# define bos(ptr) __builtin_object_size (ptr, 1)
+# define bos0(ptr) __builtin_object_size (ptr, 0)
+
+__attribute__((__always_inline__, __gnu_inline__, __artificial__))
+extern inline void *
+memset (void *dest, int c, size_t len)
+{
+ return __builtin___memset_chk (dest, c, len, bos0 (dest));
+}
+
+__attribute__((__always_inline__, __gnu_inline__, __artificial__))
+extern inline void *
+memcpy (void *__restrict dest, const void *__restrict src, size_t len)
+{
+ return __builtin___memcpy_chk (dest, src, len, bos0 (dest));
+}
+
+__attribute__((__always_inline__, __gnu_inline__, __artificial__))
+extern inline void *
+memmove (void *dest, const void *src, size_t len)
+{
+ return __builtin___memmove_chk (dest, src, len, bos0 (dest));
+}
+
+__attribute__((__always_inline__, __gnu_inline__, __artificial__))
+extern inline char *
+strncpy (char *__restrict dest, const char *__restrict src, size_t len)
+{
+ return __builtin___strncpy_chk (dest, src, len, bos (dest));
+}
+
+__attribute__((__always_inline__, __gnu_inline__, __artificial__))
+extern inline char *
+strncat (char *dest, const char *src, size_t len)
+{
+ return __builtin___strncat_chk (dest, src, len, bos (dest));
+}
+
+__attribute__((__always_inline__, __gnu_inline__, __artificial__))
+extern inline char *
+stpncpy (char *__restrict dest, const char *__restrict src, size_t len)
+{
+ return __builtin___stpncpy_chk (dest, src, len, bos (dest));
+}
+#endif
+
+}
+
+struct A { short a, b; int c, d; long e, f; };
+typedef struct A TA;
+typedef struct A *PA;
+typedef TA *PTA;
+struct B {};
+typedef struct B TB;
+typedef struct B *PB;
+typedef TB *PTB;
+typedef int X[3][3][3];
+
+template <int N>
+int
+f1 (void *x, int z)
+{
+ struct A a, *pa1 = &a;
+ TA *pa2 = &a;
+ PA pa3 = &a;
+ PTA pa4 = &a;
+ memset (&a, 0, sizeof (&a)); // { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" }
+ memset (pa1, 0, sizeof (pa1)); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memset (pa2, 0, sizeof pa2); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memset (pa3, 0, sizeof (pa3)); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memset (pa4, 0, sizeof pa4); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memset (pa1, 0, sizeof (struct A *)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memset (pa2, 0, sizeof (PTA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memset (pa3, 0, sizeof (PA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memset (pa4, 0, sizeof (__typeof (pa4))); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+
+ memcpy (&a, x, sizeof (&a)); // { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" }
+ memcpy (pa1, x, sizeof (pa1)); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memcpy (pa2, x, sizeof pa2); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memcpy (pa3, x, sizeof (pa3)); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memcpy (pa4, x, sizeof pa4); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memcpy (pa1, x, sizeof (struct A *)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memcpy (pa2, x, sizeof (PTA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memcpy (pa3, x, sizeof (PA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memcpy (pa4, x, sizeof (__typeof (pa4))); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+
+ memcpy (x, &a, sizeof (&a)); // { dg-warning "call is the same expression as the source; did you mean to remove the addressof" }
+ memcpy (x, pa1, sizeof (pa1)); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memcpy (x, pa2, sizeof pa2); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memcpy (x, pa3, sizeof (pa3)); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memcpy (x, pa4, sizeof pa4); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memcpy (x, pa1, sizeof (struct A *)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+ memcpy (x, pa2, sizeof (PTA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+ memcpy (x, pa3, sizeof (PA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+ memcpy (x, pa4, sizeof (__typeof (pa4))); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+
+ memmove (&a, x, sizeof (&a)); // { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" }
+ memmove (pa1, x, sizeof (pa1)); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memmove (pa2, x, sizeof pa2); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memmove (pa3, x, sizeof (pa3)); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memmove (pa4, x, sizeof pa4); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memmove (pa1, x, sizeof (struct A *)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memmove (pa2, x, sizeof (PTA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memmove (pa3, x, sizeof (PA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memmove (pa4, x, sizeof (__typeof (pa4)));// { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+
+ memmove (x, &a, sizeof (&a)); // { dg-warning "call is the same expression as the source; did you mean to remove the addressof" }
+ memmove (x, pa1, sizeof (pa1)); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memmove (x, pa2, sizeof pa2); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memmove (x, pa3, sizeof (pa3)); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memmove (x, pa4, sizeof pa4); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memmove (x, pa1, sizeof (struct A *)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+ memmove (x, pa2, sizeof (PTA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+ memmove (x, pa3, sizeof (PA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+ memmove (x, pa4, sizeof (__typeof (pa4)));// { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+
+ z += memcmp (&a, x, sizeof (&a)); // { dg-warning "call is the same expression as the first source; did you mean to remove the addressof" }
+ z += memcmp (pa1, x, sizeof (pa1)); // { dg-warning "call is the same expression as the first source; did you mean to dereference it" }
+ z += memcmp (pa2, x, sizeof pa2); // { dg-warning "call is the same expression as the first source; did you mean to dereference it" }
+ z += memcmp (pa3, x, sizeof (pa3)); // { dg-warning "call is the same expression as the first source; did you mean to dereference it" }
+ z += memcmp (pa4, x, sizeof pa4); // { dg-warning "call is the same expression as the first source; did you mean to dereference it" }
+ z += memcmp (pa1, x, sizeof (struct A *));// { dg-warning "call is the same pointer type \[^\n\r\]* as the first source; expected \[^\n\r\]* or an explicit length" }
+ z += memcmp (pa2, x, sizeof (PTA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the first source; expected \[^\n\r\]* or an explicit length" }
+ z += memcmp (pa3, x, sizeof (PA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the first source; expected \[^\n\r\]* or an explicit length" }
+
+ z += memcmp (x, &a, sizeof (&a)); // { dg-warning "call is the same expression as the second source; did you mean to remove the addressof" }
+ z += memcmp (x, pa1, sizeof (pa1)); // { dg-warning "call is the same expression as the second source; did you mean to dereference it" }
+ z += memcmp (x, pa2, sizeof pa2); // { dg-warning "call is the same expression as the second source; did you mean to dereference it" }
+ z += memcmp (x, pa3, sizeof (pa3)); // { dg-warning "call is the same expression as the second source; did you mean to dereference it" }
+ z += memcmp (x, pa4, sizeof pa4); // { dg-warning "call is the same expression as the second source; did you mean to dereference it" }
+ z += memcmp (x, pa1, sizeof (struct A *));// { dg-warning "call is the same pointer type \[^\n\r\]* as the second source; expected \[^\n\r\]* or an explicit length" }
+ z += memcmp (x, pa2, sizeof (PTA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the second source; expected \[^\n\r\]* or an explicit length" }
+ z += memcmp (x, pa3, sizeof (PA)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the second source; expected \[^\n\r\]* or an explicit length" }
+
+ // These are correct, no warning.
+ memset (&a, 0, sizeof a);
+ memset (&a, 0, sizeof (a));
+ memset (&a, 0, sizeof (struct A));
+ memset (&a, 0, sizeof (const struct A));
+ memset (&a, 0, sizeof (volatile struct A));
+ memset (&a, 0, sizeof (volatile const struct A));
+ memset (&a, 0, sizeof (TA));
+ memset (&a, 0, sizeof (__typeof (*&a)));
+ memset (pa1, 0, sizeof (*pa1));
+ memset (pa2, 0, sizeof (*pa3));
+ memset (pa3, 0, sizeof (__typeof (*pa3)));
+ // These are probably broken, but obfuscated, no warning.
+ memset ((void *) &a, 0, sizeof (&a));
+ memset ((char *) &a, 0, sizeof (&a));
+ memset (&a, 0, sizeof (&a) + 0);
+ memset (&a, 0, 0 + sizeof (&a));
+
+ // These are correct, no warning.
+ memcpy (&a, x, sizeof a);
+ memcpy (&a, x, sizeof (a));
+ memcpy (&a, x, sizeof (struct A));
+ memcpy (&a, x, sizeof (const struct A));
+ memcpy (&a, x, sizeof (volatile struct A));
+ memcpy (&a, x, sizeof (volatile const struct A));
+ memcpy (&a, x, sizeof (TA));
+ memcpy (&a, x, sizeof (__typeof (*&a)));
+ memcpy (pa1, x, sizeof (*pa1));
+ memcpy (pa2, x, sizeof (*pa3));
+ memcpy (pa3, x, sizeof (__typeof (*pa3)));
+ // These are probably broken, but obfuscated, no warning.
+ memcpy ((void *) &a, x, sizeof (&a));
+ memcpy ((char *) &a, x, sizeof (&a));
+ memcpy (&a, x, sizeof (&a) + 0);
+ memcpy (&a, x, 0 + sizeof (&a));
+
+ // These are correct, no warning.
+ memcpy (x, &a, sizeof a);
+ memcpy (x, &a, sizeof (a));
+ memcpy (x, &a, sizeof (struct A));
+ memcpy (x, &a, sizeof (const struct A));
+ memcpy (x, &a, sizeof (volatile struct A));
+ memcpy (x, &a, sizeof (volatile const struct A));
+ memcpy (x, &a, sizeof (TA));
+ memcpy (x, &a, sizeof (__typeof (*&a)));
+ memcpy (x, pa1, sizeof (*pa1));
+ memcpy (x, pa2, sizeof (*pa3));
+ memcpy (x, pa3, sizeof (__typeof (*pa3)));
+ // These are probably broken, but obfuscated, no warning.
+ memcpy (x, (void *) &a, sizeof (&a));
+ memcpy (x, (char *) &a, sizeof (&a));
+ memcpy (x, &a, sizeof (&a) + 0);
+ memcpy (x, &a, 0 + sizeof (&a));
+
+ // These are correct, no warning.
+ memmove (&a, x, sizeof a);
+ memmove (&a, x, sizeof (a));
+ memmove (&a, x, sizeof (struct A));
+ memmove (&a, x, sizeof (const struct A));
+ memmove (&a, x, sizeof (volatile struct A));
+ memmove (&a, x, sizeof (volatile const struct A));
+ memmove (&a, x, sizeof (TA));
+ memmove (&a, x, sizeof (__typeof (*&a)));
+ memmove (pa1, x, sizeof (*pa1));
+ memmove (pa2, x, sizeof (*pa3));
+ memmove (pa3, x, sizeof (__typeof (*pa3)));
+ // These are probably broken, but obfuscated, no warning.
+ memmove ((void *) &a, x, sizeof (&a));
+ memmove ((char *) &a, x, sizeof (&a));
+ memmove (&a, x, sizeof (&a) + 0);
+ memmove (&a, x, 0 + sizeof (&a));
+
+ // These are correct, no warning.
+ memmove (x, &a, sizeof a);
+ memmove (x, &a, sizeof (a));
+ memmove (x, &a, sizeof (struct A));
+ memmove (x, &a, sizeof (const struct A));
+ memmove (x, &a, sizeof (volatile struct A));
+ memmove (x, &a, sizeof (volatile const struct A));
+ memmove (x, &a, sizeof (TA));
+ memmove (x, &a, sizeof (__typeof (*&a)));
+ memmove (x, pa1, sizeof (*pa1));
+ memmove (x, pa2, sizeof (*pa3));
+ memmove (x, pa3, sizeof (__typeof (*pa3)));
+ // These are probably broken, but obfuscated, no warning.
+ memmove (x, (void *) &a, sizeof (&a));
+ memmove (x, (char *) &a, sizeof (&a));
+ memmove (x, &a, sizeof (&a) + 0);
+ memmove (x, &a, 0 + sizeof (&a));
+
+ // These are correct, no warning.
+ z += memcmp (&a, x, sizeof a);
+ z += memcmp (&a, x, sizeof (a));
+ z += memcmp (&a, x, sizeof (struct A));
+ z += memcmp (&a, x, sizeof (const struct A));
+ z += memcmp (&a, x, sizeof (volatile struct A));
+ z += memcmp (&a, x, sizeof (volatile const struct A));
+ z += memcmp (&a, x, sizeof (TA));
+ z += memcmp (&a, x, sizeof (__typeof (*&a)));
+ z += memcmp (pa1, x, sizeof (*pa1));
+ z += memcmp (pa2, x, sizeof (*pa3));
+ z += memcmp (pa3, x, sizeof (__typeof (*pa3)));
+ // These are probably broken, but obfuscated, no warning.
+ z += memcmp ((void *) &a, x, sizeof (&a));
+ z += memcmp ((char *) &a, x, sizeof (&a));
+ z += memcmp (&a, x, sizeof (&a) + 0);
+ z += memcmp (&a, x, 0 + sizeof (&a));
+
+ // These are correct, no warning.
+ z += memcmp (x, &a, sizeof a);
+ z += memcmp (x, &a, sizeof (a));
+ z += memcmp (x, &a, sizeof (struct A));
+ z += memcmp (x, &a, sizeof (const struct A));
+ z += memcmp (x, &a, sizeof (volatile struct A));
+ z += memcmp (x, &a, sizeof (volatile const struct A));
+ z += memcmp (x, &a, sizeof (TA));
+ z += memcmp (x, &a, sizeof (__typeof (*&a)));
+ z += memcmp (x, pa1, sizeof (*pa1));
+ z += memcmp (x, pa2, sizeof (*pa3));
+ z += memcmp (x, pa3, sizeof (__typeof (*pa3)));
+ // These are probably broken, but obfuscated, no warning.
+ z += memcmp (x, (void *) &a, sizeof (&a));
+ z += memcmp (x, (char *) &a, sizeof (&a));
+ z += memcmp (x, &a, sizeof (&a) + 0);
+ z += memcmp (x, &a, 0 + sizeof (&a));
+
+ return z;
+}
+
+template <int N>
+int
+f2 (void *x, int z)
+{
+ struct B b, *pb1 = &b;
+ TB *pb2 = &b;
+ PB pb3 = &b;
+ PTB pb4 = &b;
+ memset (&b, 0, sizeof (&b)); // { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" }
+ memset (pb1, 0, sizeof (pb1)); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memset (pb2, 0, sizeof pb2); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memset (pb3, 0, sizeof (pb3)); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memset (pb4, 0, sizeof pb4); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memset (pb1, 0, sizeof (struct B *)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memset (pb2, 0, sizeof (PTB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memset (pb3, 0, sizeof (PB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memset (pb4, 0, sizeof (__typeof (pb4))); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+
+ memcpy (&b, x, sizeof (&b)); // { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" }
+ memcpy (pb1, x, sizeof (pb1)); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memcpy (pb2, x, sizeof pb2); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memcpy (pb3, x, sizeof (pb3)); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memcpy (pb4, x, sizeof pb4); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memcpy (pb1, x, sizeof (struct B *)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memcpy (pb2, x, sizeof (PTB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memcpy (pb3, x, sizeof (PB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memcpy (pb4, x, sizeof (__typeof (pb4))); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+
+ memcpy (x, &b, sizeof (&b)); // { dg-warning "call is the same expression as the source; did you mean to remove the addressof" }
+ memcpy (x, pb1, sizeof (pb1)); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memcpy (x, pb2, sizeof pb2); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memcpy (x, pb3, sizeof (pb3)); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memcpy (x, pb4, sizeof pb4); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memcpy (x, pb1, sizeof (struct B *)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+ memcpy (x, pb2, sizeof (PTB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+ memcpy (x, pb3, sizeof (PB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+ memcpy (x, pb4, sizeof (__typeof (pb4))); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+
+ memmove (&b, x, sizeof (&b)); // { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" }
+ memmove (pb1, x, sizeof (pb1)); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memmove (pb2, x, sizeof pb2); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memmove (pb3, x, sizeof (pb3)); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memmove (pb4, x, sizeof pb4); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+ memmove (pb1, x, sizeof (struct B *)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memmove (pb2, x, sizeof (PTB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memmove (pb3, x, sizeof (PB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+ memmove (pb4, x, sizeof (__typeof (pb4)));// { dg-warning "call is the same pointer type \[^\n\r\]* as the destination; expected \[^\n\r\]* or an explicit length" }
+
+ memmove (x, &b, sizeof (&b)); // { dg-warning "call is the same expression as the source; did you mean to remove the addressof" }
+ memmove (x, pb1, sizeof (pb1)); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memmove (x, pb2, sizeof pb2); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memmove (x, pb3, sizeof (pb3)); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memmove (x, pb4, sizeof pb4); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+ memmove (x, pb1, sizeof (struct B *)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+ memmove (x, pb2, sizeof (PTB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+ memmove (x, pb3, sizeof (PB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+ memmove (x, pb4, sizeof (__typeof (pb4)));// { dg-warning "call is the same pointer type \[^\n\r\]* as the source; expected \[^\n\r\]* or an explicit length" }
+
+ z += memcmp (&b, x, sizeof (&b)); // { dg-warning "call is the same expression as the first source; did you mean to remove the addressof" }
+ z += memcmp (pb1, x, sizeof (pb1)); // { dg-warning "call is the same expression as the first source; did you mean to dereference it" }
+ z += memcmp (pb2, x, sizeof pb2); // { dg-warning "call is the same expression as the first source; did you mean to dereference it" }
+ z += memcmp (pb3, x, sizeof (pb3)); // { dg-warning "call is the same expression as the first source; did you mean to dereference it" }
+ z += memcmp (pb4, x, sizeof pb4); // { dg-warning "call is the same expression as the first source; did you mean to dereference it" }
+ z += memcmp (pb1, x, sizeof (struct B *));// { dg-warning "call is the same pointer type \[^\n\r\]* as the first source; expected \[^\n\r\]* or an explicit length" }
+ z += memcmp (pb2, x, sizeof (PTB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the first source; expected \[^\n\r\]* or an explicit length" }
+ z += memcmp (pb3, x, sizeof (PB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the first source; expected \[^\n\r\]* or an explicit length" }
+
+ z += memcmp (x, &b, sizeof (&b)); // { dg-warning "call is the same expression as the second source; did you mean to remove the addressof" }
+ z += memcmp (x, pb1, sizeof (pb1)); // { dg-warning "call is the same expression as the second source; did you mean to dereference it" }
+ z += memcmp (x, pb2, sizeof pb2); // { dg-warning "call is the same expression as the second source; did you mean to dereference it" }
+ z += memcmp (x, pb3, sizeof (pb3)); // { dg-warning "call is the same expression as the second source; did you mean to dereference it" }
+ z += memcmp (x, pb4, sizeof pb4); // { dg-warning "call is the same expression as the second source; did you mean to dereference it" }
+ z += memcmp (x, pb1, sizeof (struct B *));// { dg-warning "call is the same pointer type \[^\n\r\]* as the second source; expected \[^\n\r\]* or an explicit length" }
+ z += memcmp (x, pb2, sizeof (PTB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the second source; expected \[^\n\r\]* or an explicit length" }
+ z += memcmp (x, pb3, sizeof (PB)); // { dg-warning "call is the same pointer type \[^\n\r\]* as the second source; expected \[^\n\r\]* or an explicit length" }
+
+ // These are correct, no warning.
+ memset (&b, 0, sizeof b);
+ memset (&b, 0, sizeof (b));
+ memset (&b, 0, sizeof (struct B));
+ memset (&b, 0, sizeof (const struct B));
+ memset (&b, 0, sizeof (volatile struct B));
+ memset (&b, 0, sizeof (volatile const struct B));
+ memset (&b, 0, sizeof (TB));
+ memset (&b, 0, sizeof (__typeof (*&b)));
+ memset (pb1, 0, sizeof (*pb1));
+ memset (pb2, 0, sizeof (*pb3));
+ memset (pb3, 0, sizeof (__typeof (*pb3)));
+ // These are probably broken, but obfuscated, no warning.
+ memset ((void *) &b, 0, sizeof (&b));
+ memset ((char *) &b, 0, sizeof (&b));
+ memset (&b, 0, sizeof (&b) + 0);
+ memset (&b, 0, 0 + sizeof (&b));
+
+ // These are correct, no warning.
+ memcpy (&b, x, sizeof b);
+ memcpy (&b, x, sizeof (b));
+ memcpy (&b, x, sizeof (struct B));
+ memcpy (&b, x, sizeof (const struct B));
+ memcpy (&b, x, sizeof (volatile struct B));
+ memcpy (&b, x, sizeof (volatile const struct B));
+ memcpy (&b, x, sizeof (TB));
+ memcpy (&b, x, sizeof (__typeof (*&b)));
+ memcpy (pb1, x, sizeof (*pb1));
+ memcpy (pb2, x, sizeof (*pb3));
+ memcpy (pb3, x, sizeof (__typeof (*pb3)));
+ // These are probably broken, but obfuscated, no warning.
+ memcpy ((void *) &b, x, sizeof (&b));
+ memcpy ((char *) &b, x, sizeof (&b));
+ memcpy (&b, x, sizeof (&b) + 0);
+ memcpy (&b, x, 0 + sizeof (&b));
+
+ // These are correct, no warning.
+ memcpy (x, &b, sizeof b);
+ memcpy (x, &b, sizeof (b));
+ memcpy (x, &b, sizeof (struct B));
+ memcpy (x, &b, sizeof (const struct B));
+ memcpy (x, &b, sizeof (volatile struct B));
+ memcpy (x, &b, sizeof (volatile const struct B));
+ memcpy (x, &b, sizeof (TB));
+ memcpy (x, &b, sizeof (__typeof (*&b)));
+ memcpy (x, pb1, sizeof (*pb1));
+ memcpy (x, pb2, sizeof (*pb3));
+ memcpy (x, pb3, sizeof (__typeof (*pb3)));
+ // These are probably broken, but obfuscated, no warning.
+ memcpy (x, (void *) &b, sizeof (&b));
+ memcpy (x, (char *) &b, sizeof (&b));
+ memcpy (x, &b, sizeof (&b) + 0);
+ memcpy (x, &b, 0 + sizeof (&b));
+
+ // These are correct, no warning.
+ memmove (&b, x, sizeof b);
+ memmove (&b, x, sizeof (b));
+ memmove (&b, x, sizeof (struct B));
+ memmove (&b, x, sizeof (const struct B));
+ memmove (&b, x, sizeof (volatile struct B));
+ memmove (&b, x, sizeof (volatile const struct B));
+ memmove (&b, x, sizeof (TB));
+ memmove (&b, x, sizeof (__typeof (*&b)));
+ memmove (pb1, x, sizeof (*pb1));
+ memmove (pb2, x, sizeof (*pb3));
+ memmove (pb3, x, sizeof (__typeof (*pb3)));
+ // These are probably broken, but obfuscated, no warning.
+ memmove ((void *) &b, x, sizeof (&b));
+ memmove ((char *) &b, x, sizeof (&b));
+ memmove (&b, x, sizeof (&b) + 0);
+ memmove (&b, x, 0 + sizeof (&b));
+
+ // These are correct, no warning.
+ memmove (x, &b, sizeof b);
+ memmove (x, &b, sizeof (b));
+ memmove (x, &b, sizeof (struct B));
+ memmove (x, &b, sizeof (const struct B));
+ memmove (x, &b, sizeof (volatile struct B));
+ memmove (x, &b, sizeof (volatile const struct B));
+ memmove (x, &b, sizeof (TB));
+ memmove (x, &b, sizeof (__typeof (*&b)));
+ memmove (x, pb1, sizeof (*pb1));
+ memmove (x, pb2, sizeof (*pb3));
+ memmove (x, pb3, sizeof (__typeof (*pb3)));
+ // These are probably broken, but obfuscated, no warning.
+ memmove (x, (void *) &b, sizeof (&b));
+ memmove (x, (char *) &b, sizeof (&b));
+ memmove (x, &b, sizeof (&b) + 0);
+ memmove (x, &b, 0 + sizeof (&b));
+
+ // These are correct, no warning.
+ z += memcmp (&b, x, sizeof b);
+ z += memcmp (&b, x, sizeof (b));
+ z += memcmp (&b, x, sizeof (struct B));
+ z += memcmp (&b, x, sizeof (const struct B));
+ z += memcmp (&b, x, sizeof (volatile struct B));
+ z += memcmp (&b, x, sizeof (volatile const struct B));
+ z += memcmp (&b, x, sizeof (TB));
+ z += memcmp (&b, x, sizeof (__typeof (*&b)));
+ z += memcmp (pb1, x, sizeof (*pb1));
+ z += memcmp (pb2, x, sizeof (*pb3));
+ z += memcmp (pb3, x, sizeof (__typeof (*pb3)));
+ // These are probably broken, but obfuscated, no warning.
+ z += memcmp ((void *) &b, x, sizeof (&b));
+ z += memcmp ((char *) &b, x, sizeof (&b));
+ z += memcmp (&b, x, sizeof (&b) + 0);
+ z += memcmp (&b, x, 0 + sizeof (&b));
+
+ // These are correct, no warning.
+ z += memcmp (x, &b, sizeof b);
+ z += memcmp (x, &b, sizeof (b));
+ z += memcmp (x, &b, sizeof (struct B));
+ z += memcmp (x, &b, sizeof (const struct B));
+ z += memcmp (x, &b, sizeof (volatile struct B));
+ z += memcmp (x, &b, sizeof (volatile const struct B));
+ z += memcmp (x, &b, sizeof (TB));
+ z += memcmp (x, &b, sizeof (__typeof (*&b)));
+ z += memcmp (x, pb1, sizeof (*pb1));
+ z += memcmp (x, pb2, sizeof (*pb3));
+ z += memcmp (x, pb3, sizeof (__typeof (*pb3)));
+ // These are probably broken, but obfuscated, no warning.
+ z += memcmp (x, (void *) &b, sizeof (&b));
+ z += memcmp (x, (char *) &b, sizeof (&b));
+ z += memcmp (x, &b, sizeof (&b) + 0);
+ z += memcmp (x, &b, 0 + sizeof (&b));
+
+ return z;
+}
+
+template <int N>
+int
+f3 (void *x, char *y, int z, X w)
+{
+ unsigned char *y1 = (unsigned char *) __builtin_alloca (z + 16);
+ char buf1[7];
+ signed char buf2[z + 32];
+ long buf3[17];
+ int *buf4[9];
+ signed char *y2 = buf2;
+ char c;
+ char *y3;
+ memset (y, 0, sizeof (y)); // { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" }
+ memset (y1, 0, sizeof (y1)); // { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" }
+ memset (y2, 0, sizeof (y2)); // { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" }
+ memset (&c, 0, sizeof (&c)); // { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" }
+ memset (w, 0, sizeof w); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+
+ memcpy (y, x, sizeof (y)); // { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" }
+ memcpy (y1, x, sizeof (y1)); // { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" }
+ memcpy (y2, x, sizeof (y2)); // { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" }
+ memcpy (&c, x, sizeof (&c)); // { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" }
+ memcpy (w, x, sizeof w); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+
+ memcpy (x, y, sizeof (y)); // { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" }
+ memcpy (x, y1, sizeof (y1)); // { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" }
+ memcpy (x, y2, sizeof (y2)); // { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" }
+ memcpy (x, &c, sizeof (&c)); // { dg-warning "call is the same expression as the source; did you mean to remove the addressof" }
+ memcpy (x, w, sizeof w); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+
+ memmove (y, x, sizeof (y)); // { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" }
+ memmove (y1, x, sizeof (y1)); // { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" }
+ memmove (y2, x, sizeof (y2)); // { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" }
+ memmove (&c, x, sizeof (&c)); // { dg-warning "call is the same expression as the destination; did you mean to remove the addressof" }
+ memmove (w, x, sizeof w); // { dg-warning "call is the same expression as the destination; did you mean to dereference it" }
+
+ memmove (x, y, sizeof (y)); // { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" }
+ memmove (x, y1, sizeof (y1)); // { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" }
+ memmove (x, y2, sizeof (y2)); // { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" }
+ memmove (x, &c, sizeof (&c)); // { dg-warning "call is the same expression as the source; did you mean to remove the addressof" }
+ memmove (x, w, sizeof w); // { dg-warning "call is the same expression as the source; did you mean to dereference it" }
+
+ z += memcmp (y, x, sizeof (y)); // { dg-warning "call is the same expression as the first source; did you mean to provide an explicit length" }
+ z += memcmp (y1, x, sizeof (y1)); // { dg-warning "call is the same expression as the first source; did you mean to provide an explicit length" }
+ z += memcmp (y2, x, sizeof (y2)); // { dg-warning "call is the same expression as the first source; did you mean to provide an explicit length" }
+ z += memcmp (&c, x, sizeof (&c)); // { dg-warning "call is the same expression as the first source; did you mean to remove the addressof" }
+ z += memcmp (w, x, sizeof w); // { dg-warning "call is the same expression as the first source; did you mean to dereference it" }
+
+ z += memcmp (x, y, sizeof (y)); // { dg-warning "call is the same expression as the second source; did you mean to provide an explicit length" }
+ z += memcmp (x, y1, sizeof (y1)); // { dg-warning "call is the same expression as the second source; did you mean to provide an explicit length" }
+ z += memcmp (x, y2, sizeof (y2)); // { dg-warning "call is the same expression as the second source; did you mean to provide an explicit length" }
+ z += memcmp (x, &c, sizeof (&c)); // { dg-warning "call is the same expression as the second source; did you mean to remove the addressof" }
+ z += memcmp (x, w, sizeof w); // { dg-warning "call is the same expression as the second source; did you mean to dereference it" }
+
+ // These are correct, no warning.
+ memset (y, 0, sizeof (*y));
+ memset (y1, 0, sizeof (*y2));
+ memset (buf1, 0, sizeof buf1);
+ memset (buf3, 0, sizeof (buf3));
+ memset (&buf3[0], 0, sizeof (buf3));
+ memset (&buf4[0], 0, sizeof (buf4));
+ memset (w, 0, sizeof (X));
+ // These are probably broken, but obfuscated, no warning.
+ memset ((void *) y, 0, sizeof (y));
+ memset ((char *) y1, 0, sizeof (y2));
+ memset (y, 0, sizeof (y) + 0);
+ memset (y1, 0, 0 + sizeof (y2));
+ memset ((void *) &c, 0, sizeof (&c));
+ memset ((signed char *) &c, 0, sizeof (&c));
+ memset (&c, 0, sizeof (&c) + 0);
+ memset (&c, 0, 0 + sizeof (&c));
+
+ // These are correct, no warning.
+ memcpy (y, x, sizeof (*y));
+ memcpy (y1, x, sizeof (*y2));
+ memcpy (buf1, x, sizeof buf1);
+ memcpy (buf3, x, sizeof (buf3));
+ memcpy (&buf3[0], x, sizeof (buf3));
+ memcpy (&buf4[0], x, sizeof (buf4));
+ memcpy (&y3, y, sizeof (y3));
+ memcpy ((char *) &y3, y, sizeof (y3));
+ memcpy (w, x, sizeof (X));
+ // These are probably broken, but obfuscated, no warning.
+ memcpy ((void *) y, x, sizeof (y));
+ memcpy ((char *) y1, x, sizeof (y2));
+ memcpy (y, x, sizeof (y) + 0);
+ memcpy (y1, x, 0 + sizeof (y2));
+ memcpy ((void *) &c, x, sizeof (&c));
+ memcpy ((signed char *) &c, x, sizeof (&c));
+ memcpy (&c, x, sizeof (&c) + 0);
+ memcpy (&c, x, 0 + sizeof (&c));
+
+ // These are correct, no warning.
+ memcpy (x, y, sizeof (*y));
+ memcpy (x, y1, sizeof (*y2));
+ memcpy (x, buf1, sizeof buf1);
+ memcpy (x, buf3, sizeof (buf3));
+ memcpy (x, &buf3[0], sizeof (buf3));
+ memcpy (x, &buf4[0], sizeof (buf4));
+ memcpy (y, &y3, sizeof (y3));
+ memcpy (y, (char *) &y3, sizeof (y3));
+ memcpy (x, w, sizeof (X));
+ // These are probably broken, but obfuscated, no warning.
+ memcpy (x, (void *) y, sizeof (y));
+ memcpy (x, (char *) y1, sizeof (y2));
+ memcpy (x, y, sizeof (y) + 0);
+ memcpy (x, y1, 0 + sizeof (y2));
+ memcpy (x, (void *) &c, sizeof (&c));
+ memcpy (x, (signed char *) &c, sizeof (&c));
+ memcpy (x, &c, sizeof (&c) + 0);
+ memcpy (x, &c, 0 + sizeof (&c));
+
+ // These are correct, no warning.
+ memmove (y, x, sizeof (*y));
+ memmove (y1, x, sizeof (*y2));
+ memmove (buf1, x, sizeof buf1);
+ memmove (buf3, x, sizeof (buf3));
+ memmove (&buf3[0], x, sizeof (buf3));
+ memmove (&buf4[0], x, sizeof (buf4));
+ memmove (&y3, y, sizeof (y3));
+ memmove ((char *) &y3, y, sizeof (y3));
+ memmove (w, x, sizeof (X));
+ // These are probably broken, but obfuscated, no warning.
+ memmove ((void *) y, x, sizeof (y));
+ memmove ((char *) y1, x, sizeof (y2));
+ memmove (y, x, sizeof (y) + 0);
+ memmove (y1, x, 0 + sizeof (y2));
+ memmove ((void *) &c, x, sizeof (&c));
+ memmove ((signed char *) &c, x, sizeof (&c));
+ memmove (&c, x, sizeof (&c) + 0);
+ memmove (&c, x, 0 + sizeof (&c));
+
+ // These are correct, no warning.
+ memmove (x, y, sizeof (*y));
+ memmove (x, y1, sizeof (*y2));
+ memmove (x, buf1, sizeof buf1);
+ memmove (x, buf3, sizeof (buf3));
+ memmove (x, &buf3[0], sizeof (buf3));
+ memmove (x, &buf4[0], sizeof (buf4));
+ memmove (y, &y3, sizeof (y3));
+ memmove (y, (char *) &y3, sizeof (y3));
+ memmove (x, w, sizeof (X));
+ // These are probably broken, but obfuscated, no warning.
+ memmove (x, (void *) y, sizeof (y));
+ memmove (x, (char *) y1, sizeof (y2));
+ memmove (x, y, sizeof (y) + 0);
+ memmove (x, y1, 0 + sizeof (y2));
+ memmove (x, (void *) &c, sizeof (&c));
+ memmove (x, (signed char *) &c, sizeof (&c));
+ memmove (x, &c, sizeof (&c) + 0);
+ memmove (x, &c, 0 + sizeof (&c));
+
+ // These are correct, no warning.
+ z += memcmp (y, x, sizeof (*y));
+ z += memcmp (y1, x, sizeof (*y2));
+ z += memcmp (buf1, x, sizeof buf1);
+ z += memcmp (buf3, x, sizeof (buf3));
+ z += memcmp (&buf3[0], x, sizeof (buf3));
+ z += memcmp (&buf4[0], x, sizeof (buf4));
+ z += memcmp (&y3, y, sizeof (y3));
+ z += memcmp ((char *) &y3, y, sizeof (y3));
+ z += memcmp (w, x, sizeof (X));
+ // These are probably broken, but obfuscated, no warning.
+ z += memcmp ((void *) y, x, sizeof (y));
+ z += memcmp ((char *) y1, x, sizeof (y2));
+ z += memcmp (y, x, sizeof (y) + 0);
+ z += memcmp (y1, x, 0 + sizeof (y2));
+ z += memcmp ((void *) &c, x, sizeof (&c));
+ z += memcmp ((signed char *) &c, x, sizeof (&c));
+ z += memcmp (&c, x, sizeof (&c) + 0);
+ z += memcmp (&c, x, 0 + sizeof (&c));
+
+ // These are correct, no warning.
+ z += memcmp (x, y, sizeof (*y));
+ z += memcmp (x, y1, sizeof (*y2));
+ z += memcmp (x, buf1, sizeof buf1);
+ z += memcmp (x, buf3, sizeof (buf3));
+ z += memcmp (x, &buf3[0], sizeof (buf3));
+ z += memcmp (x, &buf4[0], sizeof (buf4));
+ z += memcmp (y, &y3, sizeof (y3));
+ z += memcmp (y, (char *) &y3, sizeof (y3));
+ z += memcmp (x, w, sizeof (X));
+ // These are probably broken, but obfuscated, no warning.
+ z += memcmp (x, (void *) y, sizeof (y));
+ z += memcmp (x, (char *) y1, sizeof (y2));
+ z += memcmp (x, y, sizeof (y) + 0);
+ z += memcmp (x, y1, 0 + sizeof (y2));
+ z += memcmp (x, (void *) &c, sizeof (&c));
+ z += memcmp (x, (signed char *) &c, sizeof (&c));
+ z += memcmp (x, &c, sizeof (&c) + 0);
+ z += memcmp (x, &c, 0 + sizeof (&c));
+
+ return z;
+}
+
+template <int N>
+int
+f4 (char *x, char **y, int z, char w[64])
+{
+ const char *s1 = "foobarbaz";
+ const char *s2 = "abcde12345678";
+ strncpy (x, s1, sizeof (s1)); // { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" }
+ strncat (x, s2, sizeof (s2)); // { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" }
+ stpncpy (x, s1, sizeof (s1)); // { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" }
+ y[0] = strndup (s1, sizeof (s1)); // { dg-warning "call is the same expression as the source; did you mean to provide an explicit length" }
+ z += strncmp (s1, s2, sizeof (s1)); // { dg-warning "call is the same expression as the first source; did you mean to provide an explicit length" }
+ z += strncmp (s1, s2, sizeof (s2)); // { dg-warning "call is the same expression as the second source; did you mean to provide an explicit length" }
+ z += strncasecmp (s1, s2, sizeof (s1)); // { dg-warning "call is the same expression as the first source; did you mean to provide an explicit length" }
+ z += strncasecmp (s1, s2, sizeof (s2)); // { dg-warning "call is the same expression as the second source; did you mean to provide an explicit length" }
+
+ strncpy (w, s1, sizeof (w)); // { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" }
+ strncat (w, s2, sizeof (w)); // { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" }
+ stpncpy (w, s1, sizeof (w)); // { dg-warning "call is the same expression as the destination; did you mean to provide an explicit length" }
+
+ // These are correct, no warning.
+ const char s3[] = "foobarbaz";
+ const char s4[] = "abcde12345678";
+ strncpy (x, s3, sizeof (s3));
+ strncat (x, s4, sizeof (s4));
+ stpncpy (x, s3, sizeof (s3));
+ y[1] = strndup (s3, sizeof (s3));
+ z += strncmp (s3, s4, sizeof (s3));
+ z += strncmp (s3, s4, sizeof (s4));
+ z += strncasecmp (s3, s4, sizeof (s3));
+ z += strncasecmp (s3, s4, sizeof (s4));
+
+ return z;
+}
+
+int
+f (void *x, char *y, int z, X w, char **u, char v[64])
+{
+ z += f1<0> (x, z);
+ z += f2<0> (x, z);
+ z += f3<0> (x, y, z, w);
+ z += f4<0> (y, u, z, v);
+ return z;
+}
+
+// { dg-prune-output "\[\n\r\]*will always overflow\[\n\r\]*" }
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/builtin-location.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/builtin-location.C
new file mode 100644
index 000000000..cad53de4b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/builtin-location.C
@@ -0,0 +1,31 @@
+// { dg-do run }
+
+#include <cstring>
+
+const char *gfile;
+const char *gfn;
+int gline;
+
+void bar (const char *file = __builtin_FILE (),
+ const char *function = __builtin_FUNCTION (),
+ int line = __builtin_LINE ())
+{
+ gfile = file;
+ gfn = function;
+ gline = line;
+}
+
+extern "C" void abort (void);
+
+int main()
+{
+ int here;
+ bar (); here = __LINE__;
+ if (std::strcmp (gfn, __FUNCTION__) != 0)
+ abort ();
+ if (std::strcmp (gfile, __FILE__) != 0)
+ abort ();
+ if (gline != here)
+ abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/covariant-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/covariant-1.C
new file mode 100644
index 000000000..9f1fd0a52
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/covariant-1.C
@@ -0,0 +1,33 @@
+// { dg-do run }
+
+extern "C" void abort ();
+
+class A {
+public:
+ virtual A* getThis() { return this; }
+};
+
+class B {
+int a;
+public:
+ virtual B* getThis() { return this; }
+};
+
+class AB : public A, public B {
+public:
+ virtual AB* getThis() { return this; }
+};
+
+int main ()
+{
+ AB ab;
+
+ A* a = &ab;
+ B* b = &ab;
+
+ if (a->getThis() != a
+ || b->getThis() != b)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/darwin-cfstring-3.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/darwin-cfstring-3.C
new file mode 100644
index 000000000..2d755ec8d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/darwin-cfstring-3.C
@@ -0,0 +1,30 @@
+/* Test whether the __builtin__CFStringMakeConstantString
+ "function" generates compile-time objects with the correct layout. */
+/* Developed by Ziemowit Laski <zlaski@apple.com>. */
+
+/* { dg-do compile { target *-*-darwin* } } */
+/* { dg-options "-mconstant-cfstrings" } */
+
+typedef const struct __CFString *CFStringRef;
+
+#ifdef __CONSTANT_CFSTRINGS__
+#define CFSTR(STR) ((CFStringRef) __builtin___CFStringMakeConstantString (STR))
+#else
+#error __CONSTANT_CFSTRINGS__ not defined
+#endif
+
+extern int cond;
+extern const char *func(void);
+
+CFStringRef s0 = CFSTR("Hello" "there");
+
+void foo(void) {
+ const CFStringRef s1 = CFSTR("Str1");
+
+ s0 = s1;
+}
+
+/* { dg-final { scan-assembler "\\.long\[ \\t\]+___CFConstantStringClassReference\n\[ \\t\]*\\.long\[ \\t\]+1992\n\[ \\t\]*\\.long\[ \\t\]+LC.*\n\[ \\t\]*\\.long\[ \\t\]+4\n" { target { *-*-darwin* && { ! lp64 } } } } } */
+/* { dg-final { scan-assembler "\\.long\[ \\t\]+___CFConstantStringClassReference\n\[ \\t\]*\\.long\[ \\t\]+1992\n\[ \\t\]*\\.long\[ \\t\]+LC.*\n\[ \\t\]*\\.long\[ \\t\]+10\n" { target { *-*-darwin* && { ! lp64 } } } } } */
+/* { dg-final { scan-assembler ".quad\t___CFConstantStringClassReference\n\t.long\t1992\n\t.space 4\n\t.quad\t.*\n\t.quad\t4\n" { target { *-*-darwin* && { lp64 } } } } } */
+/* { dg-final { scan-assembler ".quad\t___CFConstantStringClassReference\n\t.long\t1992\n\t.space 4\n\t.quad\t.*\n\t.quad\t10\n" { target { *-*-darwin* && { lp64 } } } } } */
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/dg-torture.exp b/gcc-4.9/gcc/testsuite/g++.dg/torture/dg-torture.exp
new file mode 100644
index 000000000..7525e0408
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/dg-torture.exp
@@ -0,0 +1,7 @@
+# This harness is for tests that should be run at all optimisation levels.
+
+load_lib g++-dg.exp
+
+dg-init
+gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.C $srcdir/c-c++-common/torture/*.c]] ""
+dg-finish
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/ipa-cp-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/ipa-cp-1.C
new file mode 100644
index 000000000..37c046d87
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/ipa-cp-1.C
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+// With IPA-CP, this caused a problem on darwin, where
+// _M_reset is being cloned, it was still being marked
+// as weak and then we had to change the calls to the
+// newly marked function for the non throwing behavior.
+
+int& f(int&);
+inline void _M_reset(int &_M_vbp) throw()
+{
+ f(_M_vbp);
+}
+extern int _S_last_request;
+void _M_allocate_single_object() throw()
+{
+ _M_reset(_S_last_request);
+ _M_reset(_S_last_request);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr27218.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr27218.C
new file mode 100644
index 000000000..b1e18dd33
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr27218.C
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+struct Vector
+{
+ double _x, _y;
+};
+typedef Vector Point;
+Vector d;
+static inline Vector f(void)
+{
+ return d;
+}
+void add_duck (void)
+{
+ new Point (f());
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr30252.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr30252.C
new file mode 100644
index 000000000..aabf88f51
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr30252.C
@@ -0,0 +1,226 @@
+/* { dg-do run } */
+/* { dg-options "-fstrict-aliasing" } */
+
+extern "C" void abort (void);
+namespace sigc {
+ template <class T_type>
+ struct type_trait
+ {
+ typedef T_type& pass;
+ typedef const T_type& take;
+ typedef T_type* pointer;
+ };
+ template <class T_base, class T_derived>
+ struct is_base_and_derived
+ {
+ struct big {
+ char memory[64];
+ };
+ static big is_base_class_(...);
+ static char is_base_class_(typename type_trait<T_base>::pointer);
+ static const bool value =
+ sizeof(is_base_class_(reinterpret_cast<typename type_trait<T_derived>::pointer>(0))) ==
+ sizeof(char);
+ };
+ struct nil;
+ struct functor_base {};
+ template <class T_functor, bool I_derives_functor_base=is_base_and_derived<functor_base,T_functor>::value>
+ struct functor_trait
+ {
+ };
+ template <class T_functor>
+ struct functor_trait<T_functor,true>
+ {
+ typedef typename T_functor::result_type result_type;
+ typedef T_functor functor_type;
+ };
+ template <class T_arg1, class T_return>
+ class pointer_functor1 : public functor_base
+ {
+ typedef T_return (*function_type)(T_arg1);
+ function_type func_ptr_;
+ public:
+ typedef T_return result_type;
+ explicit pointer_functor1(function_type _A_func): func_ptr_(_A_func) {}
+ T_return operator()(typename type_trait<T_arg1>::take _A_a1) const
+ { return func_ptr_(_A_a1); }
+ };
+ template <class T_arg1, class T_return>
+ inline pointer_functor1<T_arg1, T_return>
+ ptr_fun1(T_return (*_A_func)(T_arg1))
+ { return pointer_functor1<T_arg1, T_return>(_A_func); }
+ struct adaptor_base : public functor_base {};
+ template <class T_functor,
+ class T_arg1=void,
+ bool I_derives_adaptor_base=is_base_and_derived<adaptor_base,T_functor>::value>
+ struct deduce_result_type
+ { typedef typename functor_trait<T_functor>::result_type type; };
+ template <class T_functor>
+ struct adaptor_functor : public adaptor_base
+ {
+ template <class T_arg1=void>
+ struct deduce_result_type
+ { typedef typename sigc::deduce_result_type<T_functor, T_arg1>::type type; };
+ typedef typename functor_trait<T_functor>::result_type result_type;
+ result_type
+ operator()() const;
+ template <class T_arg1>
+ typename deduce_result_type<T_arg1>::type
+ operator()(T_arg1 _A_arg1) const
+ { return functor_(_A_arg1); }
+ explicit adaptor_functor(const T_functor& _A_functor)
+ : functor_(_A_functor)
+ {}
+ mutable T_functor functor_;
+ };
+ template <class T_functor>
+ typename adaptor_functor<T_functor>::result_type
+ adaptor_functor<T_functor>::operator()() const
+ { return functor_(); }
+ template <class T_functor, bool I_isadaptor = is_base_and_derived<adaptor_base, T_functor>::value> struct adaptor_trait;
+ template <class T_functor>
+ struct adaptor_trait<T_functor, true>
+ {
+ typedef T_functor adaptor_type;
+ };
+ template <class T_functor>
+ struct adaptor_trait<T_functor, false>
+ {
+ typedef typename functor_trait<T_functor>::functor_type functor_type;
+ typedef adaptor_functor<functor_type> adaptor_type;
+ };
+ template <class T_functor>
+ struct adapts : public adaptor_base
+ {
+ typedef typename adaptor_trait<T_functor>::adaptor_type adaptor_type;
+ explicit adapts(const T_functor& _A_functor)
+ : functor_(_A_functor)
+ {}
+ mutable adaptor_type functor_;
+ };
+ template <class T_type>
+ struct reference_wrapper
+ {
+ };
+ template <class T_type>
+ struct unwrap_reference
+ {
+ typedef T_type type;
+ };
+ template <class T_type>
+ class bound_argument
+ {
+ public:
+ bound_argument(const T_type& _A_argument)
+ : visited_(_A_argument)
+ {}
+ inline T_type& invoke()
+ { return visited_; }
+ T_type visited_;
+ };
+ template <class T_wrapped>
+ class bound_argument< reference_wrapper<T_wrapped> >
+ {
+ };
+ template <int I_location, class T_functor, class T_type1=nil>
+ struct bind_functor;
+ template <class T_functor, class T_type1>
+ struct bind_functor<-1, T_functor, T_type1> : public adapts<T_functor>
+ {
+ typedef typename adapts<T_functor>::adaptor_type adaptor_type;
+ typedef typename adaptor_type::result_type result_type;
+ result_type
+ operator()()
+ {
+ return this->functor_.template operator()<typename type_trait<typename unwrap_reference<T_type1>::type>::pass> (bound1_.invoke());
+ }
+ bind_functor(typename type_trait<T_functor>::take _A_func, typename type_trait<T_type1>::take _A_bound1)
+ : adapts<T_functor>(_A_func), bound1_(_A_bound1)
+ {}
+ bound_argument<T_type1> bound1_;
+ };
+ template <class T_type1, class T_functor>
+ inline bind_functor<-1, T_functor,
+ T_type1>
+ bind(const T_functor& _A_func, T_type1 _A_b1)
+ { return bind_functor<-1, T_functor,
+ T_type1>
+ (_A_func, _A_b1);
+ }
+ namespace internal {
+ struct slot_rep;
+ typedef void* (*hook)(slot_rep *);
+ struct slot_rep
+ {
+ hook call_;
+ };
+ }
+ class slot_base : public functor_base
+ {
+ public:
+ typedef internal::slot_rep rep_type;
+ explicit slot_base(rep_type* rep)
+ : rep_(rep)
+ {
+ }
+ mutable rep_type *rep_;
+ };
+ namespace internal {
+ template <class T_functor>
+ struct typed_slot_rep : public slot_rep
+ {
+ typedef typename adaptor_trait<T_functor>::adaptor_type adaptor_type;
+ adaptor_type functor_;
+ inline typed_slot_rep(const T_functor& functor)
+ : functor_(functor)
+ {
+ }
+ };
+ template<class T_functor>
+ struct slot_call0
+ {
+ static void *call_it(slot_rep* rep)
+ {
+ typedef typed_slot_rep<T_functor> typed_slot;
+ typed_slot *typed_rep = static_cast<typed_slot*>(rep);
+ return (typed_rep->functor_)();
+ }
+ static hook address()
+ {
+ return &call_it;
+ }
+ };
+ }
+
+ class slot0 : public slot_base
+ {
+ public:
+ typedef void * (*call_type)(rep_type*);
+ inline void *operator()() const
+ {
+ return slot_base::rep_->call_ (slot_base::rep_);
+ }
+ template <class T_functor>
+ slot0(const T_functor& _A_func)
+ : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
+ {
+ slot_base::rep_->call_ = internal::slot_call0<T_functor>::address();
+ }
+ };
+}
+struct A
+{
+ static void *foo (void *p) { return p; }
+ typedef sigc::slot0 C;
+ C bar();
+};
+A::C A::bar ()
+{
+ return sigc::bind (sigc::ptr_fun1 (&A::foo), (void*)0);
+}
+int main (void)
+{
+ A a;
+ if (a.bar ()() != 0)
+ abort ();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr30567.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr30567.C
new file mode 100644
index 000000000..389daf357
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr30567.C
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+
+template <typename T>
+struct const_ref
+{
+ const T* begin;
+ const_ref(const T* b) : begin(b) {}
+};
+
+template <typename T>
+T sum(const_ref<T> const& a)
+{
+ T result = 0;
+ for(unsigned i=0;i<1;i++) result += a.begin[i];
+ return result;
+}
+
+struct tiny_plain
+{
+ int elems[2];
+ tiny_plain() { elems[0]=1; }
+};
+
+struct vec3 : tiny_plain {};
+
+struct mat3
+{
+ int type() const { return sum(const_ref<int>(vec3().elems)) == 1; }
+};
+
+int main() { return mat3().type() ? 0 : 1; }
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr31081-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr31081-1.C
new file mode 100644
index 000000000..cb11b2148
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr31081-1.C
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+
+static int get_record (void);
+void f(void);
+int g(void);
+static int get_record (void)
+{
+ int result;
+ try
+ {
+ result = g();
+ f();
+ }
+ catch (const int &) { }
+ return result;
+}
+int NAV_get_record ( )
+{
+ int result;
+ for (;;)
+ if (get_record ())
+ return 1;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr31081-2.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr31081-2.C
new file mode 100644
index 000000000..a14ef3798
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr31081-2.C
@@ -0,0 +1,48 @@
+/* { dg-do compile } */
+
+class CString
+{
+public:
+ CString();
+ ~CString() { operator delete(_rep); }
+ operator const char*() const { return _rep; }
+private:
+ CString(char* cstr);
+ char* _rep;
+};
+
+class String
+{
+public:
+
+ String();
+ String(const char* str);
+ ~String();
+ CString getCString() const;
+};
+
+int is_absolute_path(const char *path);
+
+inline void getAbsolutePath(
+ const char* path,
+ const String& filename)
+{
+ (!is_absolute_path(filename.getCString()) && path);
+ return;
+}
+
+int foo(int &value);
+
+int main(int argc, char** argv)
+{
+ int repeatTestCount = 0;
+ if (foo(repeatTestCount))
+ {
+ repeatTestCount = 1;
+ }
+ for (int numTests = 1; numTests <= repeatTestCount; numTests++)
+ {
+ getAbsolutePath("blah", "blah");
+ }
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr31579.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr31579.C
new file mode 100644
index 000000000..131532e63
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr31579.C
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+// middle-end/31579
+// Expand was crashing while expanding the tree for the initializer
+
+struct Industry {
+ unsigned char produced_cargo[2];
+};
+unsigned int a = (((__SIZE_TYPE__)&reinterpret_cast<const volatile
+char&>((((Industry*)(char*)8)->produced_cargo[0]))) - 8);
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr31863.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr31863.C
new file mode 100644
index 000000000..f10ad5f01
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr31863.C
@@ -0,0 +1,778 @@
+/* { dg-do link } */
+/* { dg-timeout-factor 2.0 } */
+/* { dg-skip-if "Program too big" { "avr-*-*" } { "*" } { "" } } */
+
+namespace Loki
+{
+ class NullType {};
+ template <class T, class U>
+ struct Typelist
+ {
+ typedef T Head;
+ typedef U Tail;
+ };
+
+
+
+ namespace TL
+ {
+ template
+ <
+ typename T1 = NullType, typename T2 = NullType, typename T3 =
+NullType,
+ typename T4 = NullType, typename T5 = NullType, typename T6 =
+NullType,
+ typename T7 = NullType, typename T8 = NullType, typename T9 =
+NullType,
+ typename T10 = NullType, typename T11 = NullType, typename T12
+= NullType,
+ typename T13 = NullType, typename T14 = NullType, typename T15
+= NullType,
+ typename T16 = NullType, typename T17 = NullType, typename T18
+= NullType,
+ typename T19 = NullType, typename T20 = NullType, typename T21
+= NullType,
+ typename T22 = NullType, typename T23 = NullType, typename T24
+= NullType,
+ typename T25 = NullType, typename T26 = NullType, typename T27
+= NullType,
+ typename T28 = NullType, typename T29 = NullType, typename T30
+= NullType,
+ typename T31 = NullType, typename T32 = NullType, typename T33
+= NullType,
+ typename T34 = NullType, typename T35 = NullType, typename T36
+= NullType,
+ typename T37 = NullType, typename T38 = NullType, typename T39
+= NullType,
+ typename T40 = NullType
+ >
+ struct MakeTypelist
+ {
+ private:
+ typedef typename MakeTypelist
+ <
+ T2 , T3 , T4 ,
+ T5 , T6 , T7 ,
+ T8 , T9 , T10,
+ T11, T12, T13,
+ T14, T15, T16,
+ T17, T18, T19,
+ T20, T21, T22,
+ T23, T24, T25,
+ T26, T27, T28,
+ T29, T30, T31,
+ T32, T33, T34,
+ T35, T36, T37,
+ T38, T39, T40
+ >
+ ::Result TailResult;
+
+ public:
+ typedef Typelist<T1, TailResult> Result;
+ };
+
+ template<>
+ struct MakeTypelist<>
+ {
+ typedef NullType Result;
+ };
+
+ }
+}
+template <class Key>
+class Factory;
+
+template <class Key, bool iW>
+struct Context
+{
+ typedef Key KeyType;
+ enum
+ {
+ isWrite = iW
+ };
+};
+
+namespace detail
+{
+
+template <class Key, bool isWrite>
+class CreatorUnitBaseImpl
+{
+public:
+ typedef Context<Key, isWrite> Context_;
+private:
+ typedef void*(CreatorUnitBaseImpl::*CreateFun)(Context_&, unsigned&, const
+Key&);
+ CreateFun createFun_;
+
+protected:
+ virtual void* createUninitialized () = 0;
+ template <class Value>
+ void* createImpl (Context_& ctx, unsigned& ver, const Key& k)
+ {
+ return createUninitialized();
+ }
+private:
+ CreatorUnitBaseImpl();
+public:
+ template <class Value>
+ CreatorUnitBaseImpl (Value*) :
+ createFun_( &CreatorUnitBaseImpl::template createImpl<Value> )
+ {
+ }
+
+ virtual ~CreatorUnitBaseImpl () {}
+
+ CreatorUnitBaseImpl(const CreatorUnitBaseImpl& s)
+ : createFun_(s.createFun_)
+ {
+ }
+
+ CreatorUnitBaseImpl& operator=(const CreatorUnitBaseImpl& s)
+ {
+ createFun_ = s.createFun_;
+ return *this;
+ }
+ void* create (Context_& ctx, unsigned& ver, const Key& k)
+ {
+ return (this->*createFun_)(ctx, ver, k);
+ }
+};
+
+template <class Key>
+class Creator : protected CreatorUnitBaseImpl<Key, true>, protected
+CreatorUnitBaseImpl<Key, false>
+{
+public:
+ typedef void* (*CreatorFun) ();
+
+private:
+ CreatorFun fun_;
+protected:
+ virtual void* createUninitialized ()
+ {
+ if (fun_)
+ return (*fun_)();
+ return 0;
+ }
+private:
+ Creator ();
+public:
+ template <class Value>
+ Creator (CreatorFun f, Value*) :
+ CreatorUnitBaseImpl<Key, true>((Value*)0),
+ CreatorUnitBaseImpl<Key, false>((Value*)0),
+ fun_(f)
+ {
+ }
+
+ Creator(const Creator& s) :
+ CreatorUnitBaseImpl<Key, true>(s),
+ CreatorUnitBaseImpl<Key, false>(s),
+ fun_(s.fun_)
+ {
+
+ }
+
+ Creator& operator=(const Creator& s)
+ {
+ CreatorUnitBaseImpl<Key, true>::operator=(s);
+ CreatorUnitBaseImpl<Key, false>::operator=(s);
+ fun_ = s.fun_;
+ return *this;
+ }
+
+ virtual ~Creator ()
+ {
+ }
+
+ template <class Context>
+ void* createObject (Context& ctx, unsigned& ver, const Key& k)
+ {
+ void* r = CreatorUnitBaseImpl<Key, Context::isWrite>::create(ctx, ver,
+k);
+ return r;
+ }
+};
+
+}
+
+template <class Key>
+class Factory
+{
+public:
+ typedef Key KeyType;
+ typedef void* (*CreatorFun) ();
+ typedef detail::Creator<Key> Creator;
+public:
+ Factory () {}
+ ~Factory () {}
+
+ template <class Value>
+ bool registerCreator (const Key& k, CreatorFun fun)
+ {
+ return true;
+ }
+ template <class Context>
+ void* createObject (const Key& k, Context& ctx, unsigned& ver)
+ {
+ return 0;
+ }
+};
+
+template <class Key, class Base, Key key>
+struct ClassSpec
+{
+ typedef Key KeyType;
+ typedef Base BaseType;
+ enum {KeyValue = key};
+};
+
+template <class Key, class T>
+class Serializer;
+
+template <class Key, class Base, Key key>
+class Serializer<Key, ClassSpec <Key, Base, key> >
+ : public virtual Factory<Key>
+{
+ typedef Key KeyType;
+ typedef Base BaseType;
+ enum {KeyValue = key};
+ typedef Factory<Key> Inherited;
+ typedef Serializer<Key, ClassSpec< Key, Base, key > > SelfType;
+
+ static void* create ()
+ {
+ return (void*) (new BaseType);
+ }
+public:
+ Serializer()
+ {
+ Inherited::template registerCreator<BaseType>(
+ KeyValue,
+ &SelfType::create);
+ }
+};
+
+template <class Key, class Head>
+class Serializer<Key, Loki::Typelist<Head, Loki::NullType> >:
+ public Serializer<Key, Head>
+{
+};
+
+template <class Key, class Head, class Tail>
+class Serializer<Key, Loki::Typelist<Head, Tail> >:
+ public virtual Serializer<Key, Head>,
+ public virtual Serializer<Key, Tail>
+{
+};
+
+template <class Key>
+class Serializer<Key, Loki::NullType> : public virtual Factory<Key>
+{
+};
+
+
+
+
+typedef unsigned KeyType;
+
+
+
+typedef Factory<KeyType> FactoryType;
+
+typedef KeyType Key;
+
+struct A001
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 1; }
+ static const char* className () {return "A001";}
+};
+
+struct A002
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 2; }
+ static const char* className () {return "A002";}
+};
+
+struct A003
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 3; }
+ static const char* className () {return "A003";}
+};
+
+struct A004
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 4; }
+ static const char* className () {return "A004";}
+};
+
+struct A005
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 5; }
+ static const char* className () {return "A005";}
+};
+
+struct A006
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 6; }
+ static const char* className () {return "A006";}
+};
+
+struct A007
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 7; }
+ static const char* className () {return "A007";}
+};
+
+struct A008
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 8; }
+ static const char* className () {return "A008";}
+};
+
+struct A009
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 9; }
+ static const char* className () {return "A009";}
+};
+
+struct A010
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 10; }
+ static const char* className () {return "A010";}
+};
+
+struct A011
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 11; }
+ static const char* className () {return "A011";}
+};
+
+struct A012
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 12; }
+ static const char* className () {return "A012";}
+};
+
+struct A013
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 13; }
+ static const char* className () {return "A013";}
+};
+
+struct A014
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 14; }
+ static const char* className () {return "A014";}
+};
+
+struct A015
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 15; }
+ static const char* className () {return "A015";}
+};
+
+struct A016
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 16; }
+ static const char* className () {return "A016";}
+};
+
+struct A017
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 17; }
+ static const char* className () {return "A017";}
+};
+
+struct A018
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 18; }
+ static const char* className () {return "A018";}
+};
+
+struct A019
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 19; }
+ static const char* className () {return "A019";}
+};
+
+struct A020
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 20; }
+ static const char* className () {return "A020";}
+};
+
+struct A021
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 21; }
+ static const char* className () {return "A021";}
+};
+
+struct A022
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 22; }
+ static const char* className () {return "A022";}
+};
+
+struct A023
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 23; }
+ static const char* className () {return "A023";}
+};
+
+struct A024
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 24; }
+ static const char* className () {return "A024";}
+};
+
+struct A025
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 25; }
+ static const char* className () {return "A025";}
+};
+
+struct A026
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 26; }
+ static const char* className () {return "A026";}
+};
+
+struct A027
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 27; }
+ static const char* className () {return "A027";}
+};
+
+struct A028
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 28; }
+ static const char* className () {return "A028";}
+};
+
+struct A029
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 29; }
+ static const char* className () {return "A029";}
+};
+
+struct A030
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 30; }
+ static const char* className () {return "A030";}
+};
+
+struct A031
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 31; }
+ static const char* className () {return "A031";}
+};
+
+struct A032
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 32; }
+ static const char* className () {return "A032";}
+};
+
+struct A033
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 33; }
+ static const char* className () {return "A033";}
+};
+
+struct A034
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 34; }
+ static const char* className () {return "A034";}
+};
+
+struct A035
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 35; }
+ static const char* className () {return "A035";}
+};
+
+struct A036
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 36; }
+ static const char* className () {return "A036";}
+};
+
+struct A037
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 37; }
+ static const char* className () {return "A037";}
+};
+
+struct A038
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 38; }
+ static const char* className () {return "A038";}
+};
+
+struct A039
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 39; }
+ static const char* className () {return "A039";}
+};
+
+struct A040
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 40; }
+ static const char* className () {return "A040";}
+};
+
+Factory<Key>& getInstance()
+{
+ static Serializer<Key,
+ Loki::TL::MakeTypelist<
+ ClassSpec<Key, A001, 1>,
+ ClassSpec<Key, A002, 2>,
+ ClassSpec<Key, A003, 3>,
+ ClassSpec<Key, A004, 4>,
+ ClassSpec<Key, A005, 5>,
+ ClassSpec<Key, A006, 6>,
+ ClassSpec<Key, A007, 7>,
+ ClassSpec<Key, A008, 8>,
+ ClassSpec<Key, A009, 9>,
+ ClassSpec<Key, A010, 10>,
+ ClassSpec<Key, A011, 11>,
+ ClassSpec<Key, A012, 12>,
+ ClassSpec<Key, A013, 13>,
+ ClassSpec<Key, A014, 14>,
+ ClassSpec<Key, A015, 15>,
+ ClassSpec<Key, A016, 16>,
+ ClassSpec<Key, A017, 17>,
+ ClassSpec<Key, A018, 18>,
+ ClassSpec<Key, A019, 19>,
+ ClassSpec<Key, A020, 20>,
+ ClassSpec<Key, A021, 21>,
+ ClassSpec<Key, A022, 22>,
+ ClassSpec<Key, A023, 23>,
+ ClassSpec<Key, A024, 24>,
+ ClassSpec<Key, A025, 25>,
+ ClassSpec<Key, A026, 26>,
+ ClassSpec<Key, A027, 27>,
+ ClassSpec<Key, A028, 28>,
+ ClassSpec<Key, A029, 29>,
+ ClassSpec<Key, A030, 30>,
+ ClassSpec<Key, A031, 31>,
+ ClassSpec<Key, A032, 32>,
+ ClassSpec<Key, A033, 33>,
+ ClassSpec<Key, A034, 34>,
+ ClassSpec<Key, A035, 35>,
+ ClassSpec<Key, A036, 36>,
+ ClassSpec<Key, A037, 37>,
+ ClassSpec<Key, A038, 38>,
+ ClassSpec<Key, A039, 39>,
+ ClassSpec<Key, A040, 40>
+ >::Result
+ > instance;
+ return instance;
+}
+
+int main ()
+{
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr32304.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr32304.C
new file mode 100644
index 000000000..236d00b97
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr32304.C
@@ -0,0 +1,9 @@
+// { dg-do compile }
+
+struct S {
+ S() {}
+};
+S f() {
+ static S s;
+ return s;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr32563.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr32563.C
new file mode 100644
index 000000000..d536b3faa
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr32563.C
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+
+struct A
+{
+ char c[1];
+} a;
+
+const __SIZE_TYPE__ i = (__SIZE_TYPE__)&a.c[0] - 1;
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr32950.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr32950.C
new file mode 100644
index 000000000..8d64296e4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr32950.C
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+
+struct A
+{
+ __complex__ double c;
+};
+
+struct B
+{
+ A a;
+ B(A x) : a(x) {}
+ void foo();
+};
+
+void bar()
+{
+ B b = A();
+ B(b).foo();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33134.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33134.C
new file mode 100644
index 000000000..43482c7fc
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33134.C
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+/* Used to crash in VRP. */
+/* Testcase by Martin Michlmayr <tbm@cyrius.com> */
+
+class FXObject;
+class FXStream
+{
+ public:FXStream (const FXObject *cont = __null);
+ FXStream & operator<< (const unsigned char &v);
+};
+
+bool fxsaveGIF (FXStream &store)
+{
+ int bitsperpixel;
+ unsigned char c1;
+ c1 = 0x80;
+ c1 |= (bitsperpixel - 1) << 4;
+ store << c1;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33340.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33340.C
new file mode 100644
index 000000000..bac882156
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33340.C
@@ -0,0 +1,27 @@
+void* operator new(__SIZE_TYPE__, void* __p) { }
+
+struct auto_ptr {
+ int* p;
+ ~auto_ptr() { delete p; }
+};
+
+typedef void* T;
+struct vector {
+ void push_back(const T& __x) {
+ ::new(0) T(__x);
+ insert(__x);
+ }
+ void insert(const T& __x);
+} v;
+
+void g();
+void f() {
+ auto_ptr ap;
+ if (ap.p) {
+ ap.p = new int();
+ }
+ g();
+ int* tmp = ap.p;
+ ap.p = 0;
+ v.push_back(tmp);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33572.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33572.C
new file mode 100644
index 000000000..91cd073fd
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33572.C
@@ -0,0 +1,17 @@
+// { dg-do run }
+#include <vector>
+#include <memory>
+
+struct Foo { virtual void f() {} };
+
+int main(int argc, char**)
+{
+ std::auto_ptr<Foo> foo;
+ if (argc >= 0) {
+ foo.reset(new Foo());
+ } else {
+ std::vector<int> v;
+ }
+ Foo* p = foo.release();
+ p->f();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33589-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33589-1.C
new file mode 100644
index 000000000..eea89f421
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33589-1.C
@@ -0,0 +1,22 @@
+// { dg-do compile }
+struct base { void somemethod() {} };
+struct derived : public base { };
+
+struct smartpointer
+{
+ ~smartpointer() { }
+ operator derived*() const
+ {
+ return 0;
+ }
+};
+typedef void ( derived::* methodptr_type )();
+methodptr_type getmemberptr()
+{
+ return &derived::somemethod;
+}
+void somefunction()
+{
+ smartpointer pObj;
+ ( pObj->*getmemberptr() )();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33589-2.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33589-2.C
new file mode 100644
index 000000000..325892bc6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33589-2.C
@@ -0,0 +1,13 @@
+// { dg-do compile }
+
+void f(void*) throw();
+
+void somefunction()
+{
+try {
+ void (*g)(void*) = (void (*)(void*))f;
+ void (*g2)(int*) = (void (*)(int*))g;
+ g2(0);
+} catch (...)
+{throw;}
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33627.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33627.C
new file mode 100644
index 000000000..a14e34551
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33627.C
@@ -0,0 +1,57 @@
+/* { dg-do compile } */
+
+typedef unsigned int UT_uint32;
+typedef UT_uint32 PT_DocPosition;
+typedef UT_uint32 PT_BlockOffset;
+typedef enum _PTStruxType { PTX_Block } PTStruxType;
+typedef UT_uint32 PL_ListenerId;
+typedef const void * PL_StruxFmtHandle;
+class PX_ChangeRecord;
+class pf_Frag {
+ public:
+ typedef enum _PFType { PFT_Object } PFType;
+ inline PFType getType(void) const { }
+ inline pf_Frag * getNext(void) const { }
+ PT_DocPosition getPos(void) const { }
+};
+class pf_Fragments {
+ public:
+ pf_Frag * getFirst() const;
+};
+class pt_PieceTable {
+ bool getStruxOfTypeFromPosition(PL_ListenerId listenerId, PT_DocPosition docPos, PTStruxType pts, PL_StruxFmtHandle * psfh) const;
+ bool _tellAndMaybeAddListener(PL_ListenerId listenerId, bool bAdd);
+ pf_Fragments m_fragments;
+};
+class pf_Frag_Object : public pf_Frag
+{
+ public:
+ virtual bool createSpecialChangeRecord(PX_ChangeRecord ** ppcr, PT_DocPosition dpos, PT_BlockOffset blockOffset) const;
+};
+bool pt_PieceTable::_tellAndMaybeAddListener(PL_ListenerId listenerId, bool bAdd)
+{
+ PL_StruxFmtHandle sfh = 0;
+ PT_DocPosition sum = 0;
+ UT_uint32 blockOffset = 0;
+ for (pf_Frag * pf = m_fragments.getFirst(); (pf); pf=pf->getNext())
+ {
+ pf_Frag_Object * pfo = static_cast<pf_Frag_Object *> (pf);
+ PX_ChangeRecord * pcr = __null;
+ bool bStatus1 = false;
+ if(sfh != __null) {
+ bStatus1 = pfo->createSpecialChangeRecord(&pcr,sum,blockOffset);
+ if (!(bStatus1))
+ return (false);
+ }
+ else
+ {
+ PT_DocPosition pos = pf->getPos();
+ getStruxOfTypeFromPosition(listenerId,pos,PTX_Block,&sfh);
+ bStatus1 = pfo->createSpecialChangeRecord(&pcr,pos,blockOffset);
+ if (!(bStatus1))
+ return (false);
+ }
+ if (!(bStatus1))
+ return (false);
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33735.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33735.C
new file mode 100644
index 000000000..0a90745b9
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33735.C
@@ -0,0 +1,21 @@
+// { dg-do compile }
+#include <string>
+typedef struct _ts { } PyThreadState;
+PyThreadState * Py_NewInterpreter(void);
+void Py_EndInterpreter(PyThreadState *);
+class ApplicationError {
+public:
+ ApplicationError(std::string errormsg) : errormsg(errormsg) { }
+ std::string errormsg;
+};
+void run()
+{
+ PyThreadState *py_state=__null;
+ try {
+ if (!(py_state=Py_NewInterpreter()))
+ throw ApplicationError("error");
+ }
+ catch(ApplicationError e) {
+ Py_EndInterpreter(py_state);
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33819.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33819.C
new file mode 100644
index 000000000..a2f868dae
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33819.C
@@ -0,0 +1,22 @@
+/* { dg-do run } */
+
+class s
+{
+public:
+ s(long long aa) : a(aa), i1(0) { }
+ long long id() const { return (this->a << 16) >> 16; }
+ bool operator< (s sv) { return this->a < sv.id(); }
+private:
+ long long a : 48;
+ int i1 : 16;
+};
+s g(1);
+extern "C" void abort (void);
+int
+main(int, char**)
+{
+ if (g < (1LL << 38) - 1)
+ return 0;
+ abort ();
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33887-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33887-1.C
new file mode 100644
index 000000000..2f17d9583
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33887-1.C
@@ -0,0 +1,44 @@
+/* { dg-do run } */
+
+extern "C" void abort (void);
+struct S { unsigned int i : 24; } x;
+void __attribute__((noinline)) test1()
+{
+ if (--x.i != 0x00ffffff)
+ abort ();
+ if (x.i != 0x00ffffff)
+ abort ();
+}
+void __attribute__((noinline)) test2()
+{
+ if (x.i-- != 0)
+ abort ();
+ if (x.i != 0x00ffffff)
+ abort ();
+}
+void __attribute__((noinline)) test3()
+{
+ if (++x.i != 0)
+ abort ();
+ if (x.i != 0)
+ abort ();
+}
+void __attribute__((noinline)) test4()
+{
+ if (x.i++ != 0x00ffffff)
+ abort ();
+ if (x.i != 0)
+ abort ();
+}
+int main()
+{
+ x.i = 0;
+ test1();
+ x.i = 0;
+ test2();
+ x.i = 0x00ffffff;
+ test3();
+ x.i = 0x00ffffff;
+ test4();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33887-2.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33887-2.C
new file mode 100644
index 000000000..f64cfad96
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33887-2.C
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+
+extern "C" void abort() __attribute__ ((noreturn));
+
+struct s
+{
+ unsigned long long f1 : 40;
+ unsigned int f2 : 24;
+} 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-4.9/gcc/testsuite/g++.dg/torture/pr33887-3.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33887-3.C
new file mode 100644
index 000000000..b4b883fba
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr33887-3.C
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+
+extern "C" void abort (void);
+
+struct s
+{
+ unsigned long long f1 : 40;
+ unsigned int f2 : 24;
+};
+
+s sv;
+
+void __attribute__((noinline)) foo(unsigned int i)
+{
+ unsigned int tmp;
+ sv.f2 = i;
+ tmp = sv.f2;
+ if (tmp != 0)
+ abort ();
+}
+
+int main()
+{
+ foo (0xff000000u);
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34099.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34099.C
new file mode 100644
index 000000000..49fa9cac1
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34099.C
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+
+#include <complex>
+
+typedef std::complex<double> NumType;
+
+void
+multiply(NumType a, NumType b, unsigned ac, NumType &ab)
+{
+ NumType s;
+ for (unsigned j=0; j<ac; j++)
+ s = a * b;
+ ab = s;
+}
+extern "C" void abort (void);
+int main()
+{
+ NumType a(1,2), b(3,-2), c;
+ multiply(a, b, 1, c);
+ if (c.real() != 7
+ || c.imag() != 4)
+ abort ();
+ return 0;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34222.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34222.C
new file mode 100644
index 000000000..130896dc9
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34222.C
@@ -0,0 +1,65 @@
+/* { dg-do compile } */
+
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<class _CharT> struct char_traits;
+ }
+__extension__ typedef __PTRDIFF_TYPE__ ptrdiff_t;
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ typedef ptrdiff_t streamsize;
+ template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_ifstream;
+ typedef basic_ifstream<char> ifstream;
+ class ios_base {
+ };
+ }
+template<class T> class Vector4 {
+ public:
+ inline Vector4();
+ inline Vector4(T, T, T, T);
+ T x, y, z, w;
+ };
+template<class T> class Matrix4 {
+ public:
+ Matrix4(const Vector4<T>&, const Vector4<T>&, const Vector4<T>&, const Vector4<T>&);
+ Matrix4(const Matrix4<T>& m);
+ Vector4<T> r[4];
+ };
+typedef Vector4<float> Vec4f;
+typedef Matrix4<float> Mat4f;
+template<class T> Vector4<T>::Vector4() : x(0), y(0), z(0), w(0) {
+ }
+template<class T> Vector4<T>::Vector4(T _x, T _y, T _z, T _w) : x(_x), y(_y), z(_z), w(_w) {
+ }
+template<class T> Matrix4<T>::Matrix4(const Vector4<T>& v0, const Vector4<T>& v1, const Vector4<T>& v2, const Vector4<T>& v3) {
+ }
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<typename _CharT, typename _Traits> class basic_ios : public ios_base {
+ };
+ template<typename _CharT, typename _Traits> class basic_istream : virtual public basic_ios<_CharT, _Traits> {
+ public:
+ typedef _CharT char_type;
+ typedef basic_istream<_CharT, _Traits> __istream_type;
+ __istream_type& read(char_type* __s, streamsize __n);
+ };
+ template<typename _CharT, typename _Traits> class basic_ifstream : public basic_istream<_CharT, _Traits> {
+ };
+ }
+using namespace std;
+static float readFloat(ifstream& in) {
+ float f;
+ in.read((char*) &f, sizeof(float));
+ }
+Mat4f readMeshMatrix(ifstream& in, int nBytes) {
+ float m00 = readFloat(in);
+ float m01 = readFloat(in);
+ float m02 = readFloat(in);
+ float m10 = readFloat(in);
+ float m11 = readFloat(in);
+ float m12 = readFloat(in);
+ float m20 = readFloat(in);
+ float m21 = readFloat(in);
+ float m22 = readFloat(in);
+ float m30 = readFloat(in);
+ float m31 = readFloat(in);
+ float m32 = readFloat(in);
+ return Mat4f(Vec4f(m00, m01, m02, 0), Vec4f(m10, m11, m12, 0), Vec4f(m20, m21, m22, 0), Vec4f(m30, m31, m32, 1));
+ }
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34235.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34235.C
new file mode 100644
index 000000000..5f05841c5
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34235.C
@@ -0,0 +1,11 @@
+/* { dg-do run } */
+
+extern "C" void abort (void);
+int main()
+{
+ short x = -1;
+ unsigned int c = ((unsigned int)x) >> 1;
+ if (c != 0x7fffffff)
+ abort();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34241.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34241.C
new file mode 100644
index 000000000..70f186c5b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34241.C
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+inline void *operator new (__SIZE_TYPE__, void *__p) throw ()
+{
+ return __p;
+}
+struct A
+{
+ A(int, double);
+ inline explicit A (int pattern, bool cs)
+ {
+ new (this) A (pattern, double(cs));
+ }
+};
+A test ()
+{
+ const A a (42, true);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34641.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34641.C
new file mode 100644
index 000000000..0cf507762
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34641.C
@@ -0,0 +1,177 @@
+// { dg-do compile }
+// { dg-require-effective-target fpic }
+// { dg-require-visibility "" }
+// { dg-options "-fPIC" }
+
+
+typedef __SIZE_TYPE__ size_t;
+extern "C" void *
+malloc (size_t __size)
+throw () __attribute__ ((__malloc__));
+ namespace std __attribute__ ((__visibility__ ("default")))
+{
+ using::size_t;
+}
+inline void *operator
+new (std::size_t, void *__p)
+throw ()
+{
+ return __p;
+}
+template < class _T1, class _T2 > struct pair
+{
+ _T1 first;
+ _T2 second;
+ pair (const _T1 & __a, const _T2 & __b):first (__a), second (__b)
+ {
+ }
+ template < class _U1, class _U2 >
+ pair (const pair < _U1, _U2 > &__p):first (__p.first), second (__p.second)
+ {
+ }
+};
+
+template < class _T1, class _T2 >
+ inline pair < _T1, _T2 > make_pair (_T1 __x, _T2 __y)
+{
+ return pair < _T1, _T2 > (__x, __y);
+}
+template < typename _Tp > inline const _Tp &
+max (const _Tp & __a, const _Tp & __b)
+{
+}
+typedef unsigned short int uint16_t;
+typedef unsigned long int uintptr_t;
+typedef uint16_t UChar;
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ struct __numeric_limits_base
+ {
+ };
+ template < typename _Tp > struct numeric_limits:public __numeric_limits_base
+ {
+ static _Tp max () throw ()
+ {
+ }
+ };
+}
+
+template < typename T > class VectorBufferBase
+{
+public:
+ void allocateBuffer (size_t newCapacity)
+ {
+ if (newCapacity > std::numeric_limits < size_t >::max () / sizeof (T))
+ *(int *) (uintptr_t) 0xbbadbeef = 0;
+ }
+};
+
+template < typename T, size_t inlineCapacity > class VectorBuffer;
+template < typename T > class VectorBuffer < T, 0 >:private VectorBufferBase <
+ T >
+{
+public:
+ typedef VectorBufferBase < T > Base;
+ using Base::allocateBuffer;
+};
+
+template < typename T, size_t inlineCapacity = 0 > class Vector
+{
+ typedef VectorBuffer < T, inlineCapacity > Impl;
+public:
+ typedef T *iterator;
+ size_t size () const
+ {
+ return m_size;
+ }
+ size_t capacity () const
+ {
+ }
+ iterator begin ()
+ {
+ }
+ iterator end ()
+ {
+ return begin () + m_size;
+ }
+ void shrink (size_t size);
+ void reserveCapacity (size_t newCapacity);
+ void clear ()
+ {
+ shrink (0);
+ }
+ template < typename U > void append (const U &);
+ void expandCapacity (size_t newMinCapacity);
+ template < typename U > U * expandCapacity (size_t newMinCapacity, U *);
+ size_t m_size;
+ Impl m_impl;
+};
+template < typename T, size_t inlineCapacity >
+ void Vector < T, inlineCapacity >::expandCapacity (size_t newMinCapacity)
+{
+ reserveCapacity (max
+ (newMinCapacity,
+ max (static_cast < size_t > (16),
+ capacity () + capacity () / 4 + 1)));
+}
+
+template < typename T, size_t inlineCapacity >
+ template < typename U >
+ inline U * Vector < T,
+ inlineCapacity >::expandCapacity (size_t newMinCapacity, U * ptr)
+{
+ expandCapacity (newMinCapacity);
+}
+template < typename T, size_t inlineCapacity >
+ void Vector < T, inlineCapacity >::reserveCapacity (size_t newCapacity)
+{
+ m_impl.allocateBuffer (newCapacity);
+}
+template < typename T, size_t inlineCapacity >
+ template < typename U >
+ inline void Vector < T, inlineCapacity >::append (const U & val)
+{
+ const U *ptr = &val;
+ if (size () == capacity ())
+ ptr = expandCapacity (size () + 1, ptr);
+ new (end ())T (*ptr);
+}
+
+class Range;
+class TextIterator
+{
+public:
+ explicit TextIterator (const Range *,
+ bool emitCharactersBetweenAllVisiblePositions =
+ false);
+ bool atEnd () const
+ {
+ }
+ void advance ();
+ int length () const
+ {
+ }
+};
+UChar *
+plainTextToMallocAllocatedBuffer (const Range * r, unsigned &bufferLength)
+{
+ static const unsigned cMaxSegmentSize = 1 << 16;
+ typedef pair < UChar *, unsigned >TextSegment;
+ Vector < TextSegment > *textSegments = 0;
+ Vector < UChar > textBuffer;
+ for (TextIterator it (r); !it.atEnd (); it.advance ())
+ {
+ if (textBuffer.size ()
+ && textBuffer.size () + it.length () > cMaxSegmentSize)
+ {
+ UChar *newSegmentBuffer =
+ static_cast <
+ UChar * >(malloc (textBuffer.size () * sizeof (UChar)));
+ if (!textSegments)
+ textSegments = new Vector < TextSegment >;
+ textSegments->
+ append (make_pair (newSegmentBuffer, textBuffer.size ()));
+ textBuffer.clear ();
+ }
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34651.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34651.C
new file mode 100644
index 000000000..2fce4d7a1
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34651.C
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+
+typedef bool Bool;
+struct CString {
+ CString (const char * =__null);
+ CString & operator += (const CString &);
+};
+struct THotKey {
+ short Key;
+ Bool Control;
+ Bool Shift;
+ Bool Alt;
+};
+THotKey m_HotKey;
+THotKey GetHotKey () { return m_HotKey; }
+void Serialize ()
+{
+ THotKey inHotKey (GetHotKey());
+ CString outCombinaison (inHotKey.Control
+ ? ((inHotKey.Alt || inHotKey.Shift)
+ ? "ctrl+" : "ctrl")
+ : __null);
+ outCombinaison += inHotKey.Alt ? inHotKey.Shift ? "alt+" : "alt" : "";
+ outCombinaison += inHotKey.Shift ? "shift" : "";
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34850.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34850.C
new file mode 100644
index 000000000..c33dbfb5c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34850.C
@@ -0,0 +1,76 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
+/* { dg-options "-ffat-lto-objects" } */
+
+typedef unsigned char uint8_t;
+typedef unsigned int uint32_t;
+typedef uint8_t byte;
+typedef uint32_t u32bit;
+__extension__ typedef __SIZE_TYPE__ size_t;
+extern "C" {
+ extern void __warn_memset_zero_len (void) __attribute__((__warning__ ("")));
+ extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__, __artificial__))
+ void * memset (void *__dest, int __ch, size_t __len) throw () {
+ if (__builtin_constant_p (__len) && __len == 0)
+ __warn_memset_zero_len (); /* { dg-warning "declared with attribute warning" } */
+ }
+}
+inline void clear_mem(void* ptr, u32bit n) {
+ memset(ptr, 0, n);
+}
+template<typename T> class MemoryRegion {
+public:
+ u32bit size() const {
+ }
+ const T* begin() const {
+ }
+ void set(const T in[], u32bit n) {
+ create(n);
+ }
+ void set(const MemoryRegion<T>& in) {
+ set(in.begin(), in.size());
+ }
+ void clear() {
+ clear_mem(buf, allocated);
+ }
+ void create(u32bit);
+ MemoryRegion() {
+ used = allocated = 0;
+ }
+ mutable T* buf;
+ mutable u32bit used;
+ mutable u32bit allocated;
+};
+template<typename T> void MemoryRegion<T>::create(u32bit n) {
+ if(n <= allocated) {
+ clear();
+ }
+}
+template<typename T> class SecureVector : public MemoryRegion<T> {
+public:
+ SecureVector<T>& operator=(const MemoryRegion<T>& in) {
+ if(this != &in) this->set(in);
+ }
+};
+class OctetString {
+public:
+ SecureVector<byte> bits_of() const {
+ }
+ OctetString& operator^=(const OctetString&);
+ void change(const MemoryRegion<byte>& in) {
+ bits = in;
+ }
+ OctetString(const MemoryRegion<byte>& in) {
+ change(in);
+ }
+ SecureVector<byte> bits;
+};
+OctetString& OctetString::operator^=(const OctetString& k) {
+ if(&k == this) {
+ bits.clear();
+ }
+}
+bool __attribute__((flatten))
+operator==(const OctetString& s1, const OctetString& s2) {
+ return (s1.bits_of() == s2.bits_of());
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34953.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34953.C
new file mode 100644
index 000000000..5d7b38c92
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr34953.C
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-w" } */
+
+void B_CLEAR(void* ret);
+void B_NeverReturns(void* ret) __attribute__((noreturn));
+
+int main()
+{
+ const struct AutoErrPop { ~AutoErrPop() { } } AutoErrPopper = { };
+ B_NeverReturns(0);
+}
+
+void B_NeverReturns(void* ret)
+{
+ B_CLEAR(ret); /* Never returns (does a setjmp/goto) */
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr35164-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr35164-1.C
new file mode 100644
index 000000000..1704c2226
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr35164-1.C
@@ -0,0 +1,69 @@
+typedef __SIZE_TYPE__ size_t;
+template<typename _Iterator, typename _Container> class __normal_iterator {
+public:
+ const _Iterator& base() const;
+};
+template<typename _BI1, typename _BI2> inline
+void copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) {
+ while (__first != __last) *--__result = *--__last;
+}
+template<typename _Tp> struct _Vector_base {
+ struct _Vector_impl { _Tp* _M_finish; };
+ _Vector_impl _M_impl;
+};
+template<typename _Tp > class vector : protected _Vector_base<_Tp> {
+ typedef vector<_Tp> vector_type;
+ typedef _Tp * pointer;
+ typedef _Tp & reference;
+ typedef __normal_iterator<pointer, vector_type> iterator;
+ typedef size_t size_type;
+public:
+ iterator end();
+ void resize(size_type __new_size) { insert(end(), __new_size); }
+ reference operator[](size_type __n);
+ void insert(iterator __position, size_type __n)
+ {
+ pointer __old_finish(this->_M_impl._M_finish);
+ copy_backward(__position.base(), __old_finish - __n, __old_finish);
+ }
+};
+struct A {
+ virtual ~A ();
+ void incRef ();
+ void decRef ();
+};
+struct C : public A {
+ static C *alloc ();
+};
+template <class T> struct B {
+ B () : ptr (T::alloc ()) { }
+ B (T *a_ptr) : ptr (a_ptr) { }
+ ~B () { decRef (); }
+ B& operator= (const B<T>& a) { if (a.get () != this->get ()) { decRef ();
+incRef (); } }
+ template<class U> operator B<U> () const { return B<U> (ptr); }
+ T* operator-> () const { }
+ T* get () const { return ptr; }
+ void decRef () const { if (ptr != 0) ptr->decRef (); }
+ void incRef () const { if (ptr != 0) ptr->incRef (); }
+ T *ptr;
+};
+struct D : public C {
+ template <class T> inline void foo (const B<T> & x) { d.resize (1); d[0] = x;
+}
+ vector<B <C> > d;
+};
+struct E : public C {
+ static E *alloc ();
+};
+struct F : public D {
+ static F *alloc ();
+};
+void foo (vector<B<D> > & x) {
+ for (int i = 0; i < 2; ++i)
+ {
+ B<F> l;
+ B<E> m;
+ l->foo (m);
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr35164-2.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr35164-2.C
new file mode 100644
index 000000000..463cad7f7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr35164-2.C
@@ -0,0 +1,27 @@
+struct __shared_count {
+ __shared_count() { _M_pi = new int; }
+ int * _M_pi;
+};
+template<typename _Tp>
+class __shared_ptr {
+public:
+ __shared_ptr(_Tp* __p);
+ void reset(int * __p) {
+ __shared_ptr(__p).swap(*this);
+ }
+ void swap(__shared_ptr<_Tp>& __other) {
+ __other._M_refcount._M_pi = _M_refcount._M_pi;
+ }
+ __shared_count _M_refcount;
+};
+template<typename _Tp> class shared_ptr : public __shared_ptr<_Tp> {};
+int main() {
+ for (shared_ptr<int> *iter;;)
+ {
+ try {
+ (iter++)->reset(new int);
+ }
+ catch (...) {
+ }
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr35400.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr35400.C
new file mode 100644
index 000000000..021135df8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr35400.C
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-Wtype-limits" } */
+
+struct A
+{
+ A();
+ ~A();
+};
+
+void foo()
+{
+ A x[1];
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr35526.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr35526.C
new file mode 100644
index 000000000..2d745b50e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr35526.C
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+// { dg-options "-fpermissive" }
+// { dg-prune-output "narrowing" }
+
+extern void *memcpy (void *__dest, __const void *__src, __SIZE_TYPE__ __n);
+
+char internal_crash_read_ip[] = { 0xb8 };
+
+struct u_internal_crash_read_t
+{
+ char ip[sizeof (internal_crash_read_ip)];
+}
+u_internal_crash_read;
+
+void
+gSignalHandler (int psignalNr, int pinfo, int pctx)
+{
+ memcpy (u_internal_crash_read.ip, internal_crash_read_ip,
+ sizeof (internal_crash_read_ip));
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr35634.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr35634.C
new file mode 100644
index 000000000..3c888ad43
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr35634.C
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+
+extern "C" void abort (void);
+extern "C" void exit (int);
+
+void foo (int i)
+{
+ static int n;
+ if (i < -128 || i > 127)
+ abort ();
+ if (++n > 1000)
+ exit (0);
+}
+
+int main ()
+{
+ signed char c;
+ for (c = 0; ; c++) foo (c);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr36191.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr36191.C
new file mode 100644
index 000000000..175707d1b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr36191.C
@@ -0,0 +1,17 @@
+// PR c++/36191
+// { dg-do compile }
+// { dg-options "-fnon-call-exceptions" }
+// { dg-skip-if "Frame pointer required for unwind tables" { m68k*-*-* fido*-*-* } "-fomit-frame-pointer" "" }
+
+__complex__ double
+foo (__complex__ double x, double y)
+{
+ try
+ {
+ return x / y;
+ }
+ catch (char *s)
+ {
+ return x;
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr36444.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr36444.C
new file mode 100644
index 000000000..ae639e25d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr36444.C
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */
+#define vector __attribute__((vector_size(16) ))
+struct struct1 {
+ union {} vmx;
+ struct struct2 {
+ struct2(const struct2& r) {}
+ } w;
+} __attribute__((aligned(16)));
+struct struct3 {
+ vector float vmx;
+ operator const struct1& () const{
+ return *reinterpret_cast<const struct1*>(this);
+ }
+};
+struct3 func3( struct3 V1);
+struct3 func2( void );
+void func1( ) {
+ struct1 vVec = func2() ;
+ func3 ( (struct3&)vVec );
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr36445.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr36445.C
new file mode 100644
index 000000000..56642e9ec
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr36445.C
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */
+// This used to fail as we would try to expand a VCE where one side had
+// a mode of BLKmode and the other side was a vector mode.
+#define vector __attribute__((vector_size(16) ))
+struct struct1 {
+ union { float a[3]; } vmx;
+ struct struct2 {
+ struct2(const struct2& r) {}
+ } w;
+} __attribute__((aligned(16)));
+struct struct3 {
+ vector float vmx;
+ operator const struct1& () const{
+ return *reinterpret_cast<const struct1*>(this);
+ }
+};
+struct3 func3( struct3 V1);
+struct3 func2( void );
+void func1( ) {
+ struct1 vVec = func2() ;
+ func3 ( (struct3&)vVec );
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr36745.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr36745.C
new file mode 100644
index 000000000..53845aaa7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr36745.C
@@ -0,0 +1,122 @@
+/* PR target/36745 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fPIC" } */
+/* { dg-require-effective-target fpic } */
+
+typedef __SIZE_TYPE__ size_t;
+class QBasicAtomicInt
+{
+public:
+ int _q_value;
+ inline bool operator== (int value) const
+ {
+ }
+ bool ref ();
+ bool deref ();
+};
+inline bool
+QBasicAtomicInt::ref ()
+{
+ __asm__ ("": "=m" (_q_value): :);
+ return true;
+}
+
+namespace std
+{
+ using::size_t;
+}
+extern "C++"
+{
+ inline void *operator new (std::size_t, void *__p)
+ {
+ return __p;
+ }
+}
+struct QMapData
+{
+ QBasicAtomicInt ref;
+ static QMapData shared_null;
+};
+template < class Key, class T > class QMap
+{
+ QMapData *d;
+public: inline QMap ():d (&QMapData::shared_null)
+ {
+ }
+ inline ~ QMap ()
+ {
+ if (!d->ref.deref ())
+ freeData (d);
+ }
+ void freeData (QMapData * d);
+};
+struct QVectorData
+{
+ QBasicAtomicInt ref;
+ static QVectorData shared_null;
+};
+template < typename T > struct QVectorTypedData
+{
+ QBasicAtomicInt ref;
+};
+template < typename T > class QVector
+{
+ union
+ {
+ QVectorData *p;
+ QVectorTypedData < T > *d;
+ };
+public: inline QVector ():p (&QVectorData::shared_null)
+ {
+ d->ref.ref ();
+ }
+ inline void detach ()
+ {
+ if (d->ref == 1)
+ detach_helper ();
+ }
+ inline T *data ()
+ {
+ detach ();
+ }
+ T & operator[](int i);
+ void detach_helper ();
+ void realloc ();
+};
+template < typename T > void QVector < T >::detach_helper ()
+{
+ realloc ();
+}
+
+template < typename T > inline T & QVector < T >::operator[](int i)
+{
+ return data ()[i];
+}
+template < typename T > void QVector < T >::realloc ()
+{
+ T *j, *i;
+ i->~T ();
+ while (j-- == i)
+ new (j) T;
+}
+
+void
+mergeInto (QVector < int >*a)
+{
+};
+struct QRegExpAutomatonState
+{
+ QVector < int >outs;
+ QMap < int, int >reenter;
+ QMap < int, int >anchors;
+};
+class QRegExpEngine
+{
+ void addCatTransitions ();
+ QVector < QRegExpAutomatonState > s;
+};
+void
+QRegExpEngine::addCatTransitions ()
+{
+ mergeInto (&s[2].outs);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr36826.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr36826.C
new file mode 100644
index 000000000..436220ba8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr36826.C
@@ -0,0 +1,166 @@
+template <class T> T CoinMax(register const T x1, register const T x2);
+template <class T> T CoinMin(register const T x1, register const T x2);
+class CoinIndexedVector;
+class ClpModel {
+protected:
+ double objectiveScale_;
+ double rhsScale_;
+ int numberRows_;
+ int numberColumns_;
+ double * rowActivity_;
+ double * columnActivity_;
+ double * dual_;
+ double * reducedCost_;
+ double* rowLower_;
+ double* rowUpper_;
+ double * rowObjective_;
+ double * columnLower_;
+ double * columnUpper_;
+ double * rowScale_;
+ double * columnScale_;
+ double * inverseRowScale_;
+ double * inverseColumnScale_;
+ int problemStatus_;
+ int secondaryStatus_;
+};
+class ClpSimplex : public ClpModel {
+ void deleteRim(int getRidOfFactorizationData=2);
+ double upperOut_;
+ double dualTolerance_;
+ double primalTolerance_;
+ double * rowLowerWork_;
+ double * columnLowerWork_;
+ double * rowUpperWork_;
+ double * columnUpperWork_;
+ double * rowObjectiveWork_;
+ CoinIndexedVector * columnArray_[6];
+ double * reducedCostWork_;
+ double * rowActivityWork_;
+ double * columnActivityWork_;
+ ClpSimplex * auxiliaryModel_;
+};
+class CoinIndexedVector {
+public:
+ void clear();
+};
+void ClpSimplex::deleteRim(int getRidOfFactorizationData)
+{
+ int numberRows=numberRows_;
+ int numberColumns=numberColumns_;
+ int i;
+ int numberPrimalScaled=0;
+ int numberPrimalUnscaled=0;
+ int numberDualScaled=0;
+ int numberDualUnscaled=0;
+ double scaleC = 1.0/objectiveScale_;
+ double scaleR = 1.0/rhsScale_;
+ if (!inverseColumnScale_) {
+ for (i=0; i<numberColumns; i++)
+ {
+ double scaleFactor = columnScale_[i];
+ double valueScaled = columnActivityWork_[i];
+ double lowerScaled = columnLowerWork_[i];
+ double upperScaled = columnUpperWork_[i];
+ if (lowerScaled>-1.0e20||upperScaled<1.0e20) {
+ if (valueScaled<lowerScaled-primalTolerance_|| valueScaled>upperScaled+primalTolerance_)
+ numberPrimalScaled++;
+ else
+ upperOut_ = CoinMax(upperOut_,CoinMin(valueScaled-lowerScaled,upperScaled-valueScaled));
+ }
+ columnActivity_[i] = valueScaled*scaleFactor*scaleR;
+ double value = columnActivity_[i];
+ if (value<columnLower_[i]-primalTolerance_)
+ numberPrimalUnscaled++;
+ else if (value>columnUpper_[i]+primalTolerance_)
+ numberPrimalUnscaled++;
+ double valueScaledDual = reducedCostWork_[i];
+ if (valueScaled>columnLowerWork_[i]+primalTolerance_&&valueScaledDual>dualTolerance_)
+ numberDualScaled++;
+ if (valueScaled<columnUpperWork_[i]-primalTolerance_&&valueScaledDual<-dualTolerance_)
+ numberDualScaled++;
+ reducedCost_[i] = (valueScaledDual*scaleC)/scaleFactor;
+ double valueDual = reducedCost_[i];
+ if (value>columnLower_[i]+primalTolerance_&&valueDual>dualTolerance_)
+ numberDualUnscaled++;
+ if (value<columnUpper_[i]-primalTolerance_&&valueDual<-dualTolerance_)
+ numberDualUnscaled++;
+ }
+ for (i=0; i<numberRows; i++)
+ {
+ double scaleFactor = rowScale_[i];
+ double valueScaled = rowActivityWork_[i];
+ double lowerScaled = rowLowerWork_[i];
+ double upperScaled = rowUpperWork_[i];
+ if (lowerScaled>-1.0e20||upperScaled<1.0e20) { if (valueScaled<lowerScaled-primalTolerance_|| valueScaled>upperScaled+primalTolerance_) numberPrimalScaled++; else upperOut_ = CoinMax(upperOut_,CoinMin(valueScaled-lowerScaled,upperScaled-valueScaled)); }
+ rowActivity_[i] = (valueScaled*scaleR)/scaleFactor;
+ double value = rowActivity_[i];
+ if (value<rowLower_[i]-primalTolerance_) numberPrimalUnscaled++;
+ else if (value>rowUpper_[i]+primalTolerance_) numberPrimalUnscaled++;
+ double valueScaledDual = dual_[i]+rowObjectiveWork_[i];
+ ;
+ if (valueScaled>rowLowerWork_[i]+primalTolerance_&&valueScaledDual>dualTolerance_) numberDualScaled++;
+ if (valueScaled<rowUpperWork_[i]-primalTolerance_&&valueScaledDual<-dualTolerance_) numberDualScaled++;
+ dual_[i] *= scaleFactor*scaleC;
+ double valueDual = dual_[i];
+ if (rowObjective_) valueDual += rowObjective_[i];
+ if (value>rowLower_[i]+primalTolerance_&&valueDual>dualTolerance_) numberDualUnscaled++;
+ if (value<rowUpper_[i]-primalTolerance_&&valueDual<-dualTolerance_) numberDualUnscaled++;
+ }
+ }
+ const double * inverseScale = inverseColumnScale_;
+ for (i=0; i<numberColumns; i++)
+ {
+ double scaleFactor = columnScale_[i];
+ double valueScaled = columnActivityWork_[i];
+ double lowerScaled = columnLowerWork_[i];
+ double upperScaled = columnUpperWork_[i];
+ if (lowerScaled>-1.0e20||upperScaled<1.0e20) { if (valueScaled<lowerScaled-primalTolerance_|| valueScaled>upperScaled+primalTolerance_) numberPrimalScaled++; else upperOut_ = CoinMax(upperOut_,CoinMin(valueScaled-lowerScaled,upperScaled-valueScaled)); }
+ columnActivity_[i] = valueScaled*scaleFactor*scaleR;
+ double value = columnActivity_[i];
+ if (value<columnLower_[i]-primalTolerance_) numberPrimalUnscaled++;
+ else if (value>columnUpper_[i]+primalTolerance_) numberPrimalUnscaled++;
+ double valueScaledDual = reducedCostWork_[i];
+ if (valueScaled>columnLowerWork_[i]+primalTolerance_&&valueScaledDual>dualTolerance_) numberDualScaled++;
+ if (valueScaled<columnUpperWork_[i]-primalTolerance_&&valueScaledDual<-dualTolerance_) numberDualScaled++;
+ reducedCost_[i] = (valueScaledDual*scaleC)*inverseScale[i];
+ double valueDual = reducedCost_[i];
+ if (value>columnLower_[i]+primalTolerance_&&valueDual>dualTolerance_) numberDualUnscaled++;
+ if (value<columnUpper_[i]-primalTolerance_&&valueDual<-dualTolerance_) numberDualUnscaled++;
+ }
+ inverseScale = inverseRowScale_;
+ for (i=0; i<numberRows; i++)
+ {
+ double scaleFactor = rowScale_[i];
+ double valueScaled = rowActivityWork_[i];
+ double lowerScaled = rowLowerWork_[i];
+ double upperScaled = rowUpperWork_[i];
+ if (lowerScaled>-1.0e20||upperScaled<1.0e20) { if (valueScaled<lowerScaled-primalTolerance_|| valueScaled>upperScaled+primalTolerance_) numberPrimalScaled++; else upperOut_ = CoinMax(upperOut_,CoinMin(valueScaled-lowerScaled,upperScaled-valueScaled)); }
+ rowActivity_[i] = (valueScaled*scaleR)*inverseScale[i];
+ double value = rowActivity_[i];
+ if (value<rowLower_[i]-primalTolerance_) numberPrimalUnscaled++;
+ else if (value>rowUpper_[i]+primalTolerance_) numberPrimalUnscaled++;
+ double valueScaledDual = dual_[i]+rowObjectiveWork_[i];
+ ;
+ if (valueScaled>rowLowerWork_[i]+primalTolerance_&&valueScaledDual>dualTolerance_) numberDualScaled++;
+ if (valueScaled<rowUpperWork_[i]-primalTolerance_&&valueScaledDual<-dualTolerance_) numberDualScaled++;
+ dual_[i] *= scaleFactor*scaleC;
+ double valueDual = dual_[i];
+ if (rowObjective_) valueDual += rowObjective_[i];
+ if (value>rowLower_[i]+primalTolerance_&&valueDual>dualTolerance_) numberDualUnscaled++;
+ if (value<rowUpper_[i]-primalTolerance_&&valueDual<-dualTolerance_) numberDualUnscaled++;
+ }
+ if (numberPrimalUnscaled) {
+ if (numberDualUnscaled)
+ secondaryStatus_=4;
+ else
+ secondaryStatus_=2;
+ }
+ if (numberDualUnscaled)
+ secondaryStatus_=3;
+ int iRow,iColumn;
+ for (iRow=0; iRow<4; iRow++)
+ ;
+ for (iColumn=0; iColumn<2; iColumn++)
+ if (columnArray_[iColumn])
+ columnArray_[iColumn]->clear();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr36960.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr36960.C
new file mode 100644
index 000000000..280a6755d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr36960.C
@@ -0,0 +1,22 @@
+// { dg-do run }
+
+struct Lower {
+ const int& ref;
+ Lower(const int& ref) : ref(ref) { }
+};
+struct Middle : public virtual Lower {
+ Middle(const int& ref) : Lower(ref) { }
+};
+struct Upper : public Middle {
+ Upper(const int& ref) : Lower(ref), Middle(ref) { }
+ int get() { return ref; }
+};
+extern "C" void abort (void);
+int main()
+{
+ int i = 0;
+ Upper upper(i);
+ if (upper.get() != 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37146-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37146-1.C
new file mode 100644
index 000000000..ea65226f1
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37146-1.C
@@ -0,0 +1,83 @@
+// PR c++/37146
+// { dg-do run }
+
+extern "C" void abort ();
+int a, b;
+struct A { int i:8; int j:8; int k:16; int l:32; } c;
+
+void
+f1 (int x, int y)
+{
+ (x ? a : b) = y;
+}
+
+void
+f2 (int x, int y)
+{
+ (x ? c.i : c.j) = y;
+}
+
+void
+f3 (int x, int y)
+{
+ (x ? c.i : a) = y;
+}
+
+void
+f4 (int x, int y)
+{
+ (x ? c.i : c.k) = y;
+}
+
+void
+f5 (int x, int y)
+{
+ (x ? c.l : b) = y;
+}
+
+#define CHECK(var, exp) \
+ do \
+ { \
+ if (var != exp) \
+ abort (); \
+ var = -1; \
+ if (a != -1 \
+ || b != -1 \
+ || c.i != -1 \
+ || c.j != -1 \
+ || c.k != -1 \
+ || c.l != -1) \
+ abort (); \
+ } \
+ while (0)
+
+int
+main ()
+{
+ a = -1;
+ b = -1;
+ c.i = -1;
+ c.j = -1;
+ c.k = -1;
+ c.l = -1;
+ f1 (1, 264);
+ CHECK (a, 264);
+ f1 (0, 264);
+ CHECK (b, 264);
+ f2 (1, 112);
+ CHECK (c.i, 112);
+ f2 (0, 112);
+ CHECK (c.j, 112);
+ f3 (1, 26);
+ CHECK (c.i, 26);
+ f3 (0, 26);
+ CHECK (a, 26);
+ f4 (1, 107);
+ CHECK (c.i, 107);
+ f4 (0, 107);
+ CHECK (c.k, 107);
+ f5 (1, 95);
+ CHECK (c.l, 95);
+ f5 (0, 95);
+ CHECK (b, 95);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37146-2.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37146-2.C
new file mode 100644
index 000000000..2a5417694
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37146-2.C
@@ -0,0 +1,67 @@
+// PR c++/37146
+// { dg-do run }
+
+extern "C" void abort ();
+int a, b;
+struct A { int i:8; int j:8; int k:16; int l:32; } c;
+
+int
+f1 (int x)
+{
+ return x ? a : b;
+}
+
+int
+f2 (int x)
+{
+ return x ? c.i : c.j;
+}
+
+int
+f3 (int x)
+{
+ return x ? c.i : a;
+}
+
+int
+f4 (int x)
+{
+ return x ? c.i : c.k;
+}
+
+int
+f5 (int x)
+{
+ return x ? c.l : b;
+}
+
+int
+main ()
+{
+ a = 17;
+ b = 18;
+ c.i = 19;
+ c.j = 20;
+ c.k = 21;
+ c.l = 22;
+ if (f1 (1) != a)
+ abort ();
+ if (f1 (0) != b)
+ abort ();
+ if (f2 (1) != c.i)
+ abort ();
+ if (f2 (0) != c.j)
+ abort ();
+ if (f3 (1) != c.i)
+ abort ();
+ if (f3 (0) != a)
+ abort ();
+ if (f4 (1) != c.i)
+ abort ();
+ if (f4 (0) != c.k)
+ abort ();
+ if (f5 (1) != c.l)
+ abort ();
+ if (f5 (0) != b)
+ abort ();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37343.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37343.C
new file mode 100644
index 000000000..c4614f39f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37343.C
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+typedef enum RW { rwBitmapGrey, rwBitmapGrey16 } RW;
+void FindDepth(RW);
+void ParseDumpBitmap(RW kind, int maxfiles)
+{
+ static const RW normalTypes[] = { };
+ const RW *bitmapTypes;
+ int i;
+ switch (kind) {
+ case rwBitmapGrey:
+ case rwBitmapGrey16:
+ bitmapTypes = &kind;
+ break;
+ default:
+ bitmapTypes = normalTypes;
+ }
+ for (i = 0; i < maxfiles; i++)
+ FindDepth(bitmapTypes[i]);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37345.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37345.C
new file mode 100644
index 000000000..5b49f5306
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37345.C
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+class EbmlElement {
+ virtual EbmlElement * Clone() const;
+};
+class KaxTracks : public EbmlElement {
+public:
+ EbmlElement * Clone() const {
+ return new KaxTracks(*this);
+ }
+};
+KaxTracks kax_tracks;
+void finish_file(void)
+{
+ kax_tracks.Clone();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37354.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37354.C
new file mode 100644
index 000000000..acdf29110
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37354.C
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+class GenericClass;
+struct AlsaDriver
+{
+ virtual int _read (unsigned nframes);
+};
+typedef void (GenericClass::*GenericMemFuncType) ();
+GenericMemFuncType m_pFunction;
+void AlsaDriver1 ()
+{
+ m_pFunction = reinterpret_cast < GenericMemFuncType > (&AlsaDriver::_read);
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37421.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37421.C
new file mode 100644
index 000000000..4b8447eac
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37421.C
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+
+#include <stdio.h>
+#include <string.h>
+
+inline int
+bci (const float &source)
+{
+ int dest;
+ memcpy (&dest, &source, sizeof (dest));
+ return dest;
+}
+
+inline float
+bcf (const int &source)
+{
+ float dest;
+ memcpy (&dest, &source, sizeof (dest));
+ return dest;
+}
+
+float
+Foo ()
+{
+ const int foo = bci (0.0f);
+ int bar = foo;
+ const int baz = foo & 1;
+ if (!baz && (foo & 2))
+ bar = 0;
+ return bcf (bar);
+}
+
+int
+main ()
+{
+ printf ("Foo() = %f\n", Foo());
+ return 0;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37456.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37456.C
new file mode 100644
index 000000000..cf2021be2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37456.C
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+int zot(int);
+struct bar {
+ ~bar() { }
+};
+int x;
+void doit(int a, int b, int c)
+{
+ bar pn;
+ int b1 = zot(a) * c;
+ int b2 = zot(b) * c;
+ x = b1 + b2;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37716.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37716.C
new file mode 100644
index 000000000..13b98d68a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37716.C
@@ -0,0 +1,56 @@
+// PR tree-optimization/37716
+// { dg-do compile }
+
+struct A
+{
+ struct B
+ {
+ int a, b, c, d;
+ void *e[1];
+ };
+ B *d;
+ inline void **f1 (int i) const
+ {
+ return d->e + d->c + i;
+ }
+};
+
+template <typename T>
+struct C
+{
+ struct D
+ {
+ void *v;
+ inline T & f3 ()
+ {
+ return *reinterpret_cast <T *> (this);
+ }
+ };
+ union
+ {
+ A p;
+ A::B *d;
+ };
+ T & operator[](int i)
+ {
+ if (d->a != 1)
+ f2 ();
+ return reinterpret_cast <D *> (p.f1 (i))->f3 ();
+ }
+ void f2 ();
+ void f3 (int i, const T & t);
+};
+
+class E
+{
+ int e, f;
+};
+
+C <E> c;
+
+void
+foo (int x)
+{
+ E e = c[x];
+ c.f3 (x, e);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37922.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37922.C
new file mode 100644
index 000000000..a7d05ab0f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr37922.C
@@ -0,0 +1,502 @@
+// { dg-do run }
+// { dg-options "-fpic" { target fpic } }
+
+typedef __SIZE_TYPE__ size_t;
+
+template <typename NumType>
+inline
+NumType
+absolute(NumType const& x)
+{
+ if (x < NumType(0)) return -x;
+ return x;
+}
+
+class trivial_accessor
+{
+ public:
+ typedef size_t index_type;
+ struct index_value_type {};
+
+ trivial_accessor() : size_(0) {}
+
+ trivial_accessor(size_t const& n) : size_(n) {}
+
+ size_t size_1d() const { return size_; }
+
+ protected:
+ size_t size_;
+};
+
+namespace N0
+{
+ template <typename ElementType,
+ typename AccessorType = trivial_accessor>
+ class const_ref
+ {
+ public:
+ typedef ElementType value_type;
+ typedef size_t size_type;
+
+ typedef AccessorType accessor_type;
+ typedef typename accessor_type::index_type index_type;
+ typedef typename accessor_type::index_value_type index_value_type;
+
+ const_ref() {}
+
+ const_ref(const ElementType* begin, accessor_type const& accessor)
+ : begin_(begin), accessor_(accessor)
+ {
+ init();
+ }
+
+ const_ref(const ElementType* begin, index_value_type const& n0)
+ : begin_(begin), accessor_(n0)
+ {
+ init();
+ }
+
+ const_ref(const ElementType* begin, index_value_type const& n0,
+ index_value_type const& n1)
+ : begin_(begin), accessor_(n0, n1)
+ {
+ init();
+ }
+
+ const_ref(const ElementType* begin, index_value_type const& n0,
+ index_value_type const& n1,
+ index_value_type const& n2)
+ : begin_(begin), accessor_(n0, n1, n2)
+ {
+ init();
+ }
+
+ accessor_type const& accessor() const { return accessor_; }
+ size_type size() const { return size_; }
+
+ const ElementType* begin() const { return begin_; }
+ const ElementType* end() const { return end_; }
+
+ ElementType const&
+ operator[](size_type i) const { return begin_[i]; }
+
+ const_ref<ElementType>
+ as_1d() const
+ {
+ return const_ref<ElementType>(begin_, size_);
+ }
+
+ protected:
+ void
+ init()
+ {
+ size_ = accessor_.size_1d();
+ end_ = begin_ + size_;
+ }
+
+ const ElementType* begin_;
+ accessor_type accessor_;
+ size_type size_;
+ const ElementType* end_;
+ };
+}
+
+template <typename ElementType,
+ typename AccessorType = trivial_accessor>
+class ref : public N0::const_ref<ElementType, AccessorType>
+{
+ public:
+ typedef ElementType value_type;
+ typedef size_t size_type;
+
+ typedef N0::const_ref<ElementType, AccessorType> base_class;
+ typedef AccessorType accessor_type;
+ typedef typename accessor_type::index_type index_type;
+
+ ref() {}
+
+ ElementType*
+ begin() const { return const_cast<ElementType*>(this->begin_); }
+
+ ElementType*
+ end() const { return const_cast<ElementType*>(this->end_); }
+
+ ElementType&
+ operator[](size_type i) const { return begin()[i]; }
+};
+
+namespace N1 {
+ template <typename ElementType, size_t N>
+ class tiny_plain
+ {
+ public:
+ typedef ElementType value_type;
+ typedef size_t size_type;
+
+ static const size_t fixed_size=N;
+
+ ElementType elems[N];
+
+ tiny_plain() {}
+
+ static size_type size() { return N; }
+
+ ElementType* begin() { return elems; }
+ const ElementType* begin() const { return elems; }
+ ElementType* end() { return elems+N; }
+ const ElementType* end() const { return elems+N; }
+ ElementType& operator[](size_type i) { return elems[i]; }
+ ElementType const& operator[](size_type i) const { return elems[i]; }
+ };
+
+ template <typename ElementType, size_t N>
+ class tiny : public tiny_plain<ElementType, N>
+ {
+ public:
+ typedef ElementType value_type;
+ typedef size_t size_type;
+
+ typedef tiny_plain<ElementType, N> base_class;
+
+ tiny() {}
+ };
+}
+
+template <typename NumType>
+class mat3 : public N1::tiny_plain<NumType, 9>
+{
+ public:
+ typedef typename N1::tiny_plain<NumType, 9> base_type;
+
+ mat3() {}
+ mat3(NumType const& e00, NumType const& e01, NumType const& e02,
+ NumType const& e10, NumType const& e11, NumType const& e12,
+ NumType const& e20, NumType const& e21, NumType const& e22)
+ : base_type(e00, e01, e02, e10, e11, e12, e20, e21, e22)
+ {}
+ mat3(base_type const& a)
+ : base_type(a)
+ {}
+
+ NumType const&
+ operator()(size_t r, size_t c) const
+ {
+ return this->elems[r * 3 + c];
+ }
+ NumType&
+ operator()(size_t r, size_t c)
+ {
+ return this->elems[r * 3 + c];
+ }
+
+ NumType
+ trace() const
+ {
+ mat3 const& m = *this;
+ return m[0] + m[4] + m[8];
+ }
+
+ NumType
+ determinant() const
+ {
+ mat3 const& m = *this;
+ return m[0] * (m[4] * m[8] - m[5] * m[7])
+ - m[1] * (m[3] * m[8] - m[5] * m[6])
+ + m[2] * (m[3] * m[7] - m[4] * m[6]);
+ }
+};
+
+template <typename NumType>
+inline
+mat3<NumType>
+operator-(mat3<NumType> const& v)
+{
+ mat3<NumType> result;
+ for(size_t i=0;i<9;i++) {
+ result[i] = -v[i];
+ }
+ return result;
+}
+
+class mat_grid : public N1::tiny<size_t, 2>
+{
+ public:
+ typedef N1::tiny<size_t, 2> index_type;
+ typedef index_type::value_type index_value_type;
+
+ mat_grid() { this->elems[0]=0; this->elems[1]=0; }
+
+ mat_grid(index_type const& n) : index_type(n) {}
+
+ mat_grid(index_value_type const& n0, index_value_type const& n1)
+ { this->elems[0]=n0; this->elems[1]=n1; }
+
+ size_t size_1d() const { return elems[0] * elems[1]; }
+
+ size_t
+ operator()(index_value_type const& r, index_value_type const& c) const
+ {
+ return r * elems[1] + c;
+ }
+};
+
+template <typename NumType, typename AccessorType = mat_grid>
+class mat_const_ref : public N0::const_ref<NumType, AccessorType>
+{
+ public:
+ typedef AccessorType accessor_type;
+ typedef typename N0::const_ref<NumType, AccessorType> base_type;
+ typedef typename accessor_type::index_value_type index_value_type;
+
+ mat_const_ref() {}
+
+ mat_const_ref(const NumType* begin, accessor_type const& grid)
+ : base_type(begin, grid)
+ {}
+
+ mat_const_ref(const NumType* begin, index_value_type const& n_rows,
+ index_value_type const& n_columns)
+ : base_type(begin, accessor_type(n_rows, n_columns))
+ {}
+
+ accessor_type
+ grid() const { return this->accessor(); }
+
+ index_value_type const&
+ n_rows() const { return this->accessor()[0]; }
+
+ index_value_type const&
+ n_columns() const { return this->accessor()[1]; }
+
+ NumType const&
+ operator()(index_value_type const& r, index_value_type const& c) const
+ {
+ return this->begin()[this->accessor()(r, c)];
+ }
+};
+
+template <typename NumType, typename AccessorType = mat_grid>
+class mat_ref : public mat_const_ref<NumType, AccessorType>
+{
+ public:
+ typedef AccessorType accessor_type;
+ typedef mat_const_ref<NumType, AccessorType> base_type;
+ typedef typename accessor_type::index_value_type index_value_type;
+
+ mat_ref() {}
+
+ mat_ref(NumType* begin, accessor_type const& grid)
+ : base_type(begin, grid)
+ {}
+
+ mat_ref(NumType* begin, index_value_type n_rows,
+ index_value_type n_columns)
+ : base_type(begin, accessor_type(n_rows, n_columns))
+ {}
+
+ NumType*
+ begin() const { return const_cast<NumType*>(this->begin_); }
+
+ NumType*
+ end() const { return const_cast<NumType*>(this->end_); }
+
+ NumType&
+ operator[](index_value_type const& i) const { return begin()[i]; }
+
+ NumType&
+ operator()(index_value_type const& r, index_value_type const& c) const
+ {
+ return this->begin()[this->accessor()(r, c)];
+ }
+};
+
+ template <typename AnyType>
+ inline void
+ swap(AnyType* a, AnyType* b, size_t n)
+ {
+ for(size_t i=0;i<n;i++) {
+ AnyType t = a[i]; a[i] = b[i]; b[i] = t;
+ }
+ }
+
+template <typename IntType>
+size_t
+form_t(mat_ref<IntType>& m,
+ mat_ref<IntType> const& t)
+{
+ typedef size_t size_t;
+ size_t mr = m.n_rows();
+ size_t mc = m.n_columns();
+ size_t tc = t.n_columns();
+ if (tc) {
+ }
+ size_t i, j;
+ for (i = j = 0; i < mr && j < mc;) {
+ size_t k = i; while (k < mr && m(k,j) == 0) k++;
+ if (k == mr)
+ j++;
+ else {
+ if (i != k) {
+ swap(&m(i,0), &m(k,0), mc);
+ if (tc) swap(&t(i,0), &t(k,0), tc);
+ }
+ for (k++; k < mr; k++) {
+ IntType a = absolute(m(k, j));
+ if (a != 0 && a < absolute(m(i,j))) {
+ swap(&m(i,0), &m(k,0), mc);
+ if (tc) swap(&t(i,0), &t(k,0), tc);
+ }
+ }
+ if (m(i,j) < 0) {
+ for(size_t ic=0;ic<mc;ic++) m(i,ic) *= -1;
+ if (tc) for(size_t ic=0;ic<tc;ic++) t(i,ic) *= -1;
+ }
+ bool cleared = true;
+ for (k = i+1; k < mr; k++) {
+ IntType a = m(k,j) / m(i,j);
+ if (a != 0) {
+ for(size_t ic=0;ic<mc;ic++) m(k,ic) -= a * m(i,ic);
+ if (tc) for(size_t ic=0;ic<tc;ic++) t(k,ic) -= a * t(i,ic);
+ }
+ if (m(k,j) != 0) cleared = false;
+ }
+ if (cleared) { i++; j++; }
+ }
+ }
+ m = mat_ref<IntType>(m.begin(), i, mc);
+ return i;
+}
+
+template <typename IntType>
+size_t
+form(mat_ref<IntType>& m)
+{
+ mat_ref<IntType> t(0,0,0);
+ return form_t(m, t);
+}
+
+typedef mat3<int> sg_mat3;
+
+class rot_mx
+{
+ public:
+ explicit
+ rot_mx(sg_mat3 const& m, int denominator=1)
+ : num_(m), den_(denominator)
+ {}
+
+ sg_mat3 const&
+ num() const { return num_; }
+ sg_mat3&
+ num() { return num_; }
+
+ int const&
+ operator[](size_t i) const { return num_[i]; }
+ int&
+ operator[](size_t i) { return num_[i]; }
+
+ int
+ const& operator()(int r, int c) const { return num_(r, c); }
+ int&
+ operator()(int r, int c) { return num_(r, c); }
+
+ int const&
+ den() const { return den_; }
+ int&
+ den() { return den_; }
+
+ rot_mx
+ minus_unit_mx() const
+ {
+ rot_mx result(*this);
+ for (size_t i=0;i<9;i+=4) result[i] -= den_;
+ return result;
+ }
+
+ rot_mx
+ operator-() const { return rot_mx(-num_, den_); }
+
+ int
+ type() const;
+
+ int
+ order(int type=0) const;
+
+ private:
+ sg_mat3 num_;
+ int den_;
+};
+
+class rot_mx_info
+{
+ public:
+ rot_mx_info(rot_mx const& r);
+
+ int type() const { return type_; }
+
+ private:
+ int type_;
+};
+
+int rot_mx::type() const
+{
+ int det = num_.determinant();
+ if (det == -1 || det == 1) {
+ switch (num_.trace()) {
+ case -3: return -1;
+ case -2: return -6;
+ case -1: if (det == -1) return -4;
+ else return 2;
+ case 0: if (det == -1) return -3;
+ else return 3;
+ case 1: if (det == -1) return -2;
+ else return 4;
+ case 2: return 6;
+ case 3: return 1;
+ }
+ }
+ return 0;
+}
+
+int rot_mx::order(int type) const
+{
+ if (type == 0) type = rot_mx::type();
+ if (type > 0) return type;
+ if (type % 2) return -type * 2;
+ return -type;
+}
+
+rot_mx_info::rot_mx_info(rot_mx const& r)
+: type_(r.type())
+{
+ if (type_ == 0) {
+ return;
+ }
+ rot_mx proper_r = r;
+ int proper_order = type_;
+ // THE PROBLEM IS AROUND HERE
+ if (proper_order < 0) {
+ proper_order *= -1;
+ proper_r = -proper_r; // THIS FAILS ...
+ }
+ if (proper_order > 1) {
+ rot_mx rmi = proper_r.minus_unit_mx(); // ... THEREFORE WRONG HERE
+ mat_ref<int> re_mx(rmi.num().begin(), 3, 3);
+ if (form(re_mx) != 2) {
+ type_ = 0;
+ }
+ }
+}
+
+int main()
+{
+ N1::tiny<int, 9> e;
+ e[0] = 1; e[1] = 0; e[2] = 0;
+ e[3] = 0; e[4] = -1; e[5] = 0;
+ e[6] = 0; e[7] = 0; e[8] = 1;
+ rot_mx r(e);
+ rot_mx_info ri(r);
+ if (ri.type() != -2)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr38565.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr38565.C
new file mode 100644
index 000000000..7216b1c67
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr38565.C
@@ -0,0 +1,12 @@
+// { dg-do compile }
+// Ignore warning on some powerpc-linux configurations.
+// { dg-prune-output "non-standard ABI extension" }
+// { dg-prune-output "changes the ABI" }
+#define vector __attribute__((vector_size(16) ))
+vector unsigned int f(int a)
+{
+ vector unsigned int mask = a ? (vector unsigned int){ 0x80000000, 0x80000000,
+0x80000000, 0x80000000 } : (vector unsigned int){0};
+ return mask;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr38705.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr38705.C
new file mode 100644
index 000000000..8058d3a39
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr38705.C
@@ -0,0 +1,27 @@
+// PR c++/38705
+// { dg-do compile }
+
+typedef int T;
+typedef __SIZE_TYPE__ size_t;
+extern "C" void *memcpy (void *, const void *, size_t);
+
+void
+foo (char *p, const int q)
+{
+ memcpy (p, &q, sizeof (int));
+}
+
+struct S
+{
+ T t;
+ int u;
+ int bar () const;
+ template <class T> void foo (const T &x) const {}
+};
+
+int
+S::bar () const
+{
+ foo (u);
+ foo (t);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr38745.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr38745.C
new file mode 100644
index 000000000..4ad9d85fe
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr38745.C
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+
+union u_u16
+{
+ unsigned short v;
+ struct
+ {
+ unsigned char lo8, hi8;
+ } __attribute__ ((__may_alias__)) u;
+} __attribute__ ((__may_alias__));
+union u_u32
+{
+ unsigned int v;
+ struct
+ {
+ u_u16 lo16, hi16;
+ } u;
+} __attribute__ ((__may_alias__));
+union u_u64
+{
+ struct
+ {
+ u_u32 lo32, hi32;
+ } u;
+};
+struct Record
+{
+};
+long long
+UnpackFullKey (Record & rec, const char *&p)
+{
+ long long c64 = 0;
+ (*(u_u16 *) & (*(u_u32 *) & ( *(u_u64*)&c64).u.lo32.v).u.lo16.v).u.hi8 = 1;
+ return c64;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr38747.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr38747.C
new file mode 100644
index 000000000..0f18a2f22
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr38747.C
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+
+extern "C" void abort (void);
+inline void *operator new (__SIZE_TYPE__, void *__p) throw () { return __p; }
+
+int __attribute__((noinline))
+foo(void)
+{
+ float f = 0;
+ int *i = new (&f) int (1);
+ return *(int *)&f;
+}
+
+int main()
+{
+ if (foo() != 1)
+ abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr38811.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr38811.C
new file mode 100644
index 000000000..e9b304da6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr38811.C
@@ -0,0 +1,73 @@
+/* { dg-do compile } */
+
+typedef unsigned long ULONG;
+void iwos_ErrorMessage(long error, const char * const file_name,
+ ULONG line_num, const char * const message);
+class AbcA2d {
+public:
+ double x;
+ double y;
+ ~AbcA2d() { }
+};
+enum AbcZyParamType { ABC_SP_1 };
+class AbcExtent2d {
+ AbcA2d m_vMin;
+ AbcA2d m_vMax;
+public:
+ AbcExtent2d(const AbcA2d & rMin, const AbcA2d & rMax);
+ AbcA2d ClampPoint2d(const AbcA2d & rPoint) const;
+ AbcA2d GetMax() const { return m_vMax; }
+ AbcA2d GetMin() const { }
+ AbcA2d Evaluate(double dNormalizedX, double dNormalizedY) const;
+};
+inline AbcExtent2d::AbcExtent2d(const AbcA2d & rMin, const AbcA2d & rMax)
+{
+ if (rMin.x > rMax.x || rMin.y > rMax.y)
+ {
+ long sErr = (1007);
+ if (sErr != 1000)
+ iwos_ErrorMessage(sErr,(const char * const)__null,
+ 0,(const char * const)__null);
+ }
+ else
+ {
+ m_vMin = rMin;
+ m_vMax = rMax;
+ }
+}
+inline AbcA2d AbcExtent2d::ClampPoint2d(const AbcA2d & rPoint) const
+{
+ AbcA2d sRet = rPoint;
+ if (rPoint.x < m_vMin.x)
+ sRet.x = m_vMin.x;
+ return sRet;
+}
+inline AbcA2d AbcExtent2d::Evaluate(double dNormalizedX, double dNormalizedY)
+const
+{
+ AbcA2d sRet;
+ sRet.x = m_vMin.x + dNormalizedX * (m_vMax.x - m_vMin.x);
+ sRet.y = m_vMin.y + dNormalizedY * (m_vMax.y - m_vMin.y);
+ return ClampPoint2d(sRet);
+}
+class AbcAbcdTracer {
+ AbcExtent2d m_vUVDomain;
+ virtual long TestIsoAbcde(AbcZyParamType eZyParam, double dParam,
+ int & rbZyxIsSolution);
+ virtual int DoesPointLieOnAbcde(AbcA2d & rUV, int bRefinePoint) const;
+};
+long AbcAbcdTracer::TestIsoAbcde(AbcZyParamType eZyParam, double dParam,
+ int & rbZyxIsSolution)
+{
+ AbcA2d sUV1(m_vUVDomain.GetMin());
+ AbcA2d sUV2(m_vUVDomain.GetMax());
+ AbcExtent2d sUVIso(sUV1,sUV2);
+ for (ULONG i=0; i<10; i++)
+ {
+ double dT = i / (10 -1.0);
+ AbcA2d sUV = sUVIso.Evaluate(dT,dT);
+ if (!DoesPointLieOnAbcde(sUV,0))
+ ;
+ }
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr39002.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr39002.C
new file mode 100644
index 000000000..534d91dfa
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr39002.C
@@ -0,0 +1,88 @@
+// PR target/39002
+// { dg-do run }
+
+struct S
+{
+ double x;
+ double y;
+ double z;
+};
+
+double foo (S *, S *);
+void bar (S *, S *, S *, double &, double &, double &);
+
+double
+foo (S *a1, S *a2)
+{
+ return __builtin_sqrt ((a1->x - a2->x) * (a1->x - a2->x)
+ + (a1->y - a2->y) * (a1->y - a2->y)
+ + (a1->z - a2->z) * (a1->z - a2->z));
+}
+
+void
+bar (S *p, S *q, S *r, double &x, double &y, double &z)
+{
+ if (foo (p, q) == 0.0)
+ {
+ x = r->x;
+ y = r->y;
+ z = r->z;
+ return;
+ }
+ if (foo (p, r) == 0.0)
+ {
+ x = r->x;
+ y = r->y;
+ z = r->z;
+ return;
+ }
+ if (foo (q, r) == 0.0)
+ {
+ x = r->x;
+ y = r->y;
+ z = r->z;
+ return;
+ }
+
+ double a1, b1, c1, d1, e1;
+ double dx, dy, dz, dw, dv;
+
+ a1 = q->x - p->x;
+ b1 = q->y - p->y;
+ c1 = q->z - p->z;
+ e1 = __builtin_sqrt (a1 * a1 + b1 * b1 + c1 * c1);
+ a1 = a1 / e1;
+ b1 = b1 / e1;
+ c1 = c1 / e1;
+ dx = p->x - r->x;
+ dy = p->y - r->y;
+ dz = p->z - r->z;
+ dw = dx * dx + dy * dy + dz * dz;
+ dv = 2.0 * dx * a1 + 2.0 * dy * b1 + 2.0 * dz * c1;
+ d1 = -dv / 2.0;
+ x = p->x + (a1 * d1);
+ y = p->y + (b1 * d1);
+ z = p->z + (c1 * d1);
+ return;
+}
+
+int
+main (void)
+{
+ S a, b, c, d, *p, *q, *r;
+
+ p = &a;
+ q = &b;
+ r = &c;
+ a.x = 0.0;
+ a.y = 0.0;
+ a.z = 0.0;
+ b.x = 1.0;
+ b.y = 0.0;
+ b.z = 0.0;
+ c.x = 0.0;
+ c.y = 1.0;
+ c.z = 0.0;
+ bar (p, q, r, d.x, d.y, d.z);
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr39259.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr39259.C
new file mode 100644
index 000000000..256181fa6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr39259.C
@@ -0,0 +1,40 @@
+// PR tree-optimization/39259
+// { dg-do compile }
+// { dg-options "-O2" }
+
+
+extern "C" int __mysetjmp () __attribute__ ((__returns_twice__));
+
+class TContStatus {};
+
+class TContEvent
+{
+public:
+ inline void Execute () throw();
+};
+
+class TCont
+{
+public:
+ TContStatus ReadD (void* buf, int deadline)
+ {
+ TContEvent event;
+ event.Execute ();
+ return TContStatus();
+ }
+ TContStatus ReadI (void *buf)
+ {
+ return ReadD (buf, 1);
+ }
+};
+
+void TContEvent::Execute () throw ()
+{
+ __mysetjmp();
+}
+
+void Broken (TCont *mCont)
+{
+ mCont->ReadI(0);
+ mCont->ReadI(0);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr39362.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr39362.C
new file mode 100644
index 000000000..554f9d06b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr39362.C
@@ -0,0 +1,105 @@
+/* { dg-do compile } */
+
+void *fastMalloc (int n);
+void fastFree (void *p);
+template <class T> struct C
+{
+ void deref () { delete static_cast <T *>(this); }
+};
+template <typename T>
+struct D
+{
+ D (T *ptr) : m_ptr (ptr) { }
+ ~D () { if (T * ptr = m_ptr) ptr->deref (); }
+ T *operator-> () const;
+ T *m_ptr;
+ typedef T *UnspecifiedBoolType;
+ operator UnspecifiedBoolType () const;
+};
+template <typename T> struct E
+{
+ static void destruct (T * begin, T * end)
+ {
+ for (T * cur = begin; cur != end; ++cur)
+ cur->~T ();
+ }
+};
+template <typename T> class F;
+template <typename T> struct G
+{
+ static void destruct (T * begin, T * end)
+ {
+ E <T>::destruct (begin, end);
+ }
+ static void uninitializedFill (T * dst, T * dstEnd, const T & val)
+ {
+ F<T>::uninitializedFill (dst, dstEnd, val);
+ }
+};
+template <typename T> struct H
+{
+ void allocateBuffer (int newCapacity)
+ {
+ m_buffer = static_cast <T *>(fastMalloc (newCapacity * sizeof (T)));
+ }
+ void deallocateBuffer (T * bufferToDeallocate)
+ {
+ if (m_buffer == bufferToDeallocate)
+ fastFree (bufferToDeallocate);
+ }
+ T *buffer () { }
+ int capacity () const { }
+ T *m_buffer;
+};
+template <typename T, int cap> class I;
+template <typename T> struct I <T, 0> : H <T>
+{
+ I (int capacity) { allocateBuffer (capacity); }
+ ~I () { this->deallocateBuffer (buffer ()); }
+ using H <T>::allocateBuffer;
+ H <T>::buffer; // { dg-warning "deprecated" }
+};
+template <typename T, int cap = 0> struct J
+{
+ typedef T *iterator;
+ ~J () { if (m_size) shrink (0); }
+ J (const J &);
+ int capacity () const { m_buffer.capacity (); }
+ T & operator[](int i) { }
+ iterator begin () { }
+ iterator end () { return begin () + m_size; }
+ void shrink (int size);
+ template <typename U> void append (const U &);
+ int m_size;
+ I <T, cap> m_buffer;
+};
+template <typename T, int cap>
+J <T, cap>::J (const J & other) : m_buffer (other.capacity ())
+{
+}
+template <typename T, int cap>
+void J <T, cap>::shrink (int size)
+{
+ G <T>::destruct (begin () + size, end ());
+ m_size = size;
+}
+struct A : public C <A>
+{
+ virtual ~A ();
+ typedef J <D <A> > B;
+ virtual A *firstChild () const;
+ virtual A *nextSibling () const;
+ virtual const B & children (int length);
+ B m_children;
+};
+const A::B &
+A::children (int length)
+{
+ for (D <A> obj = firstChild (); obj; obj = obj->nextSibling ())
+ {
+ B children = obj->children (2);
+ for (unsigned i = 0; i <length; ++i)
+ m_children.append (children[i]);
+ }
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr39417.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr39417.C
new file mode 100644
index 000000000..b7bbb88b7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr39417.C
@@ -0,0 +1,56 @@
+// { dg-do run }
+
+#include <vector>
+
+std::vector <int>
+sequence(int l, int n)
+{
+ std::vector <int> ret;
+ for(int i=n;i<=100;i++)
+ {
+ if(i%2==0)
+ {
+ if(l%i==i/2)
+ {
+ int init =l/i-i/2+1;
+ if(init>=0)
+ {
+ for(int j=0;j<i;j++)
+ {
+ ret.push_back(init);
+ init ++;
+ }
+ break;
+ }
+ }
+ }
+ else
+ {
+ if(l%i==0)
+ {
+ int init =l/i-i/2;
+ if(init>=0)
+ {
+ for(int j=0;j<i;j++)
+ {
+ ret.push_back(init);
+ init ++;
+ }
+ break;
+ }
+ }
+ }
+ }
+ return ret;
+}
+extern "C" void abort (void);
+int main()
+{
+ std::vector<int> res = sequence(18, 2);
+ if (res.size () != 3
+ || res[0] != 5
+ || res[1] != 6
+ || res[2] != 7)
+ abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr39678.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr39678.C
new file mode 100644
index 000000000..a7c120ad4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr39678.C
@@ -0,0 +1,26 @@
+/* PR target/39678 */
+/* { dg-do run } */
+/* { dg-options "-Wno-psabi" } */
+struct Y {};
+struct X {
+ struct Y y;
+ __complex__ float val;
+};
+
+struct X __attribute__((noinline))
+foo (float *p)
+{
+ struct X x;
+ __real x.val = p[0];
+ __imag x.val = p[1];
+ return x;
+}
+extern "C" void abort (void);
+float a[2] = { 3., -2. };
+int main()
+{
+ struct X x = foo(a);
+ if (__real x.val != 3. || __imag x.val != -2.)
+ abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr39713.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr39713.C
new file mode 100644
index 000000000..4ff72d1a7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr39713.C
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+
+template <typename To, typename From>
+static inline To
+bitwise_cast (From from)
+{
+ union
+ {
+ From f;
+ To t;
+ } u;
+ u.f = from;
+ return u.t;
+}
+
+extern void foo (unsigned char *);
+
+double
+bar ()
+{
+ unsigned char b[sizeof (unsigned long long)];
+ foo (b);
+ return bitwise_cast<double> (*(unsigned long long *) b);
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr39732.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr39732.C
new file mode 100644
index 000000000..4b3975b8d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr39732.C
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-require-profiling "-fprofile-generate" } */
+/* { dg-options "-fprofile-generate" } */
+
+template<class _CharT> struct char_traits;
+template<typename _OI>
+_OI __copy_move_a2(_OI __result);
+template<typename _OI> inline _OI
+copy(_OI __result)
+{
+ return __copy_move_a2 (__result);
+}
+template<typename _CharT, typename _Traits>
+class basic_ostream { };
+template<typename _Tp, typename _CharT = char, typename _Traits = char_traits<_CharT> >
+class ostream_iterator {
+ typedef basic_ostream<_CharT, _Traits> ostream_type;
+ ostream_type* _M_stream;
+ const _CharT* _M_string;
+public:
+ ostream_iterator(ostream_type& __s, const _CharT* __c)
+ : _M_stream(&__s), _M_string(__c) { }
+ ostream_iterator(const ostream_iterator& __obj)
+ : _M_stream(__obj._M_stream), _M_string(__obj._M_string) { }
+};
+int f(void)
+{
+ basic_ostream<char, char_traits<char> > os;
+ copy(ostream_iterator<const int>(os, ","));
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr39764.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr39764.C
new file mode 100644
index 000000000..a89013313
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr39764.C
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+class A;
+class B { };
+extern const double NaN;
+B foo(A* exec, double d);
+inline B baz(A* a) {
+ return foo(a, NaN);
+}
+B bar(A* a) {
+ return baz(a);
+}
+extern const double NaN = (__builtin_nanf(""));
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40081.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40081.C
new file mode 100644
index 000000000..e65c5a843
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40081.C
@@ -0,0 +1,16 @@
+struct Atomic_t {
+ Atomic_t(int i) : val(i) { }
+ volatile int val;
+};
+class RefCount {
+public:
+ RefCount(Atomic_t c) : m_count(c) { }
+ Atomic_t m_count;
+};
+class IntrusiveCountableBase {
+ RefCount m_useCount;
+protected:
+ IntrusiveCountableBase();
+};
+IntrusiveCountableBase::IntrusiveCountableBase() : m_useCount(0) { }
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40102.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40102.C
new file mode 100644
index 000000000..49f56b5bc
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40102.C
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+bool foo0(int) { return true; }
+
+bool foo1();
+
+struct A
+{
+ A();
+ ~A();
+
+ template<typename T> void bar1(T f)
+ {
+ if (f(0))
+ foo1();
+ }
+
+ template<typename T> void bar2(T);
+};
+
+template<typename T> void A::bar2(T f)
+{
+ A a, b[1], *p;
+
+ while (foo1())
+ {
+ if (p)
+ ++p;
+ if (p && foo1())
+ bar1(f);
+ if (p)
+ ++p;
+ }
+
+ if (foo1())
+ bar1(f);
+}
+
+void baz()
+{
+ A().bar2(foo0);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40321.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40321.C
new file mode 100644
index 000000000..917743109
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40321.C
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+
+struct VectorD2
+{
+ VectorD2() : x(0), y(0) { }
+ VectorD2(int _x, int _y) : x(_x), y(_y) { }
+ int x, y;
+ int GetLength2() const { return x*x + y*y; };
+ VectorD2 operator+(const VectorD2 vec) const {
+ return VectorD2(x+vec.x,y+vec.y);
+ }
+};
+struct Shape
+{
+ enum Type { ST_RECT, ST_CIRCLE } type;
+ VectorD2 pos;
+ VectorD2 radius;
+ bool CollisionWith(const Shape& s) const;
+};
+bool Shape::CollisionWith(const Shape& s) const
+{
+ if(type == ST_CIRCLE && s.type == ST_RECT)
+ return s.CollisionWith(*this);
+ return (pos + s.pos).GetLength2() < (radius + s.radius).GetLength2();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40323.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40323.C
new file mode 100644
index 000000000..c7ffcb5d3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40323.C
@@ -0,0 +1,68 @@
+/* Testcase for PR 40323. */
+/* { dg-do compile } */
+/* { dg-options "-fno-early-inlining" } */
+/* { dg-add-options bind_pic_locally } */
+
+extern void do_something (const char *, int);
+
+class Parent
+{
+private:
+ const char *data;
+
+public:
+ Parent (const char *d) : data(d)
+ {}
+
+ int funcOne (int delim) const;
+};
+
+class AnotherParent
+{
+private:
+ double d;
+public:
+ AnotherParent (void) : d(0)
+ {}
+};
+
+
+class Child : public AnotherParent, Parent
+{
+private:
+ int zzz;
+public:
+ Child (const char *d) : Parent(d)
+ {}
+};
+
+
+int Parent::funcOne (int delim) const
+{
+ int i;
+ for (i = 0; i < delim; i++)
+ do_something(data, i);
+
+ return 1;
+}
+
+int docalling (int (Child::* f)(int delim) const)
+{
+ Child S ("muhehehe");
+
+ return (S.*f)(4);
+}
+
+typedef int (Parent::* my_mp_type)(int delim);
+
+int main (int argc, char *argv[])
+{
+ int i;
+ int (Parent::* f)(int ) const;
+ int (Child::* g)(int ) const;
+
+ f = &Parent::funcOne;
+ g = (int (Child::* )(int) const) f;
+ i = docalling (g);
+ return i;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40335.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40335.C
new file mode 100644
index 000000000..14ea95d40
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40335.C
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+
+extern "C" void abort (void);
+int
+main (void)
+{
+ int i = -1;
+ switch ((signed char) i)
+ {
+ case 255: /* { dg-bogus "exceeds maximum value" "" { xfail *-*-* } } */
+ abort ();
+ default:
+ break;
+ }
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40388.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40388.C
new file mode 100644
index 000000000..63fbbfba5
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40388.C
@@ -0,0 +1,21 @@
+void foo();
+
+struct A
+{
+ ~A()
+ {
+ try
+ {
+ foo();
+ foo();
+ }
+ catch (...)
+ {
+ }
+ }
+};
+
+void bar()
+{
+ A a1, a2;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40389.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40389.C
new file mode 100644
index 000000000..e3ceb1238
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40389.C
@@ -0,0 +1,84 @@
+/* { dg-do run } */
+
+template <typename V> struct S
+{
+ V *f, *l;
+ __attribute__ ((noinline)) S (void) { f = 0, l = 0; }
+ void foo (V *x)
+ {
+ if (x->p != 0)
+ x->p->n = x->n;
+ else
+ f = x->n;
+ if (x->n != 0)
+ x->n->p = x->p;
+ else
+ l = x->p;
+ }
+ __attribute__ ((noinline)) void bar (V *x)
+ {
+ x->n = 0;
+ x->p = l;
+ if (l != 0)
+ l->n = x;
+ else
+ f = x;
+ l = x;
+ }
+};
+
+struct H;
+
+struct A
+{
+ S <H> k;
+};
+
+struct H
+{
+ A *a;
+ H *p, *n;
+ __attribute__ ((noinline)) H (void) { p = 0, n = 0, a = 0; }
+ __attribute__ ((noinline)) H (A *b) : a (b)
+ {
+ p = 0;
+ n = 0;
+ if (a != 0)
+ a->k.bar (this);
+ }
+ __attribute__ ((noinline)) H (const H &h) : a (h.a)
+ {
+ p = 0;
+ n = 0;
+ if (a != 0)
+ a->k.bar (this);
+ }
+ ~H (void) { if (a != 0) a->k.foo (this); }
+ H &operator= (const H &o)
+ {
+ if (a != 0 || &o == this)
+ __builtin_abort ();
+ a = o.a;
+ if (a != 0)
+ a->k.bar (this);
+ return *this;
+ }
+};
+
+__attribute__ ((noinline))
+H baz (void)
+{
+ return H (new A);
+}
+
+H g;
+
+int
+main (void)
+{
+ g = baz ();
+ if (g.a->k.f != &g)
+ __builtin_abort ();
+ return 0;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40460.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40460.C
new file mode 100644
index 000000000..1d54df72b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40460.C
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+
+void bar(int);
+void foo(void)
+{
+ for (int i = 0; i<1; ++i)
+ bar (i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i);
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40492.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40492.C
new file mode 100644
index 000000000..cab9426d0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40492.C
@@ -0,0 +1,26 @@
+typedef unsigned short ushort;
+class QChar {
+public:
+ QChar( const QChar& c );
+ ushort ucs;
+};
+inline QChar::QChar( const QChar& c ) : ucs( c.ucs ) { };
+class QString { };
+class KoAutoFormat {
+public:
+ struct TypographicQuotes { QChar begin, end; };
+ TypographicQuotes getConfigTypographicDoubleQuotes() const {
+ return m_typographicDoubleQuotes;
+ }
+ TypographicQuotes m_typographicDoubleQuotes;
+};
+class KoAutoFormatDia {
+ QChar oDoubleBegin, oDoubleEnd;
+ KoAutoFormat * m_docAutoFormat;
+ bool noSignal;
+ void changeAutoformatLanguage(void);
+};
+void KoAutoFormatDia::changeAutoformatLanguage(void)
+{
+ oDoubleEnd= m_docAutoFormat->getConfigTypographicDoubleQuotes().end;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40642.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40642.C
new file mode 100644
index 000000000..771c83717
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40642.C
@@ -0,0 +1,27 @@
+// { dg-do compile }
+/* { dg-require-profiling "-fprofile-generate" } */
+// { dg-options "-fprofile-generate" }
+
+// GCC used to ICE with some EH edge missing.
+
+inline void* operator new(__SIZE_TYPE__, void* p) throw() { return p; }
+inline void operator delete (void*, void*) throw() { }
+
+template<typename T> void foo(void* p, T t)
+{
+ new(p) T(t);
+}
+
+void bar();
+
+template<typename T> struct A
+{
+ T* p;
+
+ A() { try { foo(p, T()); } catch(...) {} }
+
+ A(const A&) { try { bar(); } catch(...) { throw; } }
+};
+
+A<A<int> > a;
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40834.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40834.C
new file mode 100644
index 000000000..67d302853
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40834.C
@@ -0,0 +1,52 @@
+/* { dg-do run } */
+
+extern "C" void abort (void);
+class XalanDOMString
+{
+public:
+ int y;
+};
+
+class XObject
+{
+public:
+ const XalanDOMString& str() const { return x; }
+ XalanDOMString x;
+};
+
+class XObjectPtr
+{
+public:
+ XObjectPtr(const XObjectPtr& theSource)
+ {
+ m_xobjectPtr = theSource.m_xobjectPtr;
+ }
+ const XObject* operator->() const
+ {
+ return m_xobjectPtr;
+ };
+ XObjectPtr(XObject *p) { m_xobjectPtr = p; }
+ XObject* m_xobjectPtr;
+};
+
+class FunctionSubstringBefore
+{
+public:
+ int execute( const XObjectPtr arg1) const
+ {
+ const XalanDOMString& theFirstString = arg1->str();
+ return theFirstString.y;
+ }
+};
+
+int
+main ()
+{
+ XObject x;
+ XObjectPtr y (&x);
+ x.x.y = -1;
+ FunctionSubstringBefore z;
+ if (z.execute (y) != -1)
+ abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40924.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40924.C
new file mode 100644
index 000000000..9140da3ba
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40924.C
@@ -0,0 +1,111 @@
+// PR rtl-optimization/40924
+// { dg-do run }
+
+extern "C" void abort (void);
+
+#define MAY_ALIAS __attribute__((__may_alias__))
+
+typedef struct { float v[2]; } floata;
+typedef struct { int v[2]; } inta;
+
+typedef unsigned int uint MAY_ALIAS;
+typedef signed int sint MAY_ALIAS;
+typedef float flt MAY_ALIAS;
+
+static inline unsigned short
+less_than (inta a, inta b)
+{
+ unsigned short r = 0;
+ const uint *p1 = (const uint *) &a;
+ const uint *p2 = (const uint *) &b;
+ for (int i=0; i < 2; i++)
+ if (p1[i] < p2[i]) r |= (1 << i);
+ return r;
+}
+
+static inline inta
+multiply (inta b, inta c)
+{
+ inta r;
+ sint *p3 = (sint *) &c;
+ for (int i=0; i < 2; i++)
+ r.v[i] = (int) (b.v[i] * p3[i] & 0xFFFFFFFF);
+ return r;
+}
+
+static inline floata
+gather (inta indexes, const void *baseAddr)
+{
+ floata r;
+
+ sint *idx = (sint *) &indexes;
+ flt *src = (flt *) baseAddr;
+ for (int i=0; i < 2; i++)
+ r.v[i] = *(src + idx[i]);
+ return r;
+}
+
+static inline inta
+add (const inta &b, const inta &c)
+{
+ inta result;
+ sint *r = (sint *) &result;
+
+ for (int i=0; i < 2; i++)
+ r[i] = b.v[i] + c.v[i];
+ return result;
+}
+
+struct uintv
+{
+ inta data;
+ inline uintv () { data.v[0] = 0; data.v[1] = 1; }
+ inline uintv (unsigned int a)
+ {
+ for (int i=0; i < 2; i++)
+ *(uint *) &data.v[i] = a;
+ }
+ inline uintv (inta x) : data (x) {}
+ inline uintv operator* (const uintv &x) const
+ { return multiply (data, x.data); }
+ inline uintv operator+ (const uintv &x) const
+ { return uintv (add (data, x.data)); }
+ inline unsigned short operator< (const uintv &x) const
+ { return less_than (data, x.data); }
+};
+
+struct floatv
+{
+ floata data;
+ explicit inline floatv (const uintv &x)
+ {
+ uint *p2 = (uint *) &x.data;
+ for (int i=0; i < 2; i++)
+ data.v[i] = p2[i];
+ }
+ inline floatv (const float *array, const uintv &indexes)
+ {
+ const uintv &offsets = indexes * uintv (1);
+ data = gather (offsets.data, array);
+ }
+ unsigned short operator== (const floatv &x) const
+ {
+ unsigned short r = 0;
+ for (int i=0; i < 2; i++)
+ if (data.v[i] == x.data.v[i]) r |= (1 << i);
+ return r;
+ }
+};
+
+int
+main ()
+{
+ const float array[2] = { 2, 3 };
+ for (uintv i; (i < 2) == 3; i = i + 2)
+ {
+ const floatv ii (i + 2);
+ floatv a (array, i);
+ if ((a == ii) != 3)
+ abort ();
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40991.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40991.C
new file mode 100644
index 000000000..c04ef9e7a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr40991.C
@@ -0,0 +1,113 @@
+// { dg-do compile { target c++11 } }
+
+typedef __SIZE_TYPE__ size_t;
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ using ::size_t;
+ void __throw_bad_function_call() __attribute__((__noreturn__));
+}
+inline void* operator new(std::size_t, void* __p) throw() {
+ return __p;
+}
+namespace std {
+ class type_info {
+ public:
+ bool operator==(const type_info& __arg) const { }
+ };
+ namespace tr1 {
+ template<typename _Tp, _Tp __v> struct integral_constant { };
+ typedef integral_constant<bool, true> true_type;
+ template<typename _Res, typename... _ArgTypes>
+ struct _Maybe_unary_or_binary_function { };
+ class _Undefined_class;
+ union _Nocopy_types {
+ void (_Undefined_class::*_M_member_pointer)();
+ };
+ union _Any_data {
+ void* _M_access() {
+ return &_M_pod_data[0];
+ }
+ char _M_pod_data[sizeof(_Nocopy_types)];
+ };
+ enum _Manager_operation { __get_type_info, __get_functor_ptr, __clone_functor, __destroy_functor };
+ template<typename _Tp> struct _Simple_type_wrapper {
+ _Simple_type_wrapper(_Tp __value) : __value(__value) { }
+ _Tp __value;
+ };
+ template<typename _Signature> class function;
+ class _Function_base {
+ public:
+ static const std::size_t _M_max_size = sizeof(_Nocopy_types);
+ static const std::size_t _M_max_align = __alignof__(_Nocopy_types);
+ template<typename _Functor> class _Base_manager {
+ static const bool __stored_locally = (sizeof(_Functor) <= _M_max_size && __alignof__(_Functor) <= _M_max_align && (_M_max_align % __alignof__(_Functor) == 0));
+ typedef integral_constant<bool, __stored_locally> _Local_storage;
+ public:
+ static bool _M_manager(_Any_data& __dest, const _Any_data& __source, _Manager_operation __op) { }
+ static void _M_init_functor(_Any_data& __functor, const _Functor& __f) {
+ _M_init_functor(__functor, __f, _Local_storage());
+ }
+ template<typename _Class, typename _Tp> static bool _M_not_empty_function(_Tp _Class::* const& __mp) {
+ return __mp;
+ }
+ static void _M_init_functor(_Any_data& __functor, const _Functor& __f, true_type) {
+ new (__functor._M_access()) _Functor(__f);
+ }
+ };
+ ~_Function_base() {
+ if (_M_manager) _M_manager(_M_functor, _M_functor, __destroy_functor);
+ }
+ bool _M_empty() const {
+ return !_M_manager;
+ }
+ typedef bool (*_Manager_type)(_Any_data&, const _Any_data&, _Manager_operation);
+ _Any_data _M_functor;
+ _Manager_type _M_manager;
+ };
+ template<typename _Signature, typename _Functor> class _Function_handler;
+ template<typename _Class, typename _Member, typename _Res, typename... _ArgTypes> class _Function_handler<_Res(_ArgTypes...), _Member _Class::*> : public _Function_handler<void(_ArgTypes...), _Member _Class::*> {
+ public:
+ static _Res _M_invoke(const _Any_data& __functor, _ArgTypes... __args) { }
+ };
+ template<typename _Class, typename _Member, typename... _ArgTypes> class _Function_handler<void(_ArgTypes...), _Member _Class::*> : public _Function_base::_Base_manager< _Simple_type_wrapper< _Member _Class::* > > { };
+ template<typename _Res, typename... _ArgTypes> class function<_Res(_ArgTypes...)> : public _Maybe_unary_or_binary_function<_Res, _ArgTypes...>, private _Function_base {
+ typedef _Res _Signature_type(_ArgTypes...);
+ struct _Useless { };
+ public:
+ template<typename _Functor> function(_Functor __f, _Useless = _Useless());
+ _Res operator()(_ArgTypes... __args) const;
+ const type_info& target_type() const;
+ typedef _Res (*_Invoker_type)(const _Any_data&, _ArgTypes...);
+ _Invoker_type _M_invoker;
+ };
+ template<typename _Res, typename... _ArgTypes> template<typename _Functor> function<_Res(_ArgTypes...)>:: function(_Functor __f, _Useless) : _Function_base() {
+ typedef _Function_handler<_Signature_type, _Functor> _My_handler;
+ if (_My_handler::_M_not_empty_function(__f)) {
+ _M_invoker = &_My_handler::_M_invoke;
+ _M_manager = &_My_handler::_M_manager;
+ _My_handler::_M_init_functor(_M_functor, __f);
+ }
+ }
+ template<typename _Res, typename... _ArgTypes> _Res function<_Res(_ArgTypes...)>:: operator()(_ArgTypes... __args) const {
+ if (_M_empty()) {
+ __throw_bad_function_call();
+ }
+ return _M_invoker(_M_functor, __args...);
+ }
+ template<typename _Res, typename... _ArgTypes> const type_info& function<_Res(_ArgTypes...)>:: target_type() const {
+ if (_M_manager) {
+ _Any_data __typeinfo_result;
+ _M_manager(__typeinfo_result, _M_functor, __get_type_info);
+ }
+ }
+ }
+}
+struct X {
+ int bar;
+};
+void test05() {
+ using std::tr1::function;
+ X x;
+ function<int(X&)> frm(&X::bar);
+ frm(x) == 17;
+ typeid(int X::*) == frm.target_type();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr41144.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr41144.C
new file mode 100644
index 000000000..64dc117d7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr41144.C
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+
+struct rgba8;
+template<class ColorT> class span_gouraud {
+public:
+ struct coord_type { };
+ coord_type m_coord[3];
+};
+template<class ColorT> class span_gouraud_rgba : public span_gouraud<ColorT>
+{
+ typedef ColorT color_type;
+ typedef span_gouraud<color_type> base_type;
+ typedef typename base_type::coord_type coord_type;
+public:
+ void prepare() {
+ coord_type coord[3];
+ }
+};
+void the_application() {
+ typedef span_gouraud_rgba<rgba8> gouraud_span_gen_type;
+ gouraud_span_gen_type span_gouraud;
+ span_gouraud.prepare();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr41183.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr41183.C
new file mode 100644
index 000000000..df3e30341
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr41183.C
@@ -0,0 +1,30 @@
+// PR c++/41183
+// { dg-do compile }
+
+void foo (const char *);
+
+template <int *>
+struct A
+{
+ template <typename T> A (const int &, T);
+ int i;
+};
+
+template <int *X>
+template <typename T>
+A<X>::A (const int &j, T) : i(j)
+{
+ foo (0);
+ foo (0);
+ foo (__PRETTY_FUNCTION__);
+}
+
+int N;
+
+struct B
+{
+ B ();
+ A<&N> a;
+};
+
+B::B() : a(N, 0) {}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr41186.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr41186.C
new file mode 100644
index 000000000..fdfee2cd3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr41186.C
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+
+struct Foo {
+ Foo() {};
+ int i;
+ short f;
+};
+struct Bar : public Foo {
+ Bar() {};
+ short b;
+};
+
+extern "C" void abort(void);
+
+int main()
+{
+ Bar b1, b2;
+ b2.i = 0;
+ b1.f = 0;
+ b1.b = 1;
+ b2.f = 1;
+ b2.b = 2;
+ static_cast<Foo&>(b1) = static_cast<Foo&>(b2);
+ if (b1.i != 0 || b1.b != 1)
+ abort ();
+ if (b1.f != 1)
+ abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr41257-2.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr41257-2.C
new file mode 100644
index 000000000..230fa5dde
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr41257-2.C
@@ -0,0 +1,16 @@
+/* { dg-do link } */
+
+struct A
+{
+ virtual ~A();
+};
+
+struct B : virtual A
+{
+ virtual ~B() {}
+};
+
+int main()
+{
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr41257.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr41257.C
new file mode 100644
index 000000000..60cfc5339
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr41257.C
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+
+struct A
+{
+ virtual void foo();
+ virtual ~A();
+ int i;
+};
+
+struct B : virtual A {};
+
+struct C : B
+{
+ virtual void foo();
+};
+
+void bar()
+{
+ C().foo();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr41273.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr41273.C
new file mode 100644
index 000000000..bdce05355
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr41273.C
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-g" } */
+
+long *H2_ipX_ener_sort;
+double H2_old_populations[2];
+double H2_total;
+
+void H2_LevelPops()
+{
+ double sum_pop = 0.;
+ long nEner = 0;
+ while( nEner < 3 && sum_pop/H2_total < 0.99999 )
+ {
+ long ip = H2_ipX_ener_sort[nEner];
+ sum_pop += H2_old_populations[ip];
+ ++nEner;
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr41680.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr41680.C
new file mode 100644
index 000000000..7faab0d5f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr41680.C
@@ -0,0 +1,23 @@
+// PR target/41680
+// { dg-do compile }
+
+extern void baz (float);
+
+inline bool
+bar (float x)
+{
+ union { float f; int i; } u;
+ u.f = x;
+ return (u.i & 1);
+}
+
+void
+foo (float *x)
+{
+ for (int i = 0; i < 10; i++)
+ {
+ float f = x[i];
+ if (!bar (f))
+ baz (f);
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr41775.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr41775.C
new file mode 100644
index 000000000..3d8548e3f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr41775.C
@@ -0,0 +1,284 @@
+/* { dg-do compile } */
+/* { dg-require-visibility "" } */
+
+typedef unsigned int size_t;
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ template < typename _Iterator > struct iterator_traits
+ {
+ };
+ template < typename _Tp > struct iterator_traits <_Tp * >
+ {
+ typedef _Tp & reference;
+ };
+}
+
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default")))
+{
+ using std::iterator_traits;
+ template < typename _Iterator, typename _Container > class __normal_iterator
+ {
+ public:typedef _Iterator iterator_type;
+ typedef typename iterator_traits < _Iterator >::reference reference;
+ reference operator* () const
+ {
+ }
+ __normal_iterator operator++ (int)
+ {
+ }
+ };
+ template < typename _IteratorL, typename _IteratorR,
+ typename _Container > inline bool operator!= (const __normal_iterator <
+ _IteratorL,
+ _Container > &__lhs,
+ const __normal_iterator <
+ _IteratorR,
+ _Container > &__rhs)
+ {
+ }
+}
+
+extern "C"
+{
+ extern "C"
+ {
+ __extension__ typedef __SIZE_TYPE__ __intptr_t;
+ }
+}
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default")))
+{
+ template < typename _Tp > class new_allocator
+ {
+ public:typedef size_t size_type;
+ typedef _Tp *pointer;
+ template < typename _Tp1 > struct rebind
+ {
+ typedef new_allocator < _Tp1 > other;
+ };
+ };
+}
+
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+template < typename _Tp > class allocator:public __gnu_cxx::new_allocator <
+ _Tp >
+ {
+ };
+}
+
+extern "C"
+{
+ typedef __intptr_t intptr_t;
+}
+namespace llvm
+{
+ template < typename NodeTy > class ilist_half_node
+ {
+ };
+template < typename NodeTy > class ilist_node:private ilist_half_node <
+ NodeTy >
+ {
+ };
+ class MachineBasicBlock;
+ class MachineOperand
+ {
+ public:enum MachineOperandType
+ {
+ }
+ Contents;
+ unsigned getReg () const
+ {
+ }
+ };
+ class TargetRegisterInfo;
+}
+
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ template < typename _Tp, typename _Alloc > struct _Vector_base
+ {
+ typedef typename _Alloc::template rebind < _Tp >::other _Tp_alloc_type;
+ };
+template < typename _Tp, typename _Alloc = std::allocator < _Tp > >class vector:protected _Vector_base < _Tp,
+ _Alloc
+ >
+ {
+ typedef _Vector_base < _Tp, _Alloc > _Base;
+ typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
+ public:typedef _Tp value_type;
+ typedef typename _Tp_alloc_type::pointer pointer;
+ typedef __gnu_cxx::__normal_iterator < pointer, vector > iterator;
+ iterator begin ()
+ {
+ }
+ iterator end ()
+ {
+ }
+ };
+}
+
+namespace llvm
+{
+ class MachineFunction;
+ class MachineInstr:public ilist_node < MachineInstr >
+ {
+ public:const MachineBasicBlock *getParent () const
+ {
+ }
+ const MachineOperand & getOperand (unsigned i) const
+ {
+ }
+ bool registerDefIsDead (unsigned Reg, const TargetRegisterInfo * TRI =
+ __null) const
+ {
+ }
+ };
+ class AnalysisResolver;
+ class Pass
+ {
+ AnalysisResolver *Resolver;
+ intptr_t PassID;
+ public: explicit Pass (intptr_t pid):Resolver (0), PassID (pid)
+ {
+ }
+ explicit Pass (const void *pid):Resolver (0), PassID ((intptr_t) pid)
+ {
+ }
+ template < typename AnalysisType > AnalysisType & getAnalysis () const;
+ };
+ class FunctionPass:public Pass
+ {
+ public:explicit FunctionPass (intptr_t pid):Pass (pid)
+ {
+ }
+ explicit FunctionPass (const void *pid):Pass (pid)
+ {
+ }
+ };
+ class PassInfo
+ {
+ public:typedef Pass *(*NormalCtor_t) ();
+ private:const char *const PassName;
+ const char *const PassArgument;
+ const intptr_t PassID;
+ const bool IsCFGOnlyPass;
+ const bool IsAnalysis;
+ const bool IsAnalysisGroup;
+ NormalCtor_t NormalCtor;
+ public: PassInfo (const char *name, const char *arg, intptr_t pi, NormalCtor_t normal = 0, bool isCFGOnly = false, bool is_analysis = false):PassName (name), PassArgument (arg), PassID (pi),
+ IsCFGOnlyPass (isCFGOnly), IsAnalysis (is_analysis),
+ IsAnalysisGroup (false), NormalCtor (normal)
+ {
+ }
+ };
+ template < typename PassName > Pass * callDefaultCtor ()
+ {
+ return new PassName ();
+ }
+ template < typename passName > struct RegisterPass:public PassInfo
+ {
+ RegisterPass (const char *PassArg, const char *Name, bool CFGOnly = false, bool is_analysis = false):PassInfo (Name, PassArg, intptr_t (&passName::ID),
+ PassInfo::NormalCtor_t (callDefaultCtor < passName >), CFGOnly,
+ is_analysis)
+ {
+ }
+ };
+ template < typename T > class SmallVectorImpl
+ {
+ };
+ template < typename T,
+ unsigned N > class SmallVector:public SmallVectorImpl < T >
+ {
+ };
+ class MachineFunctionPass:public FunctionPass
+ {
+ protected:explicit MachineFunctionPass (intptr_t ID):FunctionPass (ID)
+ {
+ }
+ explicit MachineFunctionPass (void *ID):FunctionPass (ID)
+ {
+ }
+ virtual bool runOnMachineFunction (MachineFunction & MF) = 0;
+ };
+ class LiveIndex
+ {
+ private:unsigned index;
+ };
+ class VNInfo
+ {
+ };
+ struct LiveRange
+ {
+ LiveIndex start;
+ LiveIndex end;
+ VNInfo *valno;
+ };
+ class LiveInterval
+ {
+ public:typedef SmallVector < LiveRange, 4 > Ranges;
+ bool containsOneValue () const
+ {
+ }
+ LiveRange *getLiveRangeContaining (LiveIndex Idx)
+ {
+ }
+ void removeRange (LiveIndex Start, LiveIndex End, bool RemoveDeadValNo =
+ false);
+ void removeRange (LiveRange LR, bool RemoveDeadValNo = false)
+ {
+ removeRange (LR.start, LR.end, RemoveDeadValNo);
+ }
+ };
+ class LiveIntervals:public MachineFunctionPass
+ {
+ public:static char ID;
+ LiveIndex getDefIndex (LiveIndex index)
+ {
+ }
+ LiveInterval & getInterval (unsigned reg)
+ {
+ }
+ LiveIndex getInstructionIndex (const MachineInstr * instr) const
+ {
+ }
+ };
+}
+
+using namespace llvm;
+namespace
+{
+struct __attribute__ ((visibility ("hidden"))) StrongPHIElimination:public
+ MachineFunctionPass
+ {
+ static char ID;
+ StrongPHIElimination ():MachineFunctionPass (&ID)
+ {
+ }
+ bool runOnMachineFunction (MachineFunction & Fn);
+ };
+}
+
+static RegisterPass < StrongPHIElimination > X ("strong-phi-node-elimination",
+ "Eliminate PHI nodes for register allocation, intelligently");
+bool
+StrongPHIElimination::runOnMachineFunction (MachineFunction & Fn)
+{
+ LiveIntervals & LI = getAnalysis < LiveIntervals > ();
+ std::vector < MachineInstr * >phis;
+ for (std::vector < MachineInstr * >::iterator I = phis.begin (), E =
+ phis.end (); I != E;)
+ {
+ MachineInstr *PInstr = *(I++);
+ unsigned DestReg = PInstr->getOperand (0).getReg ();
+ LiveInterval & PI = LI.getInterval (DestReg);
+ if (PInstr->registerDefIsDead (DestReg))
+ {
+ if (PI.containsOneValue ())
+ {
+ LiveIndex idx =
+ LI.getDefIndex (LI.getInstructionIndex (PInstr));
+ PI.removeRange (*PI.getLiveRangeContaining (idx), true);
+ }
+ }
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42110.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42110.C
new file mode 100644
index 000000000..c778b4f2f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42110.C
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+bool foo();
+
+struct A
+{
+ A* fooA() { if (foo()) foo(); return this; }
+
+ virtual void barA(char);
+};
+
+template<int> struct B
+{
+ A *p, *q;
+
+ void fooB(char c) { p->fooA()->barA(c); }
+};
+
+template<int N> inline void bar(B<N> b) { b.fooB(0); }
+
+extern template void bar(B<0>);
+
+void (*f)(B<0>) = bar;
+
+void baz()
+{
+ B<0>().fooB(0);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42183.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42183.C
new file mode 100644
index 000000000..375b37f0c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42183.C
@@ -0,0 +1,51 @@
+// { dg-do compile }
+
+class IntSize {
+public:
+ IntSize(int width, int height) : m_width(width), m_height(height) { }
+ int m_width, m_height;
+};
+class IntPoint {
+public:
+ IntPoint(int x, int y) : m_x(x), m_y(y) { }
+ int m_x, m_y;
+};
+class IntRect {
+public:
+ IntRect(int x, int y, int width, int height)
+ : m_location(IntPoint(x, y)), m_size(IntSize(width, height)) { }
+ void intersect(const IntRect&);
+ IntPoint m_location;
+ IntSize m_size;
+};
+inline IntRect intersection(const IntRect& a, const IntRect& b) {
+ IntRect c = a;
+ c.intersect(b);
+ return c;
+}
+class RenderObject {
+public:
+ int contentWidth() const { }
+ int contentHeight() const { }
+ virtual int xPos() const { }
+ virtual int yPos() const { }
+ virtual int paddingTop() const;
+ virtual int paddingLeft() const;
+ virtual int borderTop() const { }
+ virtual int borderLeft() const { }
+};
+class RenderMenuList : public RenderObject {
+ virtual IntRect controlClipRect(int tx, int ty) const;
+ RenderObject* m_innerBlock;
+};
+IntRect RenderMenuList::controlClipRect(int tx, int ty) const {
+ IntRect outerBox(tx + borderLeft() + paddingLeft(),
+ ty + borderTop() + paddingTop(),
+ contentWidth(), contentHeight());
+ IntRect innerBox(tx + m_innerBlock->xPos() + m_innerBlock->paddingLeft(),
+ ty + m_innerBlock->yPos() + m_innerBlock->paddingTop(),
+ m_innerBlock->contentWidth(),
+ m_innerBlock->contentHeight());
+ return intersection(outerBox, innerBox);
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42357.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42357.C
new file mode 100644
index 000000000..1a1d64e4f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42357.C
@@ -0,0 +1,30 @@
+// { dg-do compile }
+typedef unsigned char uint8;
+typedef unsigned int uint32;
+class PixelARGB {
+public:
+ ~PixelARGB() throw() { }
+ PixelARGB (const uint32 argb_) throw() : argb (argb_) { }
+ inline __attribute__((always_inline)) uint8 getRed() const throw() {
+ return components.r;
+ }
+ union {
+ uint32 argb;
+ struct {
+ uint8 b, g, r, a;
+ } components;
+ };
+};
+class Colour {
+public:
+ Colour() throw() : argb (0) {};
+ uint8 getRed() const throw() {
+ return argb.getRed();
+ }
+ PixelARGB argb;
+};
+uint8 writeImage (void) {
+ Colour pixel;
+ pixel = Colour ();
+ return pixel.getRed();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42450.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42450.C
new file mode 100644
index 000000000..f630fa2b7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42450.C
@@ -0,0 +1,112 @@
+/* { dg-do compile } */
+
+template < typename > class basic_stringstream;
+
+struct basic_string {
+ basic_string();
+};
+
+struct ios_base {
+ virtual ~ios_base();
+};
+
+class ostream:ios_base {};
+class istream:virtual ios_base {};
+
+template < typename > struct basic_iostream:public istream, ostream {
+ ~basic_iostream () {}
+};
+extern template class basic_iostream < char >;
+
+template < typename > struct basic_stringstream:public basic_iostream < char > {
+ basic_string _M_stringbuf;
+ ~basic_stringstream () {}
+};
+extern template class basic_stringstream < char >;
+
+template < typename > struct AnyMatrixBase;
+template < typename, int _Rows, int _Cols, int = _Rows, int = _Cols > class Matrix;
+template < typename > class CwiseNullaryOp;
+
+template < typename Derived > struct MatrixBase:public AnyMatrixBase < Derived > {
+ typedef CwiseNullaryOp < Derived > ConstantReturnType;
+ ConstantReturnType Constant ();
+ template < typename > Derived cast ();
+ static CwiseNullaryOp < Derived > Random (int);
+};
+
+template < typename Derived > struct AnyMatrixBase {
+ Derived derived () {}
+ Derived & derived () const {}
+};
+
+template < typename, int > struct ei_matrix_storage {};
+
+template < typename _Scalar, int, int, int _MaxRows, int _MaxCols > struct Matrix:MatrixBase < Matrix < _Scalar, _MaxRows, _MaxCols > > {
+ typedef MatrixBase < Matrix > Base;
+ ei_matrix_storage < int, _MaxCols > m_storage;
+ Matrix operator= (const Matrix other) {
+ _resize_to_match (other);
+ lazyAssign (other.derived ());
+ }
+ template < typename OtherDerived > Matrix lazyAssign (MatrixBase < OtherDerived > other) {
+ _resize_to_match (other);
+ return Base (other.derived ());
+ }
+ Matrix ();
+ template < typename OtherDerived > Matrix (const MatrixBase < OtherDerived > &other) {
+ *this = other;
+ }
+ template < typename OtherDerived > void _resize_to_match (const MatrixBase < OtherDerived > &) {
+ throw 1;
+ }
+};
+
+template < typename MatrixType > class CwiseNullaryOp:
+public MatrixBase < CwiseNullaryOp < MatrixType > > {};
+
+int f()
+{
+ bool align_cols;
+ if (align_cols) {
+ basic_stringstream<char> sstr;
+ f();
+ }
+}
+
+template < typename > struct AutoDiffScalar;
+template < typename Functor > struct AutoDiffJacobian:Functor {
+ AutoDiffJacobian (Functor);
+ typedef typename Functor::InputType InputType;
+ typedef typename Functor::ValueType ValueType;
+ typedef Matrix < int, Functor::InputsAtCompileTime, 1 > DerivativeType;
+ typedef AutoDiffScalar < DerivativeType > ActiveScalar;
+ typedef Matrix < ActiveScalar, Functor::InputsAtCompileTime, 1 > ActiveInput;
+ void operator () (InputType x, ValueType *) {
+ ActiveInput ax = x.template cast < ActiveScalar > ();
+ }
+};
+
+template < int NX, int NY > struct TestFunc1 {
+ enum {
+ InputsAtCompileTime = NX
+ };
+ typedef Matrix < float, NX, 1 > InputType;
+ typedef Matrix < float, NY, 1 > ValueType;
+ typedef Matrix < float, NY, NX > JacobianType;
+ int inputs ();
+};
+
+template < typename Func > void forward_jacobian (Func f) {
+ typename Func::InputType x = Func::InputType::Random (f.inputs ());
+ typename Func::ValueType y;
+ typename Func::JacobianType jref = jref.Constant ();
+ AutoDiffJacobian < Func > autoj (f);
+ autoj (x, &y);
+}
+
+void test_autodiff_scalar ()
+{
+ forward_jacobian (TestFunc1 < 2, 2 > ());
+ forward_jacobian (TestFunc1 < 3, 2 > ());
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42462.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42462.C
new file mode 100644
index 000000000..947fa388f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42462.C
@@ -0,0 +1,47 @@
+/* { dg-do run } */
+
+#define INLINE inline __attribute__((always_inline))
+extern "C" void abort (void);
+
+template<class> struct Foo {
+ inline bool isFalse() { return false; }
+ template <bool> void f1() {}
+ template <bool> INLINE void f2() { f1<false>(); }
+ template <bool> void f3() { f2<false>(); }
+ template <bool> INLINE void f4() { f3<false>(); }
+ int exec2();
+ void execute();
+ inline void unused();
+};
+
+template<class T> inline void Foo<T>::unused() {
+ f4<true>();
+}
+
+static int counter = 0;
+
+template<class T> int Foo<T>::exec2() {
+ static void* table[2] = { &&begin, &&end };
+ if (counter++ > 10)
+ return 0;
+ goto *(table[0]);
+begin:
+ if (isFalse()) f1<false>();
+end:
+ return 1;
+}
+
+template<class T> void Foo<T>::execute() {
+ int r = 1;
+ while (r) { r = exec2(); }
+}
+
+template class Foo<int>;
+
+int main() {
+ Foo<int> c;
+ c.execute();
+ if (counter < 10)
+ abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42704.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42704.C
new file mode 100644
index 000000000..735b1e7bd
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42704.C
@@ -0,0 +1,44 @@
+/* { dg-do compile } */
+
+typedef int PRInt32;
+class nsTreeRows {
+ class Subtree { };
+ enum { kMaxDepth = 32 };
+ struct Link {
+ Subtree* mParent;
+ PRInt32 mChildIndex;
+ Link& operator=(const Link& aLink) {
+ mParent = aLink.mParent;
+ mChildIndex = aLink.mChildIndex;
+ }
+ };
+ class iterator {
+ PRInt32 mTop;
+ PRInt32 mRowIndex;
+ Link mLink[kMaxDepth];
+ public:
+ iterator() : mTop(-1), mRowIndex(-1) { }
+ iterator& operator=(const iterator& aIterator);
+ };
+ Subtree* EnsureSubtreeFor(Subtree* aParent, PRInt32 aChildIndex);
+ Subtree* GetSubtreeFor(const Subtree* aParent,
+PRInt32 aChildIndex, PRInt32* aSubtreeSize = 0);
+ void InvalidateCachedRow() {
+ mLastRow = iterator();
+ }
+ iterator mLastRow;
+};
+nsTreeRows::Subtree* nsTreeRows::EnsureSubtreeFor(Subtree* aParent,
+ PRInt32 aChildIndex) {
+ Subtree* subtree = GetSubtreeFor(aParent, aChildIndex);
+ if (! subtree) {
+ InvalidateCachedRow();
+ }
+}
+nsTreeRows::iterator& nsTreeRows::iterator::operator=(const iterator&
+aIterator) {
+ mTop = aIterator.mTop;
+ for (PRInt32 i = mTop;
+ i >= 0;
+ --i) mLink[i] = aIterator.mLink[i];
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42714.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42714.C
new file mode 100644
index 000000000..b1b2d856e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42714.C
@@ -0,0 +1,37 @@
+struct QVectorData {
+ static QVectorData shared_null;
+};
+template <typename T> class QVector {
+ union {
+ QVectorData *d;
+ };
+public:
+ inline QVector() : d(&QVectorData::shared_null) { }
+ inline QVector(const QVector<T> &v) : d(v.d) { }
+};
+class QXmlStreamAttribute { };
+class QXmlStreamAttributes : public QVector<QXmlStreamAttribute> { };
+class __attribute__ ((visibility("default"))) Smoke {
+public:
+ union StackItem;
+ typedef StackItem* Stack;
+ typedef short Index;
+};
+class SmokeBinding { };
+namespace __smokeqt {
+ class x_QXmlStreamAttributes : public QXmlStreamAttributes {
+ SmokeBinding* _binding;
+ public:
+ static void x_11(Smoke::Stack x) {
+ x_QXmlStreamAttributes* xret = new x_QXmlStreamAttributes();
+ }
+ explicit x_QXmlStreamAttributes() : QXmlStreamAttributes() { }
+ };
+ void xcall_QXmlStreamAttributes(Smoke::Index xi, void *obj,
+ Smoke::Stack args)
+ {
+ switch(xi) {
+ case 11: x_QXmlStreamAttributes::x_11(args);
+ }
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42739.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42739.C
new file mode 100644
index 000000000..ccc05f836
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42739.C
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+struct s { ~s() { s(); } };
+
+int f()
+{
+ M:
+ s o = s();
+ f();
+ f();
+
+ L:
+ goto *(f() ? &&L : &&M);
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42760.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42760.C
new file mode 100644
index 000000000..be85f7fc4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42760.C
@@ -0,0 +1,46 @@
+// PR middle-end/42760
+// { dg-do compile }
+
+template <typename T>
+struct A
+{
+ static T b (T it) { return it; }
+};
+
+template <typename T, typename U>
+static U
+baz (T x, T y, U z)
+{
+ for (long n = y - x; n > 0; --n)
+ {
+ *z = *x;
+ ++z;
+ }
+};
+
+template <typename T, typename U>
+U
+bar (T x, T y, U z)
+{
+ baz (A <T>::b (x), A <T>::b (y), A <U>::b (z));
+}
+
+struct C
+{
+ __complex__ float v;
+};
+
+template <class T>
+struct B
+{
+ B (T y[]) { bar (y, y + 1, x); }
+ operator T *() { return x; }
+ T x[1];
+};
+
+B <C>
+foo ()
+{
+ C y[1];
+ return B <C> (y);
+};
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42773.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42773.C
new file mode 100644
index 000000000..478ad278a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42773.C
@@ -0,0 +1,54 @@
+// { dg-do compile }
+// { dg-options "-fno-exceptions" }
+
+typedef unsigned int uint;
+struct QShared {
+ bool deref() {
+ return !--count;
+ }
+ uint count;
+};
+template <class T> class QValueListNode {
+public:
+ QValueListNode<T>* next;
+ QValueListNode<T>* prev;
+};
+template <class T> class QValueListPrivate : public QShared {
+public:
+ typedef QValueListNode<T> Node;
+ typedef QValueListNode<T>* NodePtr;
+ QValueListPrivate();
+ void derefAndDelete() {
+ if ( deref() ) delete this;
+ }
+ ~QValueListPrivate();
+ NodePtr node;
+};
+template <class T> QValueListPrivate<T>::QValueListPrivate() {
+ node = new Node;
+ node->next = node->prev = node;
+}
+template <class T> QValueListPrivate<T>::~QValueListPrivate() {
+ NodePtr p = node->next;
+ while( p != node ) {
+ NodePtr x = p->next;
+ delete p;
+ p = x;
+ }
+}
+template <class T> class QValueList {
+public:
+ QValueList() {
+ sh = new QValueListPrivate<T>;
+ }
+ ~QValueList() {
+ sh->derefAndDelete();
+ }
+ QValueListPrivate<T>* sh;
+};
+class Cell {
+ QValueList<Cell*> obscuringCells() const;
+};
+QValueList<Cell*> Cell::obscuringCells() const {
+ QValueList<Cell*> empty;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42871.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42871.C
new file mode 100644
index 000000000..452ad9319
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42871.C
@@ -0,0 +1,40 @@
+struct C
+{
+ ~C ();
+ int c3;
+};
+
+C *b2;
+
+static void
+b1 (const C &x, unsigned b3, unsigned b4)
+{
+ unsigned i = 0;
+ for (; i < b3; i++)
+ if (i < b4)
+ {
+ b2[0].c3 = x.c3;
+ return;
+ }
+}
+
+int a ();
+
+void
+bar (unsigned b3, unsigned b4)
+{
+ C c[100];
+ for (int i = 0; i < 100; i++)
+ {
+ c[i].c3 = i;
+ for (int j = 0; j < b3; j++)
+ if (j < b4)
+ {
+ b2[0].c3 = 0;
+ break;
+ }
+ b1 (c[i], b3, b4);
+ a ();
+ }
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42883.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42883.C
new file mode 100644
index 000000000..f164c3781
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42883.C
@@ -0,0 +1,63 @@
+// { dg-do compile }
+
+typedef __SIZE_TYPE__ size_t;
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Tp> class new_allocator {
+ public:
+ typedef size_t size_type;
+ typedef _Tp* pointer;
+ typedef _Tp& reference;
+ void deallocate(pointer __p, size_type) {
+ ::operator delete(__p);
+ }
+ };
+}
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Tp> class allocator: public __gnu_cxx::new_allocator<_Tp> {
+ public:
+ template<typename _Tp1> struct rebind {
+ typedef allocator<_Tp1> other;
+ };
+ };
+ template<typename _Tp, typename _Alloc> struct _Vector_base {
+ typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;
+ struct _Vector_impl : public _Tp_alloc_type {
+ typename _Tp_alloc_type::pointer _M_start;
+ typename _Tp_alloc_type::pointer _M_end_of_storage;
+ };
+ ~_Vector_base() {
+ _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage - this->_M_impl._M_start);
+ }
+ _Vector_impl _M_impl;
+ void _M_deallocate(typename _Tp_alloc_type::pointer __p, size_t __n) {
+ if (__p) _M_impl.deallocate(__p, __n);
+ }
+ };
+ template<typename _Tp, typename _Alloc = std::allocator<_Tp> > class vector : protected _Vector_base<_Tp, _Alloc> {
+ typedef _Vector_base<_Tp, _Alloc> _Base;
+ typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
+ public:
+ typedef typename _Tp_alloc_type::reference reference;
+ typedef size_t size_type;
+ size_type size() const {
+ }
+ reference operator[](size_type __n) {
+ }
+ };
+};
+class vtkConvexPointSet {
+public:
+ static vtkConvexPointSet *New();
+};
+void MakeInternalMesh() {
+ std::vector< int > tempFaces[2];
+ std::vector< int > firstFace;
+ int i, j, k;
+ for(i = 0; i < 1000; i++) {
+ for(int pointCount = 0; pointCount < 1000; pointCount++) {
+ for(j = 0; j < (int)tempFaces[0].size(); k++)
+ if(tempFaces[0][j] == tempFaces[1][k]) break;
+ }
+ vtkConvexPointSet::New();
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42890.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42890.C
new file mode 100644
index 000000000..937367665
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr42890.C
@@ -0,0 +1,25 @@
+// PR tree-optimization/42890
+// { dg-do compile }
+
+extern "C" int puts (const char *) throw ();
+
+struct S
+{
+ const char *a;
+ const char **b;
+ S (const char *s) { a = s; b = &a; }
+ ~S () { puts (a); }
+};
+
+void
+foo (int (*fn) (const char *))
+{
+ S a ("foo");
+ fn ("bar");
+}
+
+int
+main ()
+{
+ foo (puts);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43068.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43068.C
new file mode 100644
index 000000000..524fd23ee
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43068.C
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-freorder-blocks -ftracer} */
+
+struct A {
+ virtual A *f();
+};
+struct B : virtual A {
+ virtual B *f();
+};
+B *B::f() { return 0; }
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43257.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43257.C
new file mode 100644
index 000000000..a3e75574a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43257.C
@@ -0,0 +1,30 @@
+/* { dg-do assemble } */
+
+class A {};
+class B {};
+
+static void *func (int n)
+{
+ void *p;
+ if (p == 0) throw ::A ();
+}
+
+static void *func (int n, B const &)
+{
+ try {
+ return func (n);
+ }
+ catch (::A const &) {
+ }
+ return func (n);
+}
+
+void *f1 (int n)
+{
+ return func (n, B());
+}
+
+void *f2 (int n)
+{
+ return func (n, B());
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43611.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43611.C
new file mode 100644
index 000000000..6899a6ea4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43611.C
@@ -0,0 +1,22 @@
+// { dg-do compile }
+// { dg-options "-fkeep-inline-functions" }
+
+template < typename >
+struct A {
+ void init (int);
+ A ()
+ {
+ this->init (0);
+ }
+};
+
+template < typename >
+struct B : A < int > {
+ A < int > a;
+ B () {}
+};
+
+extern template struct A < int >;
+extern template struct B < int >;
+
+B < int > b;
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43784.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43784.C
new file mode 100644
index 000000000..a83a6f374
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43784.C
@@ -0,0 +1,24 @@
+/* { dg-do run } */
+/* { dg-options "-fno-tree-sra" } */
+
+struct S {int x, y, makemelarge[5];};
+S __attribute__((noinline)) f (S &s) {
+ S r;
+ r.x = s.y;
+ r.y = s.x;
+ return r;
+}
+int __attribute__((noinline)) glob (int a, int b)
+{
+ S local = { a, b };
+ local = f (local);
+ return local.y;
+}
+extern "C" void abort (void);
+int main (void)
+{
+ if (glob (1, 3) != 1)
+ abort ();
+ return 0;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43801.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43801.C
new file mode 100644
index 000000000..3b52d4abc
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43801.C
@@ -0,0 +1,22 @@
+// PR tree-optimization/43801
+// { dg-do compile }
+// { dg-options "-fipa-cp -fipa-cp-clone" }
+
+struct A
+{
+ virtual void f (int);
+};
+struct B : virtual A
+{
+ virtual void f (int i) { if (i) A::f(0); }
+};
+struct C : virtual B
+{
+ virtual void f (int) { B::f(0); }
+};
+
+void
+foo ()
+{
+ C ();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43879-1_0.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43879-1_0.C
new file mode 100644
index 000000000..710f6adfe
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43879-1_0.C
@@ -0,0 +1,11 @@
+struct A {
+ int *i;
+ A();
+ ~A();
+};
+
+static int x = 0;
+
+A::A() : i(&x) {}
+A::~A() {}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43879-1_1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43879-1_1.C
new file mode 100644
index 000000000..0c943381f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43879-1_1.C
@@ -0,0 +1,48 @@
+/* { dg-do run } */
+/* { dg-options "-fipa-pta" } */
+/* { dg-additional-sources "pr43879-1_0.C" } */
+
+struct A {
+ int *i;
+ A();
+ ~A();
+};
+
+static inline int
+aa(int *a, int *b)
+{
+ (void)b;
+ return *a;
+}
+
+struct B {
+ B() : i(0) {}
+ int i;
+ B(const A &a) : i(0)
+ {
+ f(*a.i);
+ }
+ void __attribute__((noinline, noclone))
+ f(int j)
+ {
+ aa(&i, &j);
+ i = 1;
+ }
+};
+
+int
+test()
+{
+ B b1;
+ B b2 = B(A());
+ b1 = B(A());
+ if (b1.i != b2.i) __builtin_abort();
+ return 0;
+}
+
+int
+main()
+{
+ return test();
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43880.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43880.C
new file mode 100644
index 000000000..bf82bc54b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43880.C
@@ -0,0 +1,16 @@
+// { dg-do compile }
+
+extern void xread(void *);
+class test
+{
+public:
+ test(void);
+};
+test::test(void)
+{
+ union {
+ char pngpal[1];
+ };
+ xread(pngpal);
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43905.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43905.C
new file mode 100644
index 000000000..0e49a32a1
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr43905.C
@@ -0,0 +1,13 @@
+extern void sf ( __const char *);
+struct Matrix{
+ int operator[](int n){
+ sf ( __PRETTY_FUNCTION__);
+ }
+ int operator[](int n)const{
+ sf ( __PRETTY_FUNCTION__);
+ }
+};
+void calcmy(Matrix const &b, Matrix &c, int k){
+ b[k];
+ c[k];
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44069.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44069.C
new file mode 100644
index 000000000..99fcd173e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44069.C
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+
+template <unsigned R, unsigned C>
+class M {
+public:
+ M(const int* arr) {
+ for (unsigned long r = 0; r < R; ++r)
+ for (unsigned long c = 0; c < C; ++c)
+ m[r*C+c] = arr[r*C+c];
+ }
+ int operator()(unsigned r, unsigned c) const
+ { return m[r*C+c]; }
+private:
+ int m[R*C];
+};
+extern "C" void abort (void);
+int main()
+{
+ int vals[2][2] = { { 1, 2 }, { 5, 6 } };
+ M<2,2> m( &(vals[0][0]) );
+ if (m(1,0) != 5)
+ abort ();
+ return 0;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44148.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44148.C
new file mode 100644
index 000000000..a60ba9aa3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44148.C
@@ -0,0 +1,60 @@
+// PR c++/44148
+// { dg-do compile }
+// { dg-options "" }
+// { dg-options "-fpic" { target fpic } }
+
+template <typename T> struct S2
+{
+ typedef const T &t2;
+ t2 operator* () const {}
+};
+template <typename T> struct S3
+{
+ typedef S2 <T> t5;
+};
+template <typename T1, typename T2> T2 foo1 (T1 x, T2 y) { y (*x); }
+template <class T> struct S4
+{
+ T &operator* () const;
+};
+struct S7 {};
+struct S8
+{
+ typedef::S3 <S4 <S7> >::t5 t6;
+ t6 m1 () const;
+};
+template <class T> struct S9
+{
+ typedef T t3;
+ inline t3 &operator[] (unsigned int) {}
+};
+template <typename T1, typename T2, typename T3, void (&T4) (const T1 &, T3 &)> struct S10
+{
+ S10 (T2 &x, unsigned int y = 0) : u (x), v (y) {}
+ void operator () (const S4 <T1> &x) { T4 (*x, u[v++]); }
+ T2 &u;
+ unsigned int v;
+};
+struct S15;
+struct S11
+{
+ static void m3 (const S8 &, S15 &);
+};
+struct S16;
+struct S12;
+struct S13
+{
+ static void m4 (const S7 &,S16 &);
+};
+typedef S10 <S7, S12, S16, S13::m4> t10;
+struct S12: S9 <S16>
+{
+};
+struct S15
+{
+ S12 p;
+};
+void S11::m3 (const S8 &x, S15 &y)
+{
+ foo1 (x.m1 (), t10 (y.p));
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44206.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44206.C
new file mode 100644
index 000000000..a1dedb450
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44206.C
@@ -0,0 +1,21 @@
+// { dg-do compile }
+
+template<int> struct A
+{
+ void foo(void(*)(A));
+ void bar(void(*f)(A)) { foo(f); foo(f); }
+};
+
+template<int N> inline void FOO(A<N> a)
+{
+ a.foo(0);
+}
+
+extern template void FOO(A<0>);
+
+void BAR()
+{
+ A<0> a;
+ FOO(a);
+ a.bar(FOO);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44295.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44295.C
new file mode 100644
index 000000000..8169bb0a8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44295.C
@@ -0,0 +1,170 @@
+/* { dg-do compile } */
+extern "C" {
+ typedef __SIZE_TYPE__ size_t;
+ typedef struct {
+ } __sigset_t;
+ typedef union {
+ } pthread_barrierattr_t;
+ }
+ typedef unsigned short XMLCh;
+ typedef unsigned long XMLSize_t;
+ namespace xercesc_2_5 {
+ class DOMNodeList;
+ class DOMNode {
+ };
+ class DOMDocumentRange {
+ };
+ class DOMDocument: public DOMDocumentRange, public DOMNode {
+ };
+ union wait {
+ struct {
+ }
+ __wait_stopped;
+ }
+ div_t;
+ class MemoryManager;
+ class XMemory {
+ public : void* operator new(size_t size, MemoryManager* memMgr);
+ void operator delete(void* p);
+ void operator delete(void* p, MemoryManager* memMgr);
+ };
+ class XMLExcepts {
+ public : enum Codes {
+ NoError = 0 , HshTbl_ZeroModulus = 48 , HshTbl_BadHashFromKey = 49 };
+ };
+ class XMLUni {
+ };
+ }
+ namespace xercesc_2_5 {
+ class XMLException : public XMemory {
+ public:
+ virtual ~XMLException();
+ XMLException(const char* const srcFile, const unsigned int srcLine, MemoryManager* const memoryManager = 0);
+ void loadExceptText ( const XMLExcepts::Codes toLoad );
+ };
+ class XMLDeleter {
+ };
+ class XMLPlatformUtils {
+ public : static MemoryManager* fgMemoryManager;
+ static inline size_t alignPointerForNewBlockAllocation(size_t ptrSize);
+ };
+ inline size_t XMLPlatformUtils::alignPointerForNewBlockAllocation(size_t ptrSize) {
+ }
+ class HashBase : public XMemory {
+ public:
+ virtual bool equals(const void *const key1, const void *const key2) = 0;
+ virtual ~HashBase() {
+};
+ };
+ class IllegalArgumentException : public XMLException {
+ public:
+IllegalArgumentException(const char* const srcFile , const unsigned int srcLine , const XMLExcepts::Codes toThrow , MemoryManager* memoryManager = 0) : XMLException(srcFile, srcLine, memoryManager) {
+ loadExceptText(toThrow);
+ }
+ };
+ class RuntimeException : public XMLException {
+ public:
+RuntimeException(const char* const srcFile , const unsigned int srcLine , const XMLExcepts::Codes toThrow , MemoryManager* memoryManager = 0) : XMLException(srcFile, srcLine, memoryManager) {
+ loadExceptText(toThrow);
+ }
+ };
+ class MemoryManager {
+ public:
+ virtual ~MemoryManager() {
+ }
+ virtual void* allocate(size_t size) = 0;
+ };
+ template <class TElem> class BaseRefVectorOf : public XMemory {
+ BaseRefVectorOf ( const unsigned int maxElems , const bool adoptElems = true , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager );
+ virtual ~BaseRefVectorOf();
+ bool fAdoptedElems;
+ TElem** fElemList;
+ };
+ template <class TElem> BaseRefVectorOf<TElem>::BaseRefVectorOf( const unsigned int maxElems , const bool adoptElems , MemoryManager* const manager) : fAdoptedElems(adoptElems) {
+ for (unsigned int index = 0;
+ index < maxElems;
+ index++) fElemList[index] = 0;
+ }
+ template <class TElem> BaseRefVectorOf<TElem>::~BaseRefVectorOf() {
+ }
+ class XMLString {
+ public:
+ static bool equals ( const XMLCh* const str1 , const XMLCh* const str2 );
+ static void moveChars ( XMLCh* const targetStr , const XMLCh* const srcStr , const unsigned int count );
+ };
+ inline void XMLString::moveChars( XMLCh* const targetStr , const XMLCh* const srcStr , const unsigned int count) {
+ }
+ inline bool XMLString::equals( const XMLCh* const str1 , const XMLCh* const str2) {
+ const XMLCh* psz1 = str1;
+ const XMLCh* psz2 = str2;
+ if (psz1 == 0 || psz2 == 0) {
+ return true;
+ }
+ }
+ }
+ namespace xercesc_2_5 {
+ class HashPtr : public HashBase {
+ virtual bool equals(const void *const key1, const void *const key2);
+ };
+ template <class TVal> struct DOMDeepNodeListPoolTableBucketElem : public XMemory {
+ void* fKey1;
+ XMLCh* fKey2;
+ XMLCh* fKey3;
+ };
+ template <class TVal> class DOMDeepNodeListPool {
+ public:
+ DOMDeepNodeListPool ( const XMLSize_t modulus , const bool adoptElems , const XMLSize_t initSize = 128 );
+ TVal* getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3);
+ DOMDeepNodeListPoolTableBucketElem<TVal>* findBucketElem(const void* const key1, const XMLCh* const key2, const XMLCh* const key3, XMLSize_t& hashVal);
+ bool fAdoptedElems;
+ DOMDeepNodeListPoolTableBucketElem<TVal>** fBucketList;
+ XMLSize_t fHashModulus;
+ HashBase* fHash;
+ TVal** fIdPtrs;
+ XMLSize_t fIdPtrsCount;
+ MemoryManager* fMemoryManager;
+ };
+ template <class TVal> DOMDeepNodeListPool<TVal>::DOMDeepNodeListPool( const XMLSize_t modulus , const bool adoptElems , const XMLSize_t initSize) : fAdoptedElems(adoptElems) , fBucketList(0) , fHash(0) , fIdPtrs(0) {
+ fHash = new (fMemoryManager) HashPtr();
+ fIdPtrs = (TVal**) fMemoryManager->allocate(fIdPtrsCount * sizeof(TVal*));
+ if (modulus == 0) throw IllegalArgumentException("./xercesc/dom/impl/bad.c", 38, XMLExcepts::HshTbl_ZeroModulus, fMemoryManager);
+ }
+ template <class TVal> TVal* DOMDeepNodeListPool<TVal>::getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3) {
+ XMLSize_t hashVal;
+ DOMDeepNodeListPoolTableBucketElem<TVal>* findIt = findBucketElem(key1, key2, key3, hashVal);
+ }
+ template <class TVal> DOMDeepNodeListPoolTableBucketElem<TVal>* DOMDeepNodeListPool<TVal>:: findBucketElem(const void* const key1, const XMLCh* const key2, const XMLCh* const key3, XMLSize_t& hashVal) {
+ if (hashVal > fHashModulus) throw RuntimeException("./xercesc/dom/impl/bad.c", 64, XMLExcepts::HshTbl_BadHashFromKey, fMemoryManager);
+ DOMDeepNodeListPoolTableBucketElem<TVal>* curElem = fBucketList[hashVal];
+ if (fHash->equals(key1, curElem->fKey1) && (XMLString::equals(key2, curElem->fKey2)) && (XMLString::equals(key3, curElem->fKey3))) {
+ return curElem;
+ }
+ }
+ class DOMDeepNodeListImpl;
+ class DOMDocumentImpl: public DOMDocument {
+ DOMNodeList* getElementsByTagName(const XMLCh * tagname) const;
+ DOMNodeList* getDeepNodeList(const DOMNode *rootNode, const XMLCh *tagName);
+ DOMNodeList* getDeepNodeList(const DOMNode *rootNode, const XMLCh *namespaceURI, const XMLCh *localName);
+ DOMDeepNodeListPool<DOMDeepNodeListImpl>* fNodeListPool;
+ };
+ }
+ void * operator new(size_t amt, xercesc_2_5:: DOMDocument *doc);
+ namespace xercesc_2_5 {
+ class DOMNodeList {
+ };
+ class DOMDeepNodeListImpl: public DOMNodeList {
+ };
+ DOMNodeList *DOMDocumentImpl::getElementsByTagName(const XMLCh *tagname) const {
+ return ((DOMDocumentImpl*)this)->getDeepNodeList(this,tagname);
+ }
+ DOMNodeList *DOMDocumentImpl::getDeepNodeList(const DOMNode *rootNode, const XMLCh *tagName) {
+ if(!fNodeListPool) {
+ fNodeListPool = new (this) DOMDeepNodeListPool<DOMDeepNodeListImpl>(109, false);
+ }
+ DOMNodeList* retList = fNodeListPool->getByKey(rootNode, tagName, 0);
+ }
+ DOMNodeList *DOMDocumentImpl::getDeepNodeList(const DOMNode *rootNode, const XMLCh *namespaceURI, const XMLCh *localName) {
+ DOMNodeList* retList = fNodeListPool->getByKey(rootNode, localName, namespaceURI);
+ }
+ }
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44357.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44357.C
new file mode 100644
index 000000000..3380350e8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44357.C
@@ -0,0 +1,228 @@
+/* { dg-do compile } */
+extern "C"
+{
+ typedef long unsigned int size_t;
+}
+namespace llvm
+{
+ namespace dont_use
+ {
+ template < typename T > double is_class_helper (...);
+ }
+ template < typename T > struct is_class
+ {
+ public:enum
+ { value = sizeof (char) == sizeof (dont_use::is_class_helper < T > (0)) };
+ };
+ template < typename T > struct isPodLike
+ {
+ static const bool value = !is_class < T >::value;
+ };
+}
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ template < typename _Iterator > struct iterator_traits
+ {
+ };
+ template < typename _Tp > struct iterator_traits <_Tp * >
+ {
+ typedef _Tp value_type;
+ };
+}
+
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default")))
+{
+ template < typename _Tp > class new_allocator
+ {
+ public:typedef size_t size_type;
+ typedef const _Tp & const_reference;
+ };
+}
+
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+template < typename _Tp > class allocator:public __gnu_cxx::new_allocator <
+ _Tp >
+ {
+ public:typedef size_t size_type;
+ template < typename _Tp1 > struct rebind
+ {
+ typedef allocator < _Tp1 > other;
+ };
+ };
+ template < typename _Tp, typename _Alloc > struct _Vector_base
+ {
+ typedef typename _Alloc::template rebind < _Tp >::other _Tp_alloc_type;
+ };
+template < typename _Tp, typename _Alloc = std::allocator < _Tp > >class vector:protected _Vector_base < _Tp,
+ _Alloc
+ >
+ {
+ typedef _Vector_base < _Tp, _Alloc > _Base;
+ typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
+ public:typedef _Tp value_type;
+ typedef typename _Tp_alloc_type::const_reference const_reference;
+ typedef size_t size_type;
+ size_type size () const
+ {
+ } const_reference operator[] (size_type __n) const
+ {
+ }};
+}
+
+namespace llvm
+{
+ struct LandingPadInfo;
+ class DwarfException
+ {
+ static bool PadLT (const LandingPadInfo * L, const LandingPadInfo * R);
+ struct CallSiteEntry
+ {
+ };
+ void EmitExceptionTable ();
+ };
+}
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ template < typename _RandomAccessIterator,
+ typename _Compare >
+ void __unguarded_linear_insert (_RandomAccessIterator __last,
+ _Compare __comp)
+ {
+ typename iterator_traits < _RandomAccessIterator >::value_type __val =
+ (*__last);
+ _RandomAccessIterator __next = __last;
+ while (__comp (__val, *__next))
+ {
+ }
+ }
+ template < typename _RandomAccessIterator,
+ typename _Compare > void __insertion_sort (_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Compare __comp)
+ {
+ for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i)
+ {
+ if (__comp (*__i, *__first))
+ {
+ }
+ else
+ std::__unguarded_linear_insert (__i, __comp);
+ }
+ }
+ enum
+ { _S_threshold = 16 };
+ template < typename _RandomAccessIterator,
+ typename _Compare >
+ void __final_insertion_sort (_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Compare __comp)
+ {
+ if (__last - __first > int (_S_threshold))
+ {
+ std::__insertion_sort (__first, __first + int (_S_threshold), __comp);
+ }
+ }
+ template < typename _RandomAccessIterator,
+ typename _Compare > inline void sort (_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Compare __comp)
+ {
+ if (__first != __last)
+ {
+ std::__final_insertion_sort (__first, __last, __comp);
+ }
+ }
+}
+
+namespace llvm
+{
+ class SmallVectorBase
+ {
+ protected:void *BeginX, *EndX, *CapacityX;
+ struct U
+ {
+ } FirstEl;
+ protected: SmallVectorBase (size_t Size):BeginX (&FirstEl), EndX (&FirstEl),
+ CapacityX ((char *) &FirstEl + Size)
+ {
+ }};
+template < typename T > class SmallVectorTemplateCommon:public
+ SmallVectorBase
+ {
+ public: SmallVectorTemplateCommon (size_t Size):SmallVectorBase (Size)
+ {
+ } typedef size_t size_type;
+ typedef T *iterator;
+ iterator begin ()
+ {
+ } iterator end ()
+ {
+ } size_type size () const
+ {
+ }};
+template < typename T, bool isPodLike > class SmallVectorTemplateBase:public SmallVectorTemplateCommon <
+ T >
+ {
+ public: SmallVectorTemplateBase (size_t Size):SmallVectorTemplateCommon < T >
+ (Size)
+ {
+ }};
+template < typename T > class SmallVectorImpl:public SmallVectorTemplateBase < T,
+ isPodLike < T >::value >
+ {
+ typedef SmallVectorTemplateBase < T, isPodLike < T >::value > SuperClass;
+ public:typedef typename SuperClass::iterator iterator;
+ explicit SmallVectorImpl (unsigned N):SmallVectorTemplateBase < T,
+ isPodLike < T >::value > (N * sizeof (T))
+ {
+ }
+ };
+ template < typename T,
+ unsigned N > class SmallVector:public SmallVectorImpl < T >
+ {
+ typedef typename SmallVectorImpl < T >::U U;
+ enum
+ { MinUs =
+ (static_cast < unsigned int >(sizeof (T)) * N + static_cast <
+ unsigned int >(sizeof (U)) - 1) /static_cast <
+ unsigned int >(sizeof (U)), NumInlineEltsElts =
+ MinUs > 1 ? (MinUs - 1) : 1, NumTsAvailable =
+ (NumInlineEltsElts + 1) * static_cast <
+ unsigned int >(sizeof (U)) / static_cast <
+ unsigned int >(sizeof (T)) };
+ public: SmallVector ():SmallVectorImpl < T > (NumTsAvailable)
+ {
+ }
+ };
+ struct LandingPadInfo
+ {
+ std::vector < int >TypeIds;
+ union
+ {
+ } Contents;
+ };
+}
+
+using namespace llvm;
+bool
+DwarfException::PadLT (const LandingPadInfo * L, const LandingPadInfo * R)
+{
+ const std::vector < int >&LIds = L->TypeIds, &RIds = R->TypeIds;
+ unsigned LSize = LIds.size (), RSize = RIds.size ();
+ unsigned MinSize = LSize < RSize ? LSize : RSize;
+ for (unsigned i = 0; i != MinSize; ++i)
+ if (LIds[i] != RIds[i])
+ return LIds[i] < RIds[i];
+}
+
+void
+DwarfException::EmitExceptionTable ()
+{
+ SmallVector < const LandingPadInfo *, 64 > LandingPads;
+ std::sort (LandingPads.begin (), LandingPads.end (), PadLT);
+ SmallVector < CallSiteEntry, 64 > CallSites;
+ for (unsigned i = 0, e = CallSites.size (); i < e; ++i)
+ {
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44492.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44492.C
new file mode 100644
index 000000000..41669241e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44492.C
@@ -0,0 +1,31 @@
+// PR middle-end/44492
+// { dg-do run }
+
+struct T { unsigned long p; };
+struct S { T a, b, c; unsigned d; };
+
+__attribute__((noinline))
+void
+bar (const T &x, const T &y)
+{
+ if (x.p != 0x2348 || y.p != 0x2346)
+ __builtin_abort ();
+}
+
+__attribute__((noinline))
+void
+foo (S &s, T e)
+{
+ unsigned long a = e.p;
+ unsigned long b = s.b.p;
+ __asm__ volatile ("" : : "rm" (a), "rm" (b));
+ bar (e, s.b);
+}
+
+int
+main ()
+{
+ S s = { { 0x2345 }, { 0x2346 }, { 0x2347 }, 6 };
+ T t = { 0x2348 };
+ foo (s, t);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44535.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44535.C
new file mode 100644
index 000000000..9126f3997
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44535.C
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+
+namespace FOO {
+
+template <typename T>
+class A
+{
+public:
+ void Enum();
+ virtual void OnProv() = 0;
+ virtual ~A() { }
+};
+typedef A<char> B;
+
+template<typename T>
+void A<T>::Enum ()
+{
+ OnProv ();
+}
+} // namespace FOO
+
+class C {};
+
+class D: public C, public FOO::B {
+public:
+ void OnProv() {}
+};
+
+int main(int argc, char *argv[])
+{
+ D x;
+ x.Enum();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44809.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44809.C
new file mode 100644
index 000000000..b6615f23f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44809.C
@@ -0,0 +1,6 @@
+// { dg-do compile }
+unsigned int mEvictionRank[(1 << 5)];
+void Unswap(int i)
+{
+ mEvictionRank[i] = ({ unsigned int __v = i; __v; });
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44813.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44813.C
new file mode 100644
index 000000000..1dc01b06a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44813.C
@@ -0,0 +1,60 @@
+typedef unsigned int PRUint32;
+typedef int PRInt32;
+typedef unsigned long PRUint64;
+typedef int PRIntn;
+typedef PRIntn PRBool;
+struct nsRect {
+ nsRect(const nsRect& aRect) { }
+};
+enum nsCompatibility { eCompatibility_NavQuirks = 3 };
+class gfxContext;
+typedef PRUint64 nsFrameState;
+class nsPresContext {
+public:
+ nsCompatibility CompatibilityMode() const { }
+};
+class nsStyleContext {
+public:
+ PRBool HasTextDecorations() const;
+};
+class nsIFrame {
+public:
+ nsPresContext* PresContext() const;
+ nsStyleContext* GetStyleContext() const;
+ nsFrameState GetStateBits() const;
+ nsRect GetOverflowRect() const;
+};
+class nsFrame : public nsIFrame { };
+class nsLineList_iterator { };
+class nsLineList {
+public:
+ typedef nsLineList_iterator iterator;
+};
+class gfxSkipCharsIterator { };
+class gfxTextRun {
+public:
+ class PropertyProvider { };
+};
+class nsTextFrame : public nsFrame
+{
+ virtual nsRect ComputeTightBounds(gfxContext* aContext) const;
+ gfxSkipCharsIterator EnsureTextRun(gfxContext* aReferenceContext = 0L,
+ nsIFrame* aLineContainer = 0L,
+ const nsLineList::iterator* aLine = 0L,
+ PRUint32* aFlowEndInTextRun = 0L);
+};
+class PropertyProvider : public gfxTextRun::PropertyProvider
+{
+public:
+ PropertyProvider(nsTextFrame* aFrame, const gfxSkipCharsIterator& aStart);
+ PRInt32 mLength[64];
+};
+nsRect nsTextFrame::ComputeTightBounds(gfxContext* aContext) const
+{
+ if ((GetStyleContext()->HasTextDecorations()
+ && eCompatibility_NavQuirks == PresContext()->CompatibilityMode())
+ || (GetStateBits() & (nsFrameState(1) << (23))))
+ return GetOverflowRect();
+ gfxSkipCharsIterator iter = const_cast<nsTextFrame*>(this)->EnsureTextRun();
+ PropertyProvider provider(const_cast<nsTextFrame*>(this), iter);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44826.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44826.C
new file mode 100644
index 000000000..aece14070
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44826.C
@@ -0,0 +1,44 @@
+typedef unsigned short PRUint16;
+typedef PRUint16 PRUnichar;
+template <class CharT> struct nsCharTraits {
+};
+class nsAString_internal {
+public:
+ typedef PRUnichar char_type;
+};
+class nsString : public nsAString_internal {
+public:
+ typedef nsString self_type;
+ nsString( const self_type& str );
+};
+class nsDependentString : public nsString {
+public:
+ explicit nsDependentString( const char_type* data );
+};
+typedef struct sqlite3_stmt sqlite3_stmt;
+const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
+class nsIVariant { };
+template <typename DataType> struct variant_storage_traits {
+ typedef DataType ConstructorType;
+ typedef DataType StorageType;
+ static inline StorageType storage_conversion(ConstructorType aData) {
+ return aData;
+ }
+};
+template <typename DataType> class Variant : public nsIVariant {
+public:
+ Variant(typename variant_storage_traits<DataType>::ConstructorType aData)
+ : mData(variant_storage_traits<DataType>::storage_conversion(aData)) {}
+ typename variant_storage_traits<DataType>::StorageType mData;
+};
+typedef Variant<nsString> TextVariant;
+class Row {
+ void initialize(sqlite3_stmt *aStatement);
+};
+void Row::initialize(sqlite3_stmt *aStatement)
+{
+ nsDependentString str(static_cast<const PRUnichar
+*>(::sqlite3_column_text16(aStatement, 0)));
+ new TextVariant(str);
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44900.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44900.C
new file mode 100644
index 000000000..ad150d7fb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44900.C
@@ -0,0 +1,76 @@
+/* { dg-do run { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-msse" } */
+/* { dg-require-effective-target sse_runtime } */
+
+typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
+typedef float __v4sf __attribute__ ((__vector_size__ (16)));
+
+extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__,
+__artificial__))
+_mm_set_ps (const float __Z, const float __Y, const float __X, const float __W)
+{
+ return __extension__ (__m128)(__v4sf){ __W, __X, __Y, __Z };
+}
+
+struct vec
+{
+ union {
+ __m128 v;
+ float e[4];
+ };
+
+ static const vec & zero()
+ {
+ static const vec v = _mm_set_ps(0, 0, 0, 0);
+ return v;
+ }
+
+ vec() {}
+ vec(const __m128 & a) : v(a) {}
+
+ operator const __m128&() const { return v; }
+};
+
+struct vec2
+{
+ vec _v1;
+ vec _v2;
+
+ vec2() {}
+ vec2(const vec & a, const vec & b) : _v1(a), _v2(b) {}
+
+ static vec2 load(const float * a)
+ {
+ return vec2(
+ __builtin_ia32_loadups(&a[0]),
+ __builtin_ia32_loadups(&a[4]));
+ }
+
+ const vec & v1() const { return _v1; }
+ const vec & v2() const { return _v2; }
+};
+
+extern "C" void abort(void);
+
+
+inline bool operator==(const vec & a, const vec & b)
+{ return 0xf == __builtin_ia32_movmskps(__builtin_ia32_cmpeqps(a, b)); }
+
+int main( int argc, char * argv[] )
+{
+ __attribute__((aligned(16))) float data[] =
+ { 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5 };
+
+ float * p = &data[2];
+ vec2 a;
+
+ a = vec2::load(p);
+
+ vec v1 = a.v1();
+ vec v2 = a.v2();
+
+ if (v2.e[3] != 7.0)
+ abort();
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44915.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44915.C
new file mode 100644
index 000000000..ba7e96606
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44915.C
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-findirect-inlining" } */
+
+struct A;
+
+typedef void (A::*f_ptr) ();
+
+void dummy (f_ptr) { }
+
+void call_dummy (f_ptr cb)
+{
+ dummy (cb);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44972.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44972.C
new file mode 100644
index 000000000..e409148da
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr44972.C
@@ -0,0 +1,142 @@
+/* { dg-do compile } */
+
+#include<cassert>
+#include<new>
+#include<utility>
+
+namespace boost {
+
+template<class T>
+class optional;
+
+class aligned_storage
+{
+ char data[ 1000 ];
+ public:
+ void const* address() const { return &data[0]; }
+ void * address() { return &data[0]; }
+} ;
+
+
+template<class T>
+class optional_base
+{
+ protected :
+ optional_base(){}
+ optional_base ( T const& val )
+ {
+ construct(val);
+ }
+
+ template<class U>
+ void assign ( optional<U> const& rhs )
+ {
+ if (!is_initialized())
+ if ( rhs.is_initialized() )
+ construct(T());
+ }
+
+ public :
+
+ bool is_initialized() const { return m_initialized ; }
+
+ protected :
+
+ void construct ( T const& val )
+ {
+ new (m_storage.address()) T(val) ;
+ }
+
+ T const* get_ptr_impl() const
+ { return static_cast<T const*>(m_storage.address()); }
+
+ private :
+
+ bool m_initialized ;
+ aligned_storage m_storage ;
+} ;
+
+
+template<class T>
+class optional : public optional_base<T>
+{
+ typedef optional_base<T> base ;
+
+ public :
+
+ optional() : base() {}
+ optional ( T const& val ) : base(val) {}
+ optional& operator= ( optional const& rhs )
+ {
+ this->assign( rhs ) ;
+ return *this ;
+ }
+
+ T const& get() const ;
+
+ T const* operator->() const { assert(this->is_initialized()) ; return this->get_ptr_impl() ; }
+
+} ;
+
+
+} // namespace boost
+
+
+namespace std
+{
+
+ template<typename _Tp, std::size_t _Nm>
+ struct array
+ {
+ typedef _Tp value_type;
+ typedef const value_type* const_iterator;
+
+ value_type _M_instance[_Nm];
+
+ };
+}
+
+
+class NT
+{
+ double _inf, _sup;
+};
+
+
+template < typename T > inline
+std::array<T, 1>
+make_array(const T& b1)
+{
+ std::array<T, 1> a = { { b1 } };
+ return a;
+}
+
+class V
+{
+ typedef std::array<NT, 1> Base;
+ Base base;
+
+public:
+ V() {}
+ V(const NT &x)
+ : base(make_array(x)) {}
+
+};
+
+using boost::optional ;
+
+optional< std::pair< NT, NT > >
+ linsolve_pointC2() ;
+
+optional< V > construct_normal_offset_lines_isecC2 ( )
+{
+ optional< std::pair<NT,NT> > ip;
+
+ ip = linsolve_pointC2();
+
+ V a(ip->first) ;
+ return a;
+}
+
+
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45393.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45393.C
new file mode 100644
index 000000000..5bf16b034
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45393.C
@@ -0,0 +1,38 @@
+// { dg-do compile }
+
+class FloatPoint;
+class Path {
+public:
+ ~Path();
+ void moveTo(const FloatPoint&);
+ static void createEllipse(const FloatPoint& center, float rx, float ry);
+};
+extern "C" {
+ extern float cosf (float);
+ extern float sinf (float);
+}
+const float piFloat = static_cast<float>(3.14159265358979323846);
+class FloatPoint {
+public:
+ FloatPoint(float x, float y) : m_x(x), m_y(y) { }
+ float x() const;
+ float y() const;
+ float m_x, m_y;
+};
+void Path::createEllipse(const FloatPoint& center, float rx, float ry)
+{
+ float cx = center.x();
+ float cy = center.y();
+ Path path;
+ float x = cx;
+ float y = cy;
+ unsigned step = 0, num = 100;
+ while (1) {
+ float angle = static_cast<float>(step) / num * 2.0f * piFloat;
+ x = cx + cosf(angle) * rx;
+ y = cy + sinf(angle) * ry;
+ step++;
+ if (step == 1)
+ path.moveTo(FloatPoint(x, y));
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45580.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45580.C
new file mode 100644
index 000000000..c3af4910a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45580.C
@@ -0,0 +1,50 @@
+// { dg-do compile }
+
+namespace std {
+ typedef __SIZE_TYPE__ size_t;
+}
+inline void* operator new(std::size_t, void* __p) throw() {
+ return __p;
+}
+class Noncopyable { };
+struct CollectorCell { };
+template<typename T> class PassRefPtr {
+public:
+ T* releaseRef() const { }
+};
+template <typename T> class NonNullPassRefPtr {
+public:
+ template <class U> NonNullPassRefPtr(const PassRefPtr<U>& o)
+ : m_ptr(o.releaseRef()) { }
+ mutable T* m_ptr;
+};
+struct ClassInfo;
+class JSValue { };
+JSValue jsNull();
+class Structure;
+class JSGlobalData {
+ static void storeVPtrs();
+};
+class JSCell : public Noncopyable {
+ friend class JSObject;
+ friend class JSGlobalData;
+ virtual ~JSCell();
+};
+class JSObject : public JSCell {
+public:
+ explicit JSObject(NonNullPassRefPtr<Structure>);
+ static PassRefPtr<Structure> createStructure(JSValue prototype) { }
+};
+class JSByteArray : public JSObject {
+ friend class JSGlobalData;
+ enum VPtrStealingHackType { VPtrStealingHack };
+ JSByteArray(VPtrStealingHackType)
+ : JSObject(createStructure(jsNull())), m_classInfo(0) { }
+ const ClassInfo* m_classInfo;
+};
+void JSGlobalData::storeVPtrs() {
+ CollectorCell cell;
+ void* storage = &cell;
+ JSCell* jsByteArray = new (storage) JSByteArray(JSByteArray::VPtrStealingHack);
+ jsByteArray->~JSCell();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45699.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45699.C
new file mode 100644
index 000000000..828c1ef8e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45699.C
@@ -0,0 +1,61 @@
+// { dg-do run }
+
+extern "C" void abort ();
+
+class A
+{
+public:
+ virtual void foo () {abort();}
+};
+
+class B : public A
+{
+public:
+ int z;
+ virtual void foo () {abort();}
+};
+
+class C : public A
+{
+public:
+ void *a[32];
+ unsigned long b;
+ long c[32];
+
+ virtual void foo () {abort();}
+};
+
+class D : public C, public B
+{
+public:
+ D () : C(), B()
+ {
+ int i;
+ for (i = 0; i < 32; i++)
+ {
+ a[i] = (void *) 0;
+ c[i] = 0;
+ }
+ b = 0xaaaa;
+ }
+
+ virtual void foo ();
+};
+
+void D::foo()
+{
+ if (b != 0xaaaa)
+ abort();
+}
+
+static inline void bar (B &b)
+{
+ b.foo ();
+}
+
+int main()
+{
+ D d;
+ bar (d);
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45709-2.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45709-2.C
new file mode 100644
index 000000000..1f6a2344f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45709-2.C
@@ -0,0 +1,20 @@
+// { dg-do compile }
+
+struct Region {
+ int storage[4];
+ int count;
+};
+static inline Region subtract(int lhs)
+{
+ Region reg;
+ int* storage = reg.storage;
+ int* storage2 = reg.storage;
+ if (lhs > 0)
+ storage++, storage2--;
+ reg.count = storage - reg.storage + storage2 - reg.storage;
+ return reg;
+}
+void bar(int a)
+{
+ const Region copyBack(subtract(a));
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45709.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45709.C
new file mode 100644
index 000000000..1584ec76a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45709.C
@@ -0,0 +1,19 @@
+// { dg-do compile }
+
+struct Region {
+ int storage[4];
+ int count;
+};
+static inline Region subtract(int lhs)
+{
+ Region reg;
+ int* storage = reg.storage;
+ if (lhs > 0)
+ storage++;
+ reg.count = storage - reg.storage;
+ return reg;
+}
+void bar(int a)
+{
+ const Region copyBack(subtract(a));
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45843.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45843.C
new file mode 100644
index 000000000..f77b8cb01
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45843.C
@@ -0,0 +1,28 @@
+// PR target/45843
+// { dg-do run }
+
+#include <stdarg.h>
+
+extern "C" void abort ();
+struct S { struct T { } a[14]; char b; };
+struct S arg, s;
+
+void
+foo (int z, ...)
+{
+ char c;
+ va_list ap;
+ va_start (ap, z);
+ c = 'a';
+ arg = va_arg (ap, struct S);
+ if (c != 'a')
+ abort ();
+ va_end (ap);
+}
+
+int
+main ()
+{
+ foo (1, s);
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45854.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45854.C
new file mode 100644
index 000000000..17ee006e0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45854.C
@@ -0,0 +1,30 @@
+// { dg-do compile }
+
+template < typename = void >
+struct X { } ;
+struct Y
+{
+ Y () ;
+} ;
+template < typename = X < > >
+struct T
+{
+ void f ()
+ {
+ f () ;
+ }
+} ;
+struct S
+{
+ S ( X < > = X < > ()) ;
+ ~S ()
+ {
+ T < > () . f () ;
+ }
+} ;
+struct Z
+{
+ S s ;
+ Y y ;
+} a ;
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45874.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45874.C
new file mode 100644
index 000000000..70965ff57
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45874.C
@@ -0,0 +1,58 @@
+// { dg-do compile }
+
+typedef struct {
+} IppLibraryVersion;
+typedef unsigned char Ipp8u;
+typedef unsigned int Ipp32u;
+typedef signed int Ipp32s;
+typedef enum e_vm_Status {
+ VM_OK = 0, VM_OPERATION_FAILED =-999, VM_NOT_INITIALIZED =-998, VM_TIMEOUT =-987, VM_NOT_ENOUGH_DATA =-996, VM_NULL_PTR =-995, VM_SO_CANT_LOAD =-994, VM_SO_INVALID_HANDLE =-993, VM_SO_CANT_GET_ADDR =-992 }
+ vm_status;
+ typedef Ipp32s Status;
+ class MediaReceiver {
+ };
+class MediaBuffer : public MediaReceiver {
+};
+struct TrackInfo {
+};
+struct Mpeg2TrackInfo : public TrackInfo {
+};
+class BitstreamReader {
+public: BitstreamReader(void);
+ virtual ~BitstreamReader(void) {
+ }
+ Ipp32u GetBits(Ipp32s iNum);
+ void SkipBits(Ipp32s iNum);
+protected: virtual void Refresh(void);
+ Ipp32s m_iReadyBits;
+};
+class FrameConstructor : public MediaBuffer {
+};
+class VideoFrameConstructor : public FrameConstructor {
+};
+class Mpeg2FrameConstructor : public VideoFrameConstructor {
+ static Status ParsePictureHeader(Ipp8u *buf, Ipp32s iLen, Mpeg2TrackInfo *pInfo);
+};
+Status Mpeg2FrameConstructor::ParsePictureHeader(Ipp8u *buf, Ipp32s iLen, Mpeg2TrackInfo *pInfo) {
+ BitstreamReader bs;
+ bs.SkipBits(32 + 4 + 4 + 4 + 4 + 4 + 2);
+ bs.SkipBits(1 + 1 + 1 + 1 + 1 + 1 + 1);
+ bs.SkipBits(5);
+ bs.SkipBits(3);
+ Ipp8u source_format;
+ bs.SkipBits(22);
+ bs.SkipBits(8);
+ if (7 == source_format) {
+ Ipp8u ufep = (Ipp8u)bs.GetBits(3);
+ if (0x01 == ufep) {
+ bs.SkipBits(10);
+ }
+ }
+}
+void BitstreamReader::SkipBits(Ipp32s iNum) {
+ if (iNum <= m_iReadyBits) {
+ m_iReadyBits -= iNum;
+ Refresh();
+ }
+}
+void BitstreamReader::Refresh(void) { }
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45875.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45875.C
new file mode 100644
index 000000000..f1347f543
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45875.C
@@ -0,0 +1,25 @@
+// { dg-do compile }
+
+struct c1 {};
+
+struct c10 : c1
+{
+ virtual void foo ();
+};
+
+struct c11 : c10, c1 // // { dg-warning "" }
+{
+ virtual void f6 ();
+};
+
+struct c28 : virtual c11
+{
+ void f6 ();
+};
+
+void check_c28 ()
+{
+ c28 obj;
+ c11 *ptr = &obj;
+ ptr->f6 ();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45877.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45877.C
new file mode 100644
index 000000000..9af6ae999
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45877.C
@@ -0,0 +1,141 @@
+// { dg-do compile }
+
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ typedef __SIZE_TYPE__ size_t;
+ template<typename _Alloc> class allocator;
+ template<class _CharT> struct char_traits;
+ template<typename _CharT, typename _Traits = char_traits<_CharT>,
+ typename _Alloc = allocator<_CharT> >
+ class basic_string;
+ typedef basic_string<char> string;
+ template<class _T1, class _T2> struct pair { };
+ template<typename _Tp> class allocator { };
+ template<typename _Arg1, typename _Arg2, typename _Result>
+ struct binary_function {
+ typedef _Arg1 first_argument_type;
+ typedef _Arg2 second_argument_type;
+ typedef _Result result_type;
+ };
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ class basic_string {
+ public:
+ basic_string(const _CharT* __s, const _Alloc& __a = _Alloc());
+ };
+ class type_info {
+ public:
+ const char* name() const;
+ };
+ extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__, __artificial__))
+ void * memcpy (void *__restrict __dest, __const void *__restrict __src, size_t __len) throw ()
+ {
+ return __builtin___memcpy_chk (__dest, __src, __len, __builtin_object_size (__dest, 0));
+ }
+ template <typename _Key, typename _Tp >
+ class map {
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ public:
+ mapped_type& operator[](const key_type& __k);
+ };
+}
+class CodeAlloc { };
+using namespace std;
+typedef void *Stack;
+class basicForEachType;
+typedef const basicForEachType * aType;
+extern map<const string,basicForEachType *> map_type;
+class AnyTypeWithOutCheck { };
+typedef AnyTypeWithOutCheck AnyType;
+template<typename T> AnyTypeWithOutCheck inline SetAny(const T & x)
+{
+ AnyTypeWithOutCheck any;
+ memcpy(&any,&x,sizeof(x));
+}
+template<typename T> const T& GetAny(const AnyTypeWithOutCheck & x);
+class E_F0;
+class C_F0;
+class Polymorphic;
+typedef E_F0 * Expression;
+class basicAC_F0;
+extern Polymorphic * TheOperators, * TheRightOperators;
+class basicForEachType : public CodeAlloc {
+public:
+ virtual C_F0 CastTo(const C_F0 & e) const ;
+};
+class E_F0 :public CodeAlloc {
+public:
+ virtual AnyType operator()(Stack) const =0;
+};
+class E_F0mps : public E_F0 {
+};
+class ArrayOfaType : public CodeAlloc{
+protected:
+ aType * t;
+};
+class OneOperator : public ArrayOfaType {
+public:
+ OneOperator(aType rr,aType a,aType b);
+ virtual E_F0 * code(const basicAC_F0 &) const =0;
+};
+class Polymorphic: public E_F0mps {
+public:
+ void Add(const char * op,OneOperator * p0 ,OneOperator * p1=0) const;
+};
+class C_F0 {
+public:
+ operator E_F0 * () const;
+};
+class basicAC_F0 {
+public:
+ const C_F0 & operator [] (int i) const;
+};
+struct OneBinaryOperatorMI { };
+struct evalE_F2 { };
+template<typename C,class MI=OneBinaryOperatorMI,class MIx=evalE_F2 >
+class OneBinaryOperator : public OneOperator
+{
+ typedef typename C::result_type R;
+ typedef typename C::first_argument_type A;
+ typedef typename C::second_argument_type B;
+ aType t0,t1;
+ class Op : public E_F0 {
+ Expression a,b;
+ public:
+ AnyType operator()(Stack s) const {
+ return SetAny<R>(static_cast<R>(C::f( GetAny<A>((*a)(s)),
+ GetAny<B>((*b)(s)))));
+ }
+ Op(Expression aa,Expression bb) : a(aa),b(bb) { }
+ };
+public:
+ E_F0 * code(const basicAC_F0 & args) const {
+ return new Op(t0->CastTo(args[0]),t1->CastTo(args[1]));
+ }
+ OneBinaryOperator()
+ : OneOperator(map_type[typeid(R).name()],
+ map_type[typeid(A).name()],
+ map_type[typeid(B).name()]), t0(t[0]), t1(t[1]) { }
+};
+struct NothingType { };
+class ShapeOfArray{ };
+template<class R> class KN_: public ShapeOfArray { };
+template <class T> struct affectation: binary_function<T, T, T> { };
+template<class K,class L,class OP> struct set_A_BI
+: public binary_function<KN_<K>,pair<KN_<K>, KN_<L> > *,KN_<K> >
+{
+ static KN_<K> f(const KN_<K> & a, pair<KN_<K>, KN_<L> > * const & b);
+};
+template<class K,class L,class OP> struct set_AI_B
+: public binary_function<pair<KN_<K>, KN_<L> > * ,KN_<K>, NothingType >
+{
+ static NothingType f( pair<KN_<K>, KN_<L> > * const & b,const KN_<K> & a);
+};
+template<class K,class Z> void ArrayOperator()
+{
+ TheOperators->Add("=", new OneBinaryOperator<set_A_BI< K,Z,affectation<K> > >,
+ new OneBinaryOperator<set_AI_B< K,Z,affectation<K> > >);
+}
+void initArrayOperatorlong() {
+ ArrayOperator<long,long>();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45934.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45934.C
new file mode 100644
index 000000000..f43964107
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr45934.C
@@ -0,0 +1,23 @@
+/* { dg-do run } */
+
+extern "C" void abort ();
+
+struct B *b;
+
+struct B
+{
+ virtual void f () { }
+ ~B() { b->f(); }
+};
+
+struct D : public B
+{
+ virtual void f () { abort (); }
+};
+
+int main ()
+{
+ D d;
+ b = &d;
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr46111.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr46111.C
new file mode 100644
index 000000000..df57d8d02
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr46111.C
@@ -0,0 +1,32 @@
+// { dg-do compile }
+// { dg-require-effective-target pthread }
+// { dg-options "-ftree-parallelize-loops=2 -g" }
+
+struct A
+{
+ int zero ()
+ {
+ return 0;
+ }
+};
+
+static inline void
+bar (int)
+{
+}
+
+struct B
+{
+ struct A a;
+ B (int n)
+ {
+ for (int i = 0; i < n; i++)
+ bar (a.zero ());
+ }
+};
+
+void
+foo (int n)
+{
+ struct B b (n);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr46149.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr46149.C
new file mode 100644
index 000000000..bdc3d7704
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr46149.C
@@ -0,0 +1,51 @@
+// { dg-do run }
+// { dg-options "-fno-tree-sra" }
+
+struct S
+{
+ S ():p ((char *) __builtin_calloc (1, 1))
+ {
+ }
+ char *p;
+};
+
+template < class T > struct A
+{
+ A (const S & __m1, const T & __m2):m1 (__m1), m2 (__m2)
+ {
+ }
+ const S & m1;
+ const T & m2;
+};
+
+struct B:A < S >
+{
+ B (const S & __v):A < S > (__v, __v)
+ {
+ }
+};
+
+struct C:A < B >
+{
+ C (const S & __e1, const B & __e2):A < B > (__e1, __e2)
+ {
+ }
+};
+
+struct D
+{
+ D (const C & __c):c (__c)
+ {
+ }
+ const C c;
+};
+
+int
+main ()
+{
+ S s;
+ B b (s);
+ C c (s, b);
+ D d (c);
+ return d.c.m2.m2.p[0];
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr46154.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr46154.C
new file mode 100644
index 000000000..424b1fad8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr46154.C
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-fipa-cp-clone" } */
+
+struct S
+{
+ virtual int foo ()
+ {
+ return foo () == 0;
+ }
+ virtual void baz ();
+};
+
+void A ()
+{
+ S s;
+ s.foo ();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr46287.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr46287.C
new file mode 100644
index 000000000..fd201c48d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr46287.C
@@ -0,0 +1,66 @@
+// Check that indirect calls to thunks do not lead to errors.
+// { dg-do run }
+
+extern "C" void abort ();
+
+class A
+{
+public:
+ virtual void foo () {abort();}
+};
+
+class B : public A
+{
+public:
+ int z;
+ virtual void foo () {abort();}
+};
+
+class C : public A
+{
+public:
+ void *a[32];
+ unsigned long b;
+ long c[32];
+
+ virtual void foo () {abort();}
+};
+
+class D : public C, public B
+{
+public:
+ D () : C(), B()
+ {
+ int i;
+ for (i = 0; i < 32; i++)
+ {
+ a[i] = (void *) 0;
+ c[i] = 0;
+ }
+ b = 0xaaaa;
+ }
+
+ virtual void foo ();
+};
+
+void D::foo()
+{
+ if (b != 0xaaaa)
+ abort();
+}
+
+static inline void bar (B &b)
+{
+
+ b.foo ();
+}
+
+int main()
+{
+ int i;
+ D d;
+
+ for (i = 0; i < 5000; i++)
+ bar (d);
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr46364.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr46364.C
new file mode 100644
index 000000000..8098991ac
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr46364.C
@@ -0,0 +1,20 @@
+// { dg-do compile }
+#include <string>
+
+void a() throw (int);
+void b(std::string const &);
+
+void c(std::string *e)
+{
+ b("");
+
+ try {
+ a();
+ } catch (...) {
+ *e = "";
+ }
+}
+
+void d() {
+ c(0);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr46367.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr46367.C
new file mode 100644
index 000000000..260b5c113
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr46367.C
@@ -0,0 +1,11 @@
+#pragma interface
+struct S
+{
+ S *s;
+ ~S ()
+ {
+ delete s;
+ }
+};
+
+S s;
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr46383.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr46383.C
new file mode 100644
index 000000000..2b610394b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr46383.C
@@ -0,0 +1,252 @@
+// { dg-do compile }
+
+namespace std {
+template<class,class>struct pair{};
+ template<typename _Tp> struct _Vector_base {
+ struct _Vector_impl
+ {
+ _Tp* _M_start;
+ _Tp* _M_finish;
+ _Tp* _M_end_of_storage;
+ };
+ _Vector_impl _M_impl;
+ };
+ template<typename _Tp >
+ struct vector : _Vector_base<_Tp>
+ {
+ vector(const vector& __x);
+ };
+}
+namespace boost {
+struct G{};
+template <class T, class U >
+struct modable2
+: G
+{ };
+}
+namespace CGAL {
+struct Rep { };
+struct Handle
+{
+ Handle() ;
+ Handle(const Handle& x) ;
+ Rep* PTR;
+};
+template <typename ET_> class Lazy_exact_nt
+ : Handle
+ , boost::modable2< Lazy_exact_nt<ET_>, int >
+ , boost::modable2< Lazy_exact_nt<ET_>, double >
+{ };
+ struct CC_iterator { };
+struct Triangulation_data_structure_3 {
+ typedef CC_iterator Vertex_handle;
+ typedef CC_iterator Cell_handle;
+ typedef std::pair<Cell_handle, int> Facet;
+};
+template < class GT, class Tds_ > struct Triangulation_3 {
+ typedef Tds_ Tds;
+ typedef typename GT::Point_3 Point;
+ typedef typename Tds::Facet Facet;
+ typedef typename Tds::Vertex_handle Vertex_handle;
+ enum Locate_type { VERTEX=0, EDGE, FACET, CELL, OUTSIDE_CONVEX_HULL, OUTSIDE_AFFINE_HULL };
+ Tds _tds;
+ bool is_infinite(const Facet & f) const ;
+};
+template < class Gt, class Tds_ > struct Delaunay_triangulation_3 : public Triangulation_3<Gt, Tds_> { };
+ namespace Surface_mesher { enum Verbose_flag { VERBOSE, NOT_VERBOSE }; }
+enum Mesher_level_conflict_status { NO_CONFLICT = 0, CONFLICT_BUT_ELEMENT_CAN_BE_RECONSIDERED, CONFLICT_AND_ELEMENT_SHOULD_BE_DROPPED };
+struct Null_mesher_level {
+ template <typename P, typename Z> Mesher_level_conflict_status test_point_conflict_from_superior(P, Z) ;
+};
+template < class Tr, class Derived, class Element, class Previous, class Triangulation_traits > struct Mesher_level {
+ typedef Tr Triangulation;
+ typedef typename Triangulation::Point Point;
+ typedef typename Triangulation::Vertex_handle Vertex_handle;
+ typedef typename Triangulation_traits::Zone Zone;
+ typedef Previous Previous_level;
+ Derived& derived() { return static_cast<Derived&>(*this); }
+ Previous& previous_level;
+ Mesher_level(Previous_level& previous)
+ : previous_level(previous)
+ { }
+ Vertex_handle insert(Point p, Zone& z) ;
+ Zone conflicts_zone(const Point& p, Element e) ;
+ Element get_next_element() ;
+ template <class Mesh_visitor> void before_insertion(Element& e, const Point& p, Zone& zone, Mesh_visitor visitor) {
+ visitor.before_insertion(e, p, zone);
+ }
+ template <class Mesh_visitor> void after_insertion(Vertex_handle vh, Mesh_visitor visitor) {
+ derived().after_insertion_impl(vh);
+ }
+ template <class Mesh_visitor> void after_no_insertion(const Element& e, const Point& p, Zone& zone, Mesh_visitor visitor) {
+ visitor.after_no_insertion(e, p, zone);
+ }
+ template <class Mesh_visitor> void refine(Mesh_visitor visitor)
+ {
+ Element e = get_next_element();
+ const Mesher_level_conflict_status result = try_to_refine_element(e, visitor);
+ }
+ template <class Mesh_visitor> Mesher_level_conflict_status try_to_refine_element(Element e, Mesh_visitor visitor)
+ {
+ Point p ;
+ Zone zone = conflicts_zone(p, e);
+ const Mesher_level_conflict_status result = test_point_conflict(p, zone);
+ before_insertion(e, p, zone, visitor);
+ Vertex_handle v = insert(p, zone);
+ after_insertion(v, visitor);
+ after_no_insertion(e, p, zone, visitor);
+ }
+ Mesher_level_conflict_status test_point_conflict(const Point& p, Zone& zone)
+ {
+ return previous_level.test_point_conflict_from_superior(p, zone);
+ }
+};
+struct Null_mesh_visitor {
+ template <typename E, typename P, typename Z> void before_insertion(E, P, Z) const {}
+ template <typename E, typename P, typename Z> void after_no_insertion(E, P, Z) const {}
+};
+template <class Tr> struct Triangulation_ref_impl {
+ Triangulation_ref_impl(Tr& t);
+};
+template <typename Tr> struct Triangulation_mesher_level_traits_3
+: public Triangulation_ref_impl<Tr>
+{
+ typedef typename Tr::Facet Facet;
+ Triangulation_mesher_level_traits_3(Tr& t)
+ : Triangulation_ref_impl<Tr>(t)
+ { }
+ struct Zone {
+ typedef std::vector<int*> Cells;
+ typedef std::vector<Facet> Facets;
+ typedef typename Tr::Locate_type Locate_type;
+ Locate_type locate_type;
+ Cells cells;
+ Facets boundary_facets;
+ Facets internal_facets;
+ };
+};
+ namespace Surface_mesher {
+ namespace details {
+ template <typename Base> struct Triangulation_generator {
+ typedef typename Base::Complex_2_in_triangulation_3 C2T3;
+ typedef typename C2T3::Triangulation Triangulation;
+ typedef Triangulation Type;
+ typedef Type type;
+ };
+ template <typename Base> struct Facet_generator {
+ typedef typename Triangulation_generator<Base>::type Tr;
+ typedef typename Tr::Facet Type;
+ typedef Type type;
+ };
+ template <typename Base, typename Self, typename Element, typename PreviousLevel = Null_mesher_level> struct Mesher_level_generator {
+ typedef typename Base::Complex_2_in_triangulation_3 C2T3;
+ typedef typename C2T3::Triangulation Triangulation;
+ typedef Triangulation_mesher_level_traits_3<Triangulation> Tr_m_l_traits_3;
+ typedef Mesher_level <Triangulation, Self, Element, PreviousLevel, Tr_m_l_traits_3> Type;
+ };
+ }
+ template < class C2T3, class Surface_, class SurfaceMeshTraits, class Criteria_ > struct Surface_mesher_base
+ : public Triangulation_mesher_level_traits_3<typename C2T3::Triangulation>
+ {
+ typedef C2T3 Complex_2_in_triangulation_3;
+ typedef Surface_ Surface;
+ typedef SurfaceMeshTraits Surface_mesh_traits;
+ typedef Criteria_ Criteria;
+ typedef typename C2T3::Triangulation Tr;
+ typedef typename Tr::Vertex_handle Vertex_handle;
+ typedef typename Tr::Facet Facet;
+ Surface_mesher_base (C2T3& co, const Surface& s, const Surface_mesh_traits& mesh_traits, const Criteria& c)
+: Triangulation_mesher_level_traits_3<Tr>(co.triangulation()), c2t3(co), tr(co.triangulation()), surf(s), meshtraits(mesh_traits), criteria(c)
+ { }
+ C2T3& c2t3;
+ Tr& tr;
+ const Surface& surf;
+ const Surface_mesh_traits& meshtraits;
+ const Criteria& criteria;
+ void after_insertion_impl(const Vertex_handle& v) {
+ after_insertion_handle_opposite_facet (Facet ());
+ after_insertion_handle_incident_facet (Facet ());
+ }
+ void after_insertion_handle_incident_facet (const Facet& f) {
+ tr.is_infinite(f) ;
+ new_facet<false>(f);
+ }
+ template <bool remove_from_complex_if_not_in_restricted_Delaunay> void new_facet (const Facet& f) ;
+ void after_insertion_handle_opposite_facet (const Facet& f) {
+ after_insertion_handle_incident_facet (f);
+ }
+ };
+ template < typename Base, typename Element = typename details::Facet_generator<Base>::type, typename PreviousLevel = Null_mesher_level, Verbose_flag verbose = NOT_VERBOSE > struct Surface_mesher
+ : public Base , public details::Mesher_level_generator< Base, Surface_mesher<Base, Element, PreviousLevel, verbose>, Element, PreviousLevel >::Type
+ {
+ typedef typename Base::Complex_2_in_triangulation_3 C2T3;
+ typedef typename Base::Surface Surface;
+ typedef typename Base::Criteria Criteria;
+ typedef typename Base::Surface_mesh_traits Surface_mesh_traits;
+ typedef typename details::Mesher_level_generator< Base, Surface_mesher<Base, Element, PreviousLevel, verbose>, Element, PreviousLevel >::Type Mesher_lvl;
+ using Mesher_lvl::refine;
+ Null_mesher_level null_mesher_level;
+ Null_mesh_visitor null_visitor;
+ bool initialized;
+ Surface_mesher(C2T3& c2t3, const Surface& surface, const Surface_mesh_traits& mesh_traits, const Criteria& criteria)
+ : Base(c2t3, surface, mesh_traits, criteria), Mesher_lvl(null_mesher_level), initialized(false)
+ { }
+ void refine_mesh () {
+ refine(null_visitor);
+ }
+ };
+ }
+template <typename Surface> struct Surface_mesh_traits_generator_3 {
+ typedef typename Surface::Surface_mesher_traits_3 Type;
+ typedef Type type;
+};
+template < class Tr, typename Edge_info_ = void > struct Complex_2_in_triangulation_3 {
+ typedef Tr Triangulation;
+ Triangulation& triangulation();
+};
+template <class Tr> struct Surface_mesh_complex_2_in_triangulation_3
+: public Complex_2_in_triangulation_3<Tr>
+{ };
+ struct Non_manifold_tag {};
+ template < typename C2T3, typename SurfaceMeshTraits_3, typename Criteria, typename Tag > struct Make_surface_mesh_helper {
+ typedef Surface_mesher::Surface_mesher_base< C2T3, typename SurfaceMeshTraits_3::Surface_3, SurfaceMeshTraits_3, Criteria> Mesher_base;
+ };
+ template <typename C2T3, typename SurfaceMeshTraits_3, typename Criteria, typename Tag, Surface_mesher::Verbose_flag verbosity = Surface_mesher::NOT_VERBOSE > struct Surface_mesher_generator {
+ typedef typename Make_surface_mesh_helper< C2T3, SurfaceMeshTraits_3, Criteria, Tag>::Mesher_base Mesher_base;
+ typedef Surface_mesher::Surface_mesher< Mesher_base, typename Surface_mesher::details::Facet_generator<Mesher_base>::type, Null_mesher_level, verbosity> Mesher;
+ typedef Mesher type;
+ };
+template <typename C2T3, typename SurfaceMeshTraits_3, typename Criteria> void make_surface_mesh(C2T3& c2t3, const typename SurfaceMeshTraits_3::Surface_3& surface, const SurfaceMeshTraits_3& surface_mesh_traits, const Criteria& criteria) {
+ typedef typename Surface_mesher_generator< C2T3, SurfaceMeshTraits_3, Criteria, Non_manifold_tag, Surface_mesher::NOT_VERBOSE >::type Mesher;
+ Mesher mesher(c2t3, surface, surface_mesh_traits, criteria);
+ mesher.refine_mesh();
+}
+template <class Kernel> struct Surface_mesh_triangulation_generator_3 {
+ typedef CGAL::Triangulation_data_structure_3 Tds;
+ typedef CGAL::Delaunay_triangulation_3<Kernel, Tds> Type;
+};
+ namespace Surface_mesher {
+ namespace { struct Return_min { }; }
+ template < class GT, class Surface, class Unused = Return_min > struct Implicit_surface_oracle_3 {
+ typedef Surface Surface_3;
+ };
+ }
+ template< typename GT> struct Implicit_surface_3 {
+ typedef GT Geom_traits;
+ typedef Implicit_surface_3<Geom_traits > Self;
+ typedef Surface_mesher::Implicit_surface_oracle_3< Geom_traits, Self> Surface_mesher_traits_3;
+ };
+}
+struct K {
+struct Point_3 {
+CGAL::Lazy_exact_nt<double> a[3];
+};
+};
+typedef CGAL::Surface_mesh_triangulation_generator_3<K>::Type Tr;
+typedef CGAL::Surface_mesh_complex_2_in_triangulation_3<Tr> C2T3;
+typedef CGAL::Implicit_surface_3<K > Surface;
+typedef CGAL::Surface_mesh_traits_generator_3<Surface>::type Traits;
+void f() {
+ C2T3 c2t3 ;
+ CGAL::make_surface_mesh(c2t3, Surface(), Traits(), 3);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr46469.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr46469.C
new file mode 100644
index 000000000..8212ea4f9
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr46469.C
@@ -0,0 +1,13 @@
+extern "C" __inline __attribute__ ((__gnu_inline__)) int pthread_equal ()
+ {
+ }
+
+static
+ __typeof
+ (pthread_equal)
+ __gthrw_pthread_equal __attribute__ ((__weakref__ ("pthread_equal")));
+
+int identifierByPthreadHandle ()
+{
+ pthread_equal ();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr47290.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr47290.C
new file mode 100644
index 000000000..b739de5b7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr47290.C
@@ -0,0 +1,19 @@
+// PR tree-optimization/47290
+// { dg-do compile }
+
+struct V
+{
+ V (int = 0);
+ ~V ()
+ {
+ for (;;)
+ ;
+ }
+ int size ();
+};
+
+struct S
+{
+ V a, b;
+ S () : b (a.size ()) {}
+} s;
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr47313.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr47313.C
new file mode 100644
index 000000000..c10f558a3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr47313.C
@@ -0,0 +1,53 @@
+// { dg-do compile }
+
+namespace internal {
+ template < class DSC, bool Const > struct CC_iterator {
+ typedef CC_iterator iterator;
+ typedef typename DSC::value_type value_type;
+ typedef const value_type* pointer;
+ CC_iterator () ;
+ CC_iterator (const iterator &it) {
+ }
+ pointer p;
+ pointer operator->() const ;
+ };
+}
+template < class T > struct Compact_container {
+ typedef Compact_container <T> Self;
+ typedef T value_type;
+ typedef internal::CC_iterator<Self, false> iterator;
+};
+template < typename TDS = void > struct Periodic_3_triangulation_ds_cell_base_3 {
+ typedef typename TDS::Vertex_handle Vertex_handle;
+ const Vertex_handle& vertex(int i) const {
+ }
+};
+struct Triangulation_data_structure_3 {
+ typedef Triangulation_data_structure_3 Tds;
+ typedef Periodic_3_triangulation_ds_cell_base_3<Tds> Cell;
+ typedef Compact_container<Cell> Cell_range;
+ typedef Compact_container<int> Vertex_range;
+ typedef typename Cell_range::iterator Cell_handle;
+ typedef typename Vertex_range::iterator Vertex_handle;
+};
+typedef Triangulation_data_structure_3 TDS1;
+template < class > struct Periodic_3_Delaunay_triangulation_3 {
+ typedef TDS1::Vertex_handle Vertex_handle;
+ typedef TDS1::Cell_handle Cell_handle;
+ int compare_distance() const {
+ }
+ Vertex_handle nearest_vertex() const;
+};
+template < class Tds > typename Periodic_3_Delaunay_triangulation_3<Tds>::Vertex_handle Periodic_3_Delaunay_triangulation_3<Tds>::nearest_vertex() const {
+ Cell_handle c ;
+ Vertex_handle nearest = c->vertex(0);
+ nearest = (compare_distance() == -1) ? nearest : c->vertex(0);
+ return nearest;
+}
+typedef Periodic_3_Delaunay_triangulation_3<TDS1> PDT1;
+struct Periodic_3_triangulation_hierarchy_3 : PDT1 {
+ Vertex_handle nearest_vertex() const;
+};
+Periodic_3_triangulation_hierarchy_3::Vertex_handle Periodic_3_triangulation_hierarchy_3:: nearest_vertex() const {
+ return PDT1::nearest_vertex();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr47382.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr47382.C
new file mode 100644
index 000000000..a12dbe3fd
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr47382.C
@@ -0,0 +1,30 @@
+// { dg-do run }
+
+extern "C" void abort ();
+
+struct A
+{
+ inline ~A ();
+ virtual void foo () {}
+};
+
+struct B : A
+{
+ virtual void foo () { abort(); }
+};
+
+static inline void middleman (A *a)
+{
+ a->foo ();
+}
+
+inline A::~A ()
+{
+ middleman (this);
+}
+
+int main ()
+{
+ B b;
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr47541.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr47541.C
new file mode 100644
index 000000000..350a05192
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr47541.C
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+
+struct Dummy {};
+struct RefCount : public Dummy {
+ ~RefCount(); /* Has to be non-pod. */
+ int *a;
+ int *b;
+};
+RefCount::~RefCount(){}
+struct Wrapper : public Dummy { RefCount ref; };
+void __attribute__((noinline,noclone))
+Push(Wrapper ptr)
+{
+ *ptr.ref.b = 0;
+}
+extern "C" void abort (void);
+int main()
+{
+ int a = 1, b = 1;
+ Wrapper x;
+ x.ref.a = &a;
+ x.ref.b = &b;
+ Push(x);
+ if (b != 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr47559.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr47559.C
new file mode 100644
index 000000000..00731c3ce
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr47559.C
@@ -0,0 +1,8 @@
+// { dg-do compile { target c++11 } }
+// { dg-options "-fnon-call-exceptions" }
+
+void foo (int *k) noexcept
+{
+ for (;;)
+ *k = 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr47714.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr47714.C
new file mode 100644
index 000000000..4ff2eeef0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr47714.C
@@ -0,0 +1,16 @@
+struct A { virtual ~A () {} };
+struct B { virtual ~B () {} };
+struct C { virtual const A *foo (int) const = 0; };
+struct E : public B, public A { };
+struct F : public C
+{
+ virtual const E *foo (int) const;
+};
+void bar (int &);
+
+const E *
+F::foo (int x) const
+{
+ bar (x);
+ return __null;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr48165.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr48165.C
new file mode 100644
index 000000000..a42893f60
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr48165.C
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+
+typedef __SIZE_TYPE__ size_t;
+
+extern "C" {
+ extern __inline __attribute__ ((__always_inline__))
+ __attribute__ ((__gnu_inline__, __artificial__)) void *
+ memcpy (void *__restrict __dest, __const void *__restrict __src,
+ size_t __len) throw ()
+ {
+ return __builtin___memcpy_chk (__dest, __src, __len,
+ __builtin_object_size (__dest, 0));
+ }
+}
+
+typedef char TCODE[20];
+typedef TCODE TCODE_ARRAY[5];
+typedef struct PARAM
+{
+ TCODE_ARRAY tcode;
+} PARAM;
+
+static void foo (void* p)
+{
+ char buffer[4+sizeof(PARAM)];
+ PARAM *param = (PARAM *)(buffer + 4);
+ int i;
+
+ for (i=0; i < 5; i++)
+ {
+ memcpy( param->tcode[i], p, 20 );
+ }
+}
+
+void bar (void* p)
+{
+ foo (p);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr48271.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr48271.C
new file mode 100644
index 000000000..5b60ccd76
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr48271.C
@@ -0,0 +1,119 @@
+// { dg-do compile }
+// { dg-options "-ftree-vrp -fno-guess-branch-probability -fnon-call-exceptions" }
+
+void *xalloc ();
+void xfree (void *);
+void error ();
+
+static inline void *
+MallocT ()
+{
+ void *p = xalloc ();
+ if (!p)
+ error ();
+ return p;
+}
+
+
+struct ByteBlob
+{
+ int *header;
+
+ ByteBlob();
+
+ ~ByteBlob ()
+ {
+ Free ();
+ }
+
+ int RawFree (int * p)
+ {
+ if (!p)
+ error ();
+ xfree (p);
+ }
+
+ int *LengthRef ();
+
+ void Free ()
+ {
+ if (*header)
+ RawFree (header);
+ }
+
+ int Append (int num_ints)
+ {
+ if (*header)
+ MallocT ();
+ *LengthRef () += num_ints;
+ }
+};
+
+struct CBlobT:ByteBlob
+{
+ ~CBlobT ()
+ {
+ Free ();
+ }
+};
+
+template < class T > struct FixedSizeArray
+{
+ int HeaderSize;
+ T *data;
+ FixedSizeArray ();
+ int RefCnt ()
+ {
+ return *(int *) MallocT ();
+ }
+ ~FixedSizeArray ()
+ {
+ if (RefCnt ())
+ for (T * pItem = data + Length (); pItem != data; pItem--)
+ T ();
+ }
+ int Length ();
+};
+
+class SmallArray
+{
+ typedef FixedSizeArray < int > SubArray;
+ typedef FixedSizeArray < SubArray > SuperArray;
+ SuperArray data;
+};
+
+struct CHashTableT
+{
+ int *m_slots;
+ ~CHashTableT ()
+ {
+ delete m_slots;
+ }
+};
+
+struct CYapfBaseT
+{
+ int *PfGetSettings ();
+ SmallArray m_arr;
+ CHashTableT m_closed;
+ CYapfBaseT ()
+ {
+ MallocT ();
+ }
+};
+
+struct CYapfCostRailT:CYapfBaseT
+{
+ CBlobT m_sig_look_ahead_costs;
+ CYapfCostRailT ()
+ {
+ m_sig_look_ahead_costs.Append (*Yapf ()->PfGetSettings ());
+ Yapf ()->PfGetSettings ();
+ }
+ CYapfBaseT *Yapf ();
+};
+
+void stCheckReverseTrain ()
+{
+ CYapfCostRailT pf1;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr48600.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr48600.C
new file mode 100644
index 000000000..b60a0a011
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr48600.C
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+class mx {
+public:
+ mx();
+};
+
+int main()
+{
+ while (true) {
+ mx *bar = new mx;
+ mx *baz = new mx;
+ continue;
+ }
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr48661.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr48661.C
new file mode 100644
index 000000000..8de2142f7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr48661.C
@@ -0,0 +1,77 @@
+// PR middle-end/48661
+// { dg-do run }
+
+extern "C" void abort ();
+
+__attribute__((noinline))
+double
+foo (double x, double y)
+{
+ asm volatile ("" : : : "memory");
+ return x + y;
+}
+
+__attribute__((noinline, noclone))
+void
+bar (int x)
+{
+ if (x != 123)
+ abort ();
+}
+
+struct A
+{
+ double a1, a2;
+};
+
+struct B
+{
+ virtual int m () const = 0 ;
+};
+
+struct C
+{
+ virtual ~C () {}
+};
+
+struct D : virtual public B, public C
+{
+ explicit D (const A &x) : d(123) { foo (x.a2, x.a1); }
+ int m () const { return d; }
+ int d;
+};
+
+struct E
+{
+ E () : d(0) {}
+ virtual void n (const B &x) { d = x.m (); x.m (); x.m (); }
+ int d;
+};
+
+void
+test ()
+{
+ A a;
+ a.a1 = 0;
+ a.a2 = 1;
+ E p;
+ D q (a);
+ const B &b = q;
+ bar (b.m ());
+ p.n (b);
+ bar (p.d);
+}
+
+void
+baz ()
+{
+ A a;
+ D p2 (a);
+}
+
+int
+main ()
+{
+ test ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr48695.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr48695.C
new file mode 100644
index 000000000..44e6c771d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr48695.C
@@ -0,0 +1,38 @@
+// { dg-do run }
+
+typedef __SIZE_TYPE__ size_t;
+
+inline void *operator new (size_t, void *__p) throw() { return __p; }
+
+struct _Vector_impl
+{
+ int *_M_start;
+ int *_M_finish;
+ _Vector_impl () :_M_start (0), _M_finish (0) {}
+};
+
+struct vector
+{
+ _Vector_impl _M_impl;
+ int *_M_allocate (size_t __n)
+ {
+ return __n != 0 ? new int[__n] : 0;
+ }
+ void push_back ()
+ {
+ new (this->_M_impl._M_finish) int ();
+ this->_M_impl._M_finish =
+ this->_M_allocate (this->_M_impl._M_finish - this->_M_impl._M_start) + 1;
+ }
+};
+
+int
+main ()
+{
+ for (int i = 0; i <= 1; i++)
+ for (int j = 0; j <= 1; j++)
+ {
+ vector a[2];
+ a[i].push_back ();
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr48954.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr48954.C
new file mode 100644
index 000000000..bdd120004
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr48954.C
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -flto -fno-early-inlining -fkeep-inline-functions" } */
+/* { dg-require-effective-target lto } */
+
+struct A
+{
+ virtual void foo () = 0;
+};
+
+struct B : A {};
+struct C : A {};
+
+struct D: C, B
+{
+ void foo () {}
+};
+
+static inline void
+bar (B *b)
+{
+ b->foo ();
+}
+
+int
+main ()
+{
+ D d;
+ for (;;)
+ bar (&d);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49039.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49039.C
new file mode 100644
index 000000000..f576cba42
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49039.C
@@ -0,0 +1,76 @@
+// PR tree-optimization/49039
+// { dg-do run }
+
+template <class T1, class T2>
+struct pair
+{
+ T1 first;
+ T2 second;
+ pair (const T1 & a, const T2 & b):first (a), second (b) {}
+};
+
+template <class T1, class T2>
+inline pair <T1, T2>
+make_pair (T1 x, T2 y)
+{
+ return pair <T1, T2> (x, y);
+}
+
+typedef __SIZE_TYPE__ size_t;
+struct S
+{
+ const char *Data;
+ size_t Length;
+ static size_t min (size_t a, size_t b) { return a < b ? a : b; }
+ static size_t max (size_t a, size_t b) { return a > b ? a : b; }
+ S () :Data (0), Length (0) { }
+ S (const char *Str) : Data (Str), Length (__builtin_strlen (Str)) {}
+ S (const char *data, size_t length) : Data (data), Length (length) {}
+ bool empty () const { return Length == 0; }
+ size_t size () const { return Length; }
+ S slice (size_t Start, size_t End) const
+ {
+ Start = min (Start, Length);
+ End = min (max (Start, End), Length);
+ return S (Data + Start, End - Start);
+ }
+ pair <S, S> split (char Separator) const
+ {
+ size_t Idx = find (Separator);
+ if (Idx == ~size_t (0))
+ return make_pair (*this, S ());
+ return make_pair (slice (0, Idx), slice (Idx + 1, ~size_t (0)));
+ }
+ size_t find (char C, size_t From = 0) const
+ {
+ for (size_t i = min (From, Length), e = Length; i != e; ++i)
+ if (Data[i] == C)
+ return i;
+ return ~size_t (0);
+ }
+};
+
+void
+Test (const char *arg)
+{
+ S Desc (arg);
+ while (!Desc.empty ())
+ {
+ pair <S, S> Split = Desc.split ('-');
+ S Token = Split.first;
+ Desc = Split.second;
+ if (Token.empty ())
+ continue;
+ Split = Token.split (':');
+ S Specifier = Split.first;
+ if (Specifier.empty ())
+ __builtin_abort ();
+ }
+}
+
+int
+main ()
+{
+ Test ("-");
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49115.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49115.C
new file mode 100644
index 000000000..c4cce21ba
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49115.C
@@ -0,0 +1,25 @@
+// { dg-do run }
+
+extern "C" void abort (void);
+struct MyException {};
+struct Data {
+ int nr;
+ Data() : nr(66) {}
+};
+Data __attribute__((noinline,noclone)) getData(int i)
+{
+ if (i) throw MyException();
+ Data data;
+ data.nr = i;
+ return data;
+}
+int main(int, char **)
+{
+ Data data;
+ try {
+ data = getData(1);
+ } catch (MyException& e) {
+ if (data.nr != 66)
+ abort ();
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49394.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49394.C
new file mode 100644
index 000000000..67d521f45
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49394.C
@@ -0,0 +1,50 @@
+// { dg-do run }
+// { dg-options "-fipa-pta -fnon-call-exceptions" }
+
+struct Mutex
+{
+ bool locked;
+ ~Mutex ()
+ {
+ if (locked)
+ throw 0;
+ }
+ void lock ()
+ {
+ locked = true;
+ }
+ void unlock ()
+ {
+ if (!locked)
+ throw 0;
+ locked = false;
+ }
+};
+
+struct lock_guard
+{
+ Mutex *m;
+ lock_guard (Mutex *m) : m(m)
+ {
+ }
+ ~lock_guard ()
+ {
+ m->unlock ();
+ }
+};
+
+int
+main ()
+{
+ Mutex m;
+ m.lock ();
+ try
+ {
+ lock_guard l (&m);
+ }
+ catch ( ...)
+ {
+ __builtin_abort ();
+ }
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49519.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49519.C
new file mode 100644
index 000000000..2888709d9
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49519.C
@@ -0,0 +1,135 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+struct null_type {};
+
+inline const null_type cnull() { return null_type(); }
+
+template <class TT> struct cons;
+class tuple;
+
+template< int N >
+struct get_class {
+ template<class TT >
+ inline static int& get(cons<TT>& t)
+ {
+ return get_class<N-1>::template get(t.tail);
+ }
+};
+
+template<>
+struct get_class<0> {
+ template<class TT>
+ inline static int& get(cons<TT>& t)
+ {
+ return t.head;
+ }
+};
+
+template<int N, class T>
+struct element
+{
+private:
+ typedef typename T::tail_type Next;
+public:
+ typedef typename element<N-1, Next>::type type;
+};
+
+template<class T>
+struct element<0,T>
+{
+ typedef int type;
+};
+
+template<int N, class TT>
+inline int& get(cons<TT>& c) {
+ return get_class<N>::template get(c);
+}
+
+template <class TT>
+struct cons {
+ typedef TT tail_type;
+
+ int head;
+ tail_type tail;
+
+ cons() : head(), tail() {}
+
+ template <class T1, class T2, class T3, class T4>
+ cons( T1& t1, T2& t2, T3& t3, T4& t4 )
+ : head (t1),
+ tail (t2, t3, t4, cnull())
+ {}
+};
+
+template <>
+struct cons<null_type> {
+ typedef null_type tail_type;
+
+ int head;
+
+ cons() : head() {}
+
+ template<class T1>
+ cons(T1& t1, const null_type&, const null_type&, const null_type&)
+ : head (t1) {}
+};
+
+template <class T0, class T1, class T2, class T3>
+struct map_tuple_to_cons
+{
+ typedef cons<typename map_tuple_to_cons<T1, T2, T3, null_type>::type> type;
+};
+
+template <>
+struct map_tuple_to_cons<null_type, null_type, null_type, null_type>
+{
+ typedef null_type type;
+};
+
+class tuple :
+ public map_tuple_to_cons<int, int, int, int>::type
+{
+public:
+ typedef typename
+ map_tuple_to_cons<int, int, int, int>::type inherited;
+
+ tuple(const int &t0,
+ const int &t1,
+ const int &t2,
+ const int &t3)
+ : inherited(t0, t1, t2, t3) {}
+};
+
+void foo(void (*boo)(int, int, int, int), tuple t)
+{
+ boo(get<0>(t), get<1>(t), get<2>(t), get<3>(t));
+}
+
+int tailcalled_t1;
+int tailcalled_t2;
+int tailcalled_t3;
+int tailcalled_t4;
+
+void print(int t1, int t2, int t3, int t4)
+{
+ tailcalled_t1 = t1;
+ tailcalled_t2 = t2;
+ tailcalled_t3 = t3;
+ tailcalled_t4 = t4;
+}
+
+int main ()
+{
+ tuple t(1,2,3,4);
+ foo(print, t);
+
+ if( (get<0>(t) != tailcalled_t1)
+ ||(get<1>(t) != tailcalled_t2)
+ ||(get<2>(t) != tailcalled_t3)
+ ||(get<3>(t) != tailcalled_t4))
+ abort();
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49615.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49615.C
new file mode 100644
index 000000000..98a2f95b8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49615.C
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-g" } */
+
+template <class T>
+static inline bool Dispatch (T* obj, void (T::*func) ())
+{
+ (obj->*func) ();
+}
+class C
+{
+ bool f (int);
+ void g ();
+};
+bool C::f (int n)
+{
+ bool b;
+ switch (n)
+ {
+ case 0:
+ b = Dispatch (this, &C::g);
+ case 1:
+ b = Dispatch (this, &C::g);
+ }
+}
+void C::g ()
+{
+ for (;;) { }
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49628.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49628.C
new file mode 100644
index 000000000..4bc6543a3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49628.C
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+
+#include <vector>
+
+template <int rank, int dim> class Tensor;
+template <int dim> class Tensor<1,dim> {
+public:
+ explicit Tensor (const bool initialize = true);
+ Tensor (const Tensor<1,dim> &);
+ Tensor<1,dim> & operator = (const Tensor<1,dim> &);
+ double values[(dim!=0) ? (dim) : 1];
+};
+template <int dim>
+inline Tensor<1,dim> & Tensor<1,dim>::operator = (const Tensor<1,dim> &p)
+{
+ for (unsigned int i=0; i<dim; ++i)
+ values[i] = p.values[i];
+};
+template <int dim> class Quadrature {
+public:
+ const unsigned int n_quadrature_points;
+};
+class MappingQ1
+{
+ class InternalData {
+ public:
+ std::vector<Tensor<1,3> > shape_derivatives;
+ unsigned int n_shape_functions;
+ };
+ void compute_data (const Quadrature<3> &quadrature, InternalData &data)
+ const;
+};
+void MappingQ1::compute_data (const Quadrature<3> &q, InternalData &data) const
+{
+ const unsigned int n_q_points = q.n_quadrature_points;
+ data.shape_derivatives.resize(data.n_shape_functions * n_q_points);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49644.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49644.C
new file mode 100644
index 000000000..5fb82e017
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49644.C
@@ -0,0 +1,17 @@
+// PR c/49644
+// { dg-do run }
+
+extern "C" void abort ();
+
+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-4.9/gcc/testsuite/g++.dg/torture/pr49720.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49720.C
new file mode 100644
index 000000000..d2c69087d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49720.C
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+
+__extension__ typedef __PTRDIFF_TYPE__ pdiff_t;
+
+extern char t_start[], t_end[], t_size[];
+bool foo (void)
+{
+ pdiff_t size = reinterpret_cast<pdiff_t>(t_size);
+ return (size == t_end - t_start);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49770.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49770.C
new file mode 100644
index 000000000..8180648cb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49770.C
@@ -0,0 +1,86 @@
+/* { dg-do run { target c++11 } } */
+/* { dg-options "-fno-tree-forwprop" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+template < typename > struct remove_reference;
+template < typename _Tp > struct remove_reference <_Tp & >
+{
+ typedef _Tp type;
+};
+template < typename _Tp > typename remove_reference < _Tp >::type &&
+move (_Tp && __t)
+{
+ return static_cast < typename remove_reference < _Tp >::type && >(__t);
+}
+
+template < typename _Tp > void
+stdswap (_Tp & __a, _Tp & __b)
+{
+ _Tp __tmp (__a);
+ __a = (__b);
+ __b = (__tmp);
+}
+
+struct _Deque_iterator
+{
+ int *_M_cur;
+ int *_M_first;
+ int *_M_last;
+ int **_M_node;
+};
+
+static inline int operatorMIN (_Deque_iterator & __x, _Deque_iterator & __y)
+{
+ return sizeof (int) * (__x._M_node - __y._M_node - 1)
+ + (__x._M_cur - __x._M_first) + (__y._M_last - __y._M_cur);
+}
+
+struct deque
+{
+ deque & operator = (deque && __x)
+ {
+ stdswap (_M_finish, __x._M_finish);
+ return *this;
+ }
+ size_t size ()
+ {
+ return operatorMIN (_M_finish, _M_start);
+ }
+
+deque ():
+ _M_map (), _M_map_size (), _M_start (), _M_finish ()
+ {
+ _M_start._M_last = _M_start._M_first + sizeof (int);
+ }
+
+ int **_M_map;
+ size_t _M_map_size;
+ _Deque_iterator _M_start;
+ _Deque_iterator _M_finish;
+};
+
+struct queue
+{
+ deque c;
+ size_t size ()
+ {
+ return c.size ();
+ }
+};
+
+void
+test01 ()
+{
+ queue a, b;
+ ++a.c._M_finish._M_cur;
+ b = move (a);
+ if (!b.size ())
+ __builtin_abort ();
+}
+
+main ()
+{
+ test01 ();
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49938.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49938.C
new file mode 100644
index 000000000..91804f4b0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr49938.C
@@ -0,0 +1,48 @@
+#include <vector>
+#include <cstdlib>
+typedef unsigned short uint16;
+
+namespace base {
+ class StringPiece
+ {
+ public:
+ typedef std::size_t size_type;
+ size_type size() const { return length_; }
+ size_type length_;
+ };
+}
+
+namespace net {
+ class DNSSECKeySet
+ {
+ bool CheckSignature (const base::StringPiece& name, const
+ base::StringPiece& zone, const
+ base::StringPiece& signature, uint16 rrtype,
+ const std::vector<base::StringPiece>& rrdatas);
+ };
+}
+
+template <class C> class scoped_array
+{
+public: typedef C element_type;
+ explicit scoped_array(C* p = __null):array_(p) {}
+private: C* array_;
+};
+
+namespace net {
+ bool DNSSECKeySet::CheckSignature (const base::StringPiece& name,
+ const base::StringPiece& zone, const base::StringPiece& signature,
+ uint16 rrtype, const std::vector<base::StringPiece>& rrdatas)
+ {
+ unsigned signed_data_len = 0;
+ for (std::vector<base::StringPiece>::const_iterator i =
+ rrdatas.begin();
+ i != rrdatas.end(); i++) {
+ signed_data_len += 2;
+ signed_data_len += i->size();
+ }
+ scoped_array<unsigned char> signed_data(new unsigned
+ char[signed_data_len]);
+ }
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr50189.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr50189.C
new file mode 100644
index 000000000..06f1d3695
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr50189.C
@@ -0,0 +1,121 @@
+// { dg-do run }
+// { dg-options "-fstrict-enums" }
+
+extern "C" void abort (void);
+class CCUTILS_KeyedScalarLevelPosition
+{
+public:
+
+ typedef enum
+ {
+ UNINITED = 0,
+ AT_BEGIN = 1,
+ AT_END = 2,
+ AT_KEY = 3
+
+ } position_t;
+
+ bool is_init() const
+ { return(m_timestamp != UNINITED); }
+
+ bool is_at_begin() const
+ { return(m_timestamp == AT_BEGIN); }
+
+ position_t get_state() const
+ {
+ return((m_timestamp >= AT_KEY)
+ ? AT_KEY
+ : ((position_t)m_timestamp));
+ }
+
+ void set_at_begin()
+ { m_timestamp = AT_BEGIN; }
+
+ unsigned int get_index() const
+ { return(m_index); }
+
+ void set_pos(unsigned int a_index, unsigned int a_timestmap)
+ {
+ m_index = a_index;
+ m_timestamp = a_timestmap;
+ }
+
+ bool check_pos(unsigned int a_num_entries, unsigned int a_timestamp) const
+ {
+ if (get_state() != AT_KEY)
+ return(false);
+
+ if (m_timestamp != a_timestamp)
+ return(false);
+
+ return(m_index < a_num_entries);
+ }
+
+ void set_not_init()
+ { m_timestamp = 0; }
+
+private:
+
+ unsigned int m_timestamp;
+ unsigned int m_index;
+
+};
+
+class CCUTILS_KeyedScalarPosition
+{
+public:
+
+ CCUTILS_KeyedScalarLevelPosition m_L1;
+ CCUTILS_KeyedScalarLevelPosition m_L2;
+};
+
+class baz
+{
+public:
+ int *n[20];
+ unsigned int m_cur_array_len;
+ unsigned int m_timestamp;
+
+ unsigned int _get_timestamp() const
+ { return(m_timestamp); }
+
+ bool _check_L1_pos(const CCUTILS_KeyedScalarPosition &a_position) const
+ {
+ return(a_position.m_L1.check_pos(
+ m_cur_array_len, _get_timestamp()));
+ }
+
+ void *next (CCUTILS_KeyedScalarPosition &);
+};
+
+void * baz::next (CCUTILS_KeyedScalarPosition &a_position)
+{
+ if (a_position.m_L1.is_at_begin() || (!a_position.m_L1.is_init()))
+ {
+ a_position.m_L1.set_pos(0, _get_timestamp());
+ a_position.m_L2.set_at_begin();
+ }
+ else if (!_check_L1_pos(a_position))
+ return(0);
+
+ return n[a_position.m_L1.get_index ()];
+}
+
+int main (int, char **)
+{
+ baz obj;
+ CCUTILS_KeyedScalarPosition a_pos;
+ void *ret;
+ int n[5];
+
+ obj.n[0] = n;
+ obj.m_cur_array_len = 1;
+ obj.m_timestamp = 42;
+
+ a_pos.m_L1.set_pos (0, 42);
+
+ ret = obj.next (a_pos);
+ if (ret == 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr50672.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr50672.C
new file mode 100644
index 000000000..614a35b6c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr50672.C
@@ -0,0 +1,22 @@
+// { dg-do compile }
+
+struct A
+{
+ bool isHint();
+};
+class B
+{
+ void makeLine( int *) const;
+ void drawLine() const; A* to() const;
+ void _print() const;
+};
+A a;
+void B::makeLine(int *p1) const
+{
+ if (a.isHint() && to()->isHint()) ;
+ else {
+ if (p1) B::drawLine(); else B::_print();
+ return;
+ }
+ if (p1) B::drawLine(); else B::_print();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr51198.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr51198.C
new file mode 100644
index 000000000..79819e04e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr51198.C
@@ -0,0 +1,29 @@
+// { dg-do compile { target c++11 } }
+
+struct A
+{
+ int i = 0 ? 0 : throw 1;
+};
+
+
+struct B
+{
+ int f();
+ int i = f();
+};
+
+struct C
+{
+ C(int);
+};
+
+struct D
+{
+ C a = 0;
+};
+
+A a;
+B b;
+D d;
+
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr51344.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr51344.C
new file mode 100644
index 000000000..07be919c3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr51344.C
@@ -0,0 +1,11 @@
+/* { dg-do compile { target { i?86-*-* && ilp32 } } } */
+class A;
+
+template <class T>
+class B
+{
+ friend __attribute__((cdecl)) A& operator >>(A& a, B& b)
+ {
+ return a;
+ }
+};
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr51436.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr51436.C
new file mode 100644
index 000000000..43d6c7300
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr51436.C
@@ -0,0 +1,60 @@
+/* { dg-do compile } */
+
+typedef __SIZE_TYPE__ size_t;
+extern "C" void *memcpy (void *, __const void *, size_t);
+template < class Dest, class Source > struct BitCastHelper {
+ static Dest cast (const Source & source) __attribute__ ((always_inline)) {
+ Dest dest;
+ memcpy (0, &source, sizeof dest);
+ }
+};
+template < class Dest, class Source > Dest BitCast (Source)
+{
+ BitCastHelper < Dest, Source >::cast (0);
+}
+
+class MaybeObject
+{
+};
+class Object:MaybeObject
+{
+public:
+ static Object *cast (Object *) {
+ }
+};
+class HeapObject:public Object
+{
+};
+class String:public HeapObject
+{
+};
+class ExternalString:public String
+{
+};
+class ExternalTwoByteString:public ExternalString
+{
+};
+
+template < typename T > class Handle
+{
+public:
+ Handle () {
+ }
+ T *operator* () const;
+ template < class S > static Handle < T > cast (Handle < S > that) {
+ T::cast (*that);
+ }
+ T **location_;
+};
+
+template < typename T > T * Handle < T >::operator* () const
+{
+ *BitCast < T ** >(location_);
+}
+
+void
+TestCharacterStream ()
+{
+ Handle < String > uc16_string;
+ Handle < ExternalTwoByteString >::cast (uc16_string);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr51482.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr51482.C
new file mode 100644
index 000000000..28435919f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr51482.C
@@ -0,0 +1,30 @@
+// { dg-do compile }
+
+typedef enum { CLASS_IN = 1, CLASS_OUT = -1 } FERGUSON_KEY_CLASS, BEZIER_KEY_CLASS;
+typedef class flag_interface { } VECT3DF_SIMPLE;
+typedef struct vect3df {
+ float x,y,z;
+} VECT3DF, VECT;
+typedef struct vect4df : public vect3df {
+ float w;
+} VECT4DF, WVECT;
+typedef class llist_item { } ANIM_KEY;
+typedef class anim_track : public flag_interface, public llist_item { } ANIM_KEY_BEZ;
+typedef class anim_track_bezier : public anim_track { } ANIM_KEY_BEZ_WVECT;
+typedef class anim_track_bez_wvect : public anim_track_bezier {
+ WVECT * tangent(int kn, BEZIER_KEY_CLASS key_class, WVECT *p_tn);
+} ANIM_TRACK_BEZ_WVECT;
+WVECT * anim_track_bez_wvect::tangent(int kn, BEZIER_KEY_CLASS key_class, WVECT *p_tn)
+{
+ float bias,continuity,tension,tn1,bp1;
+ WVECT *p_p0,*p_p1,*p_p2, t1, g1,g2,g3;
+ g1.x = (p_p1->x - p_p0->x)*bp1;
+ g1.y = (p_p1->y - p_p0->y)*bp1;
+ g1.z = (p_p1->z - p_p0->z)*bp1;
+ g1.w = (p_p1->w - p_p0->w)*bp1;
+ bp1 = (0.5f + key_class*0.5f*continuity);
+ p_tn->x = (g1.x + g3.x*bp1)*tn1;
+ p_tn->y = (g1.y + g3.y*bp1)*tn1;
+ p_tn->z = (g1.z + g3.z*bp1)*tn1;
+ p_tn->w = (g1.w + g3.w*bp1)*tn1;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr51600.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr51600.C
new file mode 100644
index 000000000..618036077
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr51600.C
@@ -0,0 +1,16 @@
+template<class T> inline T min(T a, T b) { return a < b ? a : b; }
+double cornerbound(double *P, double (*m)(double, double))
+{
+ double b=m(P[0],P[3]);
+ return m(b,P[12]);
+}
+void bound(double *P, double (*m)(double, double), double b)
+{
+ m(b,cornerbound(P,m));
+}
+void bounds(double fuzz, unsigned maxdepth)
+{
+ double Px[]={};
+ double bx=Px[0];
+ bound(Px,min,bx);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr51737.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr51737.C
new file mode 100644
index 000000000..ff77edbf3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr51737.C
@@ -0,0 +1,30 @@
+// { dg-do compile }
+template<class T> class intrusive_ptr {
+public:
+ ~intrusive_ptr() { intrusive_ptr_release( px ); }
+ T * px;
+};
+template <typename T> struct intrusive_base {
+ friend void intrusive_ptr_release(T* ptr) { delete ptr; }
+};
+struct section_info;
+struct file_info : intrusive_base<file_info> {
+ intrusive_ptr<file_info> parent;
+ intrusive_ptr<section_info> switched_section;
+};
+struct section_info : intrusive_base<section_info> {
+ intrusive_ptr<section_info> parent;
+};
+struct id_state {
+ void * start_file(void);
+};
+void * id_state::start_file(void) {
+ intrusive_ptr<file_info> parent;
+}
+struct id_generation_data : intrusive_base<id_generation_data> {
+ void child_length() const {}
+};
+void generate_id(id_generation_data& generation_data)
+{
+ generation_data.child_length();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr51903.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr51903.C
new file mode 100644
index 000000000..925021b7e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr51903.C
@@ -0,0 +1,9 @@
+// { dg-do compile }
+// { dg-options "-O2 -fnon-call-exceptions -fno-guess-branch-probability" }
+
+#include <vector>
+
+void foo ()
+{
+ std::vector < std::vector< int > > (20000);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr51959.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr51959.C
new file mode 100644
index 000000000..da0be71eb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr51959.C
@@ -0,0 +1,80 @@
+// { dg-do compile }
+
+namespace std {
+ typedef __SIZE_TYPE__ size_t;
+}
+inline void* operator new(std::size_t, void* __p) throw() {
+ return __p;
+}
+template <typename T> class QTypeInfo {
+};
+enum { Q_COMPLEX_TYPE = 0, Q_PRIMITIVE_TYPE = 0x1, Q_STATIC_TYPE = 0, Q_MOVABLE_TYPE = 0x2, Q_DUMMY_TYPE = 0x4 };
+template<typename Enum> class QFlags {
+ int i;
+ inline QFlags(Enum f) : i(f) { }
+};
+class __attribute__((visibility("default"))) QSize {
+public:
+ bool isEmpty() const;
+ friend inline bool operator==(const QSize &, const QSize &);
+ int wd;
+ int ht;
+};
+template<> class QTypeInfo<QSize > {
+public:
+ enum {
+ isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QSize)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) };
+};
+class __attribute__((visibility("default"))) QBasicAtomicInt {
+public:
+ inline bool operator!=(int value) const { }
+};
+struct __attribute__((visibility("default"))) QListData {
+ struct Data {
+ QBasicAtomicInt ref;
+ };
+ void **append();
+};
+template <typename T> class QList {
+ struct Node {
+ void *v;
+ };
+ union {
+ QListData p;
+ QListData::Data *d;
+ };
+public:
+ void append(const T &t);
+ inline void push_back(const T &t) {
+ append(t);
+ }
+ void node_construct(Node *n, const T &t);
+ void node_destruct(Node *n);
+};
+template <typename T> inline void QList<T>::node_construct(Node *n, const T &t) {
+ if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) n->v = new T(t);
+ else if (QTypeInfo<T>::isComplex) new (n) T(t);
+}
+template <typename T> inline void QList<T>::node_destruct(Node *n) {
+}
+template <typename T> void QList<T>::append(const T &t) {
+ if (d->ref != 1) {
+ try {
+ }
+ catch (...) {
+ }
+ if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) {
+ }
+ else {
+ Node *n, copy;
+ node_construct(&copy, t);
+ try { n = reinterpret_cast<Node *>(p.append());; }
+ catch (...) { node_destruct(&copy); throw; }
+ *n = copy;
+ }
+ }
+};
+void virtual_hook(QSize sz, QList<QSize> &arg)
+{
+ arg.push_back(sz);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr52582.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr52582.C
new file mode 100644
index 000000000..1b93fc490
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr52582.C
@@ -0,0 +1,23 @@
+// PR c++/52582
+
+inline void *operator new (__SIZE_TYPE__, void *p) throw ()
+{
+ return p;
+}
+struct B
+{
+ virtual ~B ();
+ B ();
+};
+struct A : B
+{
+ A () : B () {}
+ virtual void bar ();
+};
+void
+foo ()
+{
+ char a[64];
+ B *b = new (&a) A ();
+ b->~B ();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr52638.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr52638.C
new file mode 100644
index 000000000..3ac76ccc4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr52638.C
@@ -0,0 +1,15 @@
+// { dg-do compile }
+// { dg-options "-ftree-vectorize" }
+
+void
+bar (bool * b, bool * e, bool t)
+{
+ while (b < e)
+ *b++ = t;
+}
+
+void
+foo (bool * b, bool * e, bool t)
+{
+ bar (b, e, true);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr52772.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr52772.C
new file mode 100644
index 000000000..810e6579f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr52772.C
@@ -0,0 +1,85 @@
+// { dg-do compile }
+
+typedef __SIZE_TYPE__ size_t;
+
+class c1;
+
+class c2 {
+ public: c2() { };
+ void *operator new(size_t size, const c1 & crc1);
+};
+
+class c3 {
+ public: c3() { _Obj = 0; }
+ ~c3() { if (_Obj) delete _Obj; }
+ void set(c2 *pObj);
+ protected: c2 *_Obj;
+};
+
+void c3::set(c2 *pObj) { _Obj = pObj; };
+
+template<class TYPE> class tc1 : public c2 {
+ public: tc1(int n=0){};
+ int get() const;
+ TYPE& operator[] (int id);
+ TYPE * _data;
+ int _size;
+};
+
+template<class TYPE> TYPE & tc1<TYPE>::operator[] (int id) {
+ return _data[id];
+}
+
+template<class TYPE> int tc1<TYPE>::get() const {
+ return _size;
+}
+
+class c4 {
+ public: c4();
+};
+
+class c5 : public c2 {
+ protected: c2 * _own;
+ public: c5(c2 *o) : _own(o) { }
+ c5(const c4 & box);
+ int add(const c4 & ext);
+};
+
+class c6 {
+ public: int get() const {};
+};
+
+class c7 {
+ friend class c8;
+ int find(c6 * loop) const;
+};
+
+class c8 {
+ const c1 & _rc1;
+ int tria(c7 * face, c5 * vtree0 = 0);
+};
+
+int c8::tria(c7 * face, c5 * vtree0) {
+ c6 *sLData[64];
+ tc1<c6*> loops(64);
+ while (loops.get() > 1) {
+ c6 *iloop = 0;
+ for (int j=1; j<loops.get(); j++) {
+ if (loops[j]->get() < 32) {
+ iloop = loops[j];
+ }
+ }
+ face->find(iloop);
+ }
+ c4 box;
+ c3 ctree;
+ c5 *vtree = vtree0;
+ if (!vtree) {
+ vtree = new (_rc1) c5(box);
+ ctree.set(vtree);
+ for (int j=0; j<1; j++) {
+ c4 sVBBox;
+ vtree->add(sVBBox);
+ }
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr52918-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr52918-1.C
new file mode 100644
index 000000000..9e7b21ba6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr52918-1.C
@@ -0,0 +1,39 @@
+// { dg-do compile }
+
+typedef __SIZE_TYPE__ size_t;
+class bad_alloc { };
+typedef struct {
+} __gthread_mutex_t;
+int __gthread_mutex_unlock (__gthread_mutex_t *__mutex);
+class __concurrence_unlock_error {
+};
+inline void __throw_concurrence_unlock_error() {
+ throw __concurrence_unlock_error();
+}
+class __mutex {
+ __gthread_mutex_t _M_mutex;
+public:
+ void unlock() {
+ if (__gthread_mutex_unlock(&_M_mutex) != 0)
+ __throw_concurrence_unlock_error();
+ }
+};
+class free_list {
+ typedef __mutex __mutex_type;
+ __mutex_type& _M_get_mutex();
+ void _M_get(size_t __sz) throw(bad_alloc);
+};
+void free_list::_M_get(size_t __sz) throw(bad_alloc)
+{
+ __mutex_type& __bfl_mutex = _M_get_mutex();
+ __bfl_mutex.unlock();
+ int __ctr = 2;
+ while (__ctr) {
+ size_t* __ret = 0;
+ --__ctr;
+ try {
+ __ret = (size_t*) (::operator new(__sz + sizeof(size_t)));
+ }
+ catch(const bad_alloc&) { }
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr52918-2.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr52918-2.C
new file mode 100644
index 000000000..ba31295e4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr52918-2.C
@@ -0,0 +1,40 @@
+// { dg-do compile }
+
+typedef __SIZE_TYPE__ size_t;
+void* __cxa_allocate_exception(size_t) throw();
+typedef struct { } __gthread_mutex_t;
+extern int __gthr_win32_mutex_unlock (__gthread_mutex_t *);
+int __gthread_mutex_lock (__gthread_mutex_t *__mutex);
+int __gthread_mutex_unlock (__gthread_mutex_t *__mutex);
+void __throw_concurrence_lock_error();
+void __throw_concurrence_unlock_error();
+class __mutex {
+ __gthread_mutex_t _M_mutex;
+public:
+ void lock() {
+ if (__gthread_mutex_lock(&_M_mutex) != 0)
+ __throw_concurrence_lock_error();
+ }
+ void unlock() {
+ if (__gthread_mutex_unlock(&_M_mutex) != 0)
+ __throw_concurrence_unlock_error();
+ }
+};
+class __scoped_lock {
+ typedef __mutex __mutex_type;
+ __mutex_type& _M_device;
+public:
+ explicit __scoped_lock(__mutex_type& __name) : _M_device(__name) {
+ _M_device.lock();
+ }
+ ~__scoped_lock() throw() {
+ _M_device.unlock();
+ }
+};
+__mutex emergency_mutex;
+void * __cxa_allocate_exception(size_t thrown_size) throw()
+{
+ void *ret;
+ if (! ret)
+ __scoped_lock sentry(emergency_mutex);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53011.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53011.C
new file mode 100644
index 000000000..2cd8a6033
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53011.C
@@ -0,0 +1,66 @@
+// { dg-do compile }
+
+extern "C" class WvFastString;
+typedef WvFastString& WvStringParm;
+struct WvFastString {
+ ~WvFastString();
+ operator char* () {}
+};
+class WvString : WvFastString {};
+class WvAddr {};
+class WvIPAddr : WvAddr {};
+struct WvIPNet : WvIPAddr {
+ bool is_default() {}
+};
+template<class T, bool> struct WvTraits_Helper {
+ static void release(T *obj) {
+ delete obj;
+ }
+};
+template<class From> struct WvTraits {
+ static void release(From *obj) {
+ WvTraits_Helper<From, 0>::release(obj);
+ }
+};
+struct WvLink {
+ void *data;
+ WvLink *next;
+ bool autofree;
+ WvLink(bool, int) : autofree() {}
+ bool get_autofree() {}
+
+ void unlink() {
+ delete this;
+ }
+};
+struct WvListBase {
+ WvLink head, *tail;
+ WvListBase() : head(0, 0) {}
+};
+template<class T> struct WvList : WvListBase {
+ ~WvList() {
+ zap();
+ }
+
+ void zap(bool destroy = 1) {
+ while (head.next) unlink_after(&head, destroy);
+ }
+
+ void unlink_after(WvLink *after, bool destroy) {
+ WvLink *next = 0;
+ T *obj = (destroy && next->get_autofree()) ?
+ static_cast<T*>(next->data) : 0;
+
+ if (tail) tail = after;
+ next->unlink();
+ WvTraits<T>::release(obj);
+ }
+};
+typedef WvList<WvString>WvStringListBase;
+class WvStringList : WvStringListBase {};
+class WvSubProc {
+ WvStringList last_args, env;
+};
+void addroute(WvIPNet& dest, WvStringParm table) {
+ if (dest.is_default() || (table != "default")) WvSubProc checkProc;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53085.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53085.C
new file mode 100644
index 000000000..9ee29fec1
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53085.C
@@ -0,0 +1,17 @@
+// { dg-do compile }
+// { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } { "" } }
+// { dg-options "-fdump-tree-optimized" }
+
+class aa{
+ void f();
+private:
+ volatile int a;
+};
+
+void aa::f(){
+ a=1;
+ a=1;
+}
+
+// { dg-final { scan-tree-dump-times "a ={v} 1;" 2 "optimized" } }
+// { dg-final { cleanup-tree-dump "optimized" } }
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53161.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53161.C
new file mode 100644
index 000000000..483556d9d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53161.C
@@ -0,0 +1,22 @@
+/* { dg-do compile { target c++11 } } */
+void gg();
+static __typeof(gg) __gthrw_gg __attribute__((__weakref__("gg")));
+
+template<typename R,typename... A>
+struct data {
+ template<typename Y,typename X>
+ data(Y& y,R(X::*f)(A...));
+};
+
+template<typename Y,typename X,typename R,typename... A>
+data<R,A...> make_data(Y& y,R(X::*f)(A...)) {
+ return data<R,A...>(y,f);
+}
+
+void global(data<void>);
+
+struct test {
+ void bar() {}
+ void doit() { global(make_data(*this,&test::bar)); }
+};
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53321.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53321.C
new file mode 100644
index 000000000..40a2de731
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53321.C
@@ -0,0 +1,36 @@
+// { dg-do compile }
+// { dg-require-profiling "-fprofile-generate" }
+// { dg-options "-fprofile-generate" }
+
+typedef long unsigned int size_t;
+
+extern "C"
+{
+ extern void *memcpy (void *__dest, __const void *__src, size_t __n);
+}
+
+extern char *src, *sources;
+extern int n_sources;
+
+static void
+find_source (const char *file_name)
+{
+ memcpy (src, sources, n_sources * sizeof (*sources));
+}
+
+extern const char *gcov_read_string (void);
+
+static void read_graph_file (void)
+{
+ find_source (gcov_read_string ());
+}
+
+static void process_file (void)
+{
+ read_graph_file ();
+}
+
+int main ()
+{
+ process_file ();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53336.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53336.C
new file mode 100644
index 000000000..ab121945d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53336.C
@@ -0,0 +1,45 @@
+// { dg-do compile }
+
+bool foo();
+
+struct C
+{
+ C()
+ {
+ if (foo())
+ foo();
+ }
+};
+
+struct S
+{
+ struct dummy
+ {
+ int i_;
+ };
+ typedef int dummy::*bool_type;
+
+ operator bool_type() const
+ {
+ return foo() ? &dummy::i_ : 0;
+ }
+};
+
+int x;
+
+struct adaptor
+{
+ C c;
+
+ virtual void bar()
+ {
+ if (S())
+ x = 0;
+ }
+};
+
+int main()
+{
+ adaptor a;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53364.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53364.C
new file mode 100644
index 000000000..36bb083e8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53364.C
@@ -0,0 +1,37 @@
+// { dg-do run }
+
+extern "C" void abort (void);
+
+template<typename _Tp>
+inline const _Tp&
+min(const _Tp& __a, const _Tp& __b)
+{
+ if (__b < __a)
+ return __b;
+ return __a;
+}
+
+struct A
+{
+ int m_x;
+
+ explicit A(int x) : m_x(x) {}
+ operator int() const { return m_x; }
+};
+
+struct B : public A
+{
+public:
+ explicit B(int x) : A(x) {}
+};
+
+int data = 1;
+
+int main()
+{
+ B b = B(10);
+ b = min(b, B(data));
+ if (b != 1)
+ abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53602.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53602.C
new file mode 100644
index 000000000..ab0f16fe2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53602.C
@@ -0,0 +1,364 @@
+// { dg-do compile { target c++11 } }
+
+namespace std
+{
+ template <class, class>
+ struct pair
+ {
+ };
+ struct input_iterator_tag
+ {
+ };
+ struct forward_iterator_tag : public input_iterator_tag
+ {
+ };
+ template <typename, typename _Tp, typename = _Tp>
+ struct iterator
+ {
+ };
+}
+namespace __gnu_cxx
+{
+ template <typename _Tp>
+ struct new_allocator
+ {
+ typedef _Tp pointer;
+ typedef _Tp value_type;
+ template <typename _Tp1>
+ struct rebind
+ {
+ typedef new_allocator <_Tp1> other;
+ };
+ };
+}
+namespace std
+{
+ template <typename _Tp>
+ struct allocator : public __gnu_cxx::new_allocator <_Tp>
+ {
+ };
+}
+extern "C"
+{
+ struct rtl_String;
+ void rtl_string_release (rtl_String *) throw ();
+ void rtl_string_newFromStr (rtl_String * *, const char *) throw ();
+}
+namespace std
+{
+ template <typename, typename, typename> struct binary_function;
+ template <typename _Tp>
+ struct equal_to : public binary_function <_Tp, _Tp, bool>
+ {
+ };
+}
+namespace rtl
+{
+ struct OString
+ {
+ rtl_String * pData;
+ OString (const char *value)
+ {
+ rtl_string_newFromStr (&pData, value);
+ }
+ ~OString ()
+ {
+ rtl_string_release (pData);
+ }
+ };
+ struct OStringHash;
+}
+namespace boost
+{
+ template <class> struct hash;
+ namespace unordered
+ {
+ template <class T, class = boost::hash <T>, class = std::equal_to <T>, class = std::allocator <T>>class unordered_set;
+ }
+ using boost::unordered::unordered_set;
+ namespace detail
+ {
+ template <bool>
+ struct if_true
+ {
+ template <class, class F>
+ struct then
+ {
+ typedef F type;
+ };
+ };
+ }
+ template <class, class> struct pointer_to_other;
+ template <class T, class U>
+ struct pointer_to_other <T *, U>
+ {
+ typedef U type;
+ };
+ namespace unordered
+ {
+ namespace detail
+ {
+ template <typename T, T> struct integral_constant
+ {
+ };
+ struct choice9
+ {
+ typedef char (&type)[9];
+ };
+ struct choice8:choice9
+ {
+ };
+ struct choice7:choice8
+ {
+ };
+ struct choice6:choice7
+ {
+ };
+ struct choice5:choice6
+ {
+ };
+ struct choice4:choice5
+ {
+ };
+ struct choice3:choice4
+ {
+ };
+ struct choice2:choice3
+ {
+ };
+ struct choice1:choice2
+ {
+ };
+ choice1 choose ();
+ template <typename Alloc, typename T>
+ struct rebind_wrap
+ {
+ typedef typename Alloc::template rebind <T>::other type;
+ };
+ template <typename, typename T2>
+ struct sfinae:T2
+ {
+ };
+ template <typename Tp, typename Default>
+ struct default_type_pointer
+ {
+ template <typename X>
+ static boost::unordered::detail::sfinae <typename X::pointer, choice1> test (choice1);
+ struct DefaultWrap
+ {
+ typedef Default pointer;
+ };
+ enum { value = (1 == sizeof (test <Tp> (choose ()))) };
+ typedef typename boost::detail::if_true <value>::template then <Tp, DefaultWrap>::type::pointer type;
+ };
+ template <typename Tp, typename Default>
+ struct default_type_const_pointer
+ {
+ template <typename>
+ static choice2::type test (choice2);
+ struct DefaultWrap
+ {
+ };
+ enum { value = (1 == sizeof (test <Tp> (choose ()))) };
+ typedef typename boost::detail::if_true <value>::template then <Tp, DefaultWrap> type;
+ };
+ struct default_type_propagate_on_container_swap
+ {
+ struct DefaultWrap
+ {
+ };
+ };
+ template <typename Alloc>
+ struct allocator_traits
+ {
+ typedef typename Alloc::value_type value_type;
+ typedef typename default_type_pointer <Alloc, value_type *>::type pointer;
+ template <typename T>
+ struct pointer_to_other : boost::pointer_to_other <pointer, T>
+ {
+ };
+ typedef typename default_type_const_pointer <Alloc, typename pointer_to_other <value_type>::type>::type const_pointer;
+ };
+ }
+ namespace detail
+ {
+ struct move_tag
+ {
+ };
+ template <typename> struct table;
+ template <typename NodeAlloc>
+ struct node_constructor
+ {
+ void construct_value ()
+ {
+ }
+ };
+ struct ptr_bucket
+ {
+ ptr_bucket ()
+ {
+ }
+ };
+ template <typename A, typename Bucket, typename Node>
+ struct buckets
+ {
+ typedef Node node;
+ typedef Bucket bucket;
+ typedef typename boost::unordered::detail::rebind_wrap <A, node>::type node_allocator;
+ typedef typename boost::unordered::detail::rebind_wrap <A, bucket>::type bucket_allocator;
+ typedef boost::unordered::detail::allocator_traits <node_allocator> node_allocator_traits;
+ typedef boost::unordered::detail::allocator_traits <bucket_allocator> bucket_allocator_traits;
+ typedef typename node_allocator_traits::pointer node_pointer;
+ typedef typename node_allocator_traits::const_pointer const_node_pointer;
+ typedef typename bucket_allocator_traits::pointer bucket_pointer;
+ typedef boost::unordered::detail::node_constructor <node_allocator> node_constructor;
+ bucket_pointer buckets_;
+ unsigned size_;
+ template <typename Types>
+ buckets (boost::unordered::detail::table <Types>, boost::unordered::detail::move_tag) : buckets_ (), size_ ()
+ {
+ }
+ };
+ struct functions
+ {
+ };
+ }
+ }
+ namespace detail
+ {
+ template <class Category, class T, class, class, class>
+ struct iterator_base:std::iterator <Category, T>
+ {
+ };
+ }
+ template <class Category, class T, class Distance, class Pointer = T, class Reference = T>
+ struct iterator:boost::detail::iterator_base <Category, T, Distance, Pointer, Reference>
+ {
+ };
+ namespace unordered
+ {
+ namespace iterator_detail
+ {
+ template <typename, typename NodePointer, typename Value> struct c_iterator:public boost::iterator <std::forward_iterator_tag, Value, int>
+ {
+ friend bool operator== (c_iterator, c_iterator)
+ {
+ }
+ };
+ }
+ namespace detail
+ {
+ template <typename ValueType>
+ struct value_base
+ {
+ typedef ValueType value_type;
+ value_type value ()
+ {
+ }
+ };
+ template <typename Types>
+ struct table:boost::unordered::detail::buckets <typename Types::allocator, typename Types::bucket, typename Types::key_equal>
+ {
+ typedef typename Types::value_type value_type;
+ typedef boost::unordered::detail::buckets <typename Types::allocator, typename Types::bucket, typename Types::node> buckets;
+ typedef typename buckets::node_pointer node_pointer;
+ typedef typename buckets::const_node_pointer const_node_pointer;
+ typedef boost::unordered::iterator_detail::c_iterator <const_node_pointer, node_pointer, value_type> c_iterator;
+ unsigned max_size ()
+ {
+ }
+ };
+ template <typename> struct table_impl;
+ template <typename T>
+ struct ptr_node : boost::unordered::detail::value_base <T>, boost::unordered::detail::ptr_bucket
+ {
+ boost::unordered::detail::ptr_bucket bucket_base;
+ unsigned hash_;
+ ptr_node () : bucket_base (), hash_ ()
+ {
+ }
+ };
+ template <typename A, typename T, typename, typename> struct pick_node2
+ {
+ };
+ template <typename A, typename T> struct pick_node2 <A, T, boost::unordered::detail::ptr_node <T> *, boost::unordered::detail::ptr_bucket *>
+ {
+ typedef boost::unordered::detail::ptr_node <T> node;
+ typedef boost::unordered::detail::ptr_bucket bucket;
+ };
+ template <typename A, typename T> struct pick_node
+ {
+ typedef boost::unordered::detail::allocator_traits <typename boost::unordered::detail::rebind_wrap <A, boost::unordered::detail::ptr_node <T>>::type> tentative_node_traits;
+ typedef boost::unordered::detail::allocator_traits <typename boost::unordered::detail::rebind_wrap <A, boost::unordered::detail::ptr_bucket>::type> tentative_bucket_traits;
+ typedef pick_node2 <A, T, typename tentative_node_traits::pointer, typename tentative_bucket_traits::pointer> pick;
+ typedef typename pick::node node;
+ typedef typename pick::bucket bucket;
+ };
+ template <typename A, typename T, typename H, typename P>
+ struct set
+ {
+ typedef boost::unordered::detail::set <A, T, H, P> types;
+ typedef T value_type;
+ typedef P key_equal;
+ typedef typename boost::unordered::detail::rebind_wrap <A, value_type>::type allocator;
+ typedef boost::unordered::detail::pick_node <allocator, value_type> pick;
+ typedef typename pick::node node;
+ typedef typename pick::bucket bucket;
+ typedef boost::unordered::detail::table_impl <types> table;
+ };
+ template <typename Types>
+ struct table_impl : boost::unordered::detail::table <Types>
+ {
+ typedef boost::unordered::detail::table <Types> table;
+ typedef typename table::node_constructor node_constructor;
+ table_impl () : table ()
+ {
+ }
+ template <class InputIt>
+ void insert_range_impl2 (node_constructor, InputIt)
+ {
+ }
+ };
+ }
+ template <class T, class H, class P, class A>
+ struct unordered_set
+ {
+ typedef T key_type;
+ typedef T value_type;
+ typedef boost::unordered::detail::set <A, T, H, P> types;
+ typedef typename types::table table;
+ typedef typename table::c_iterator const_iterator;
+ typedef typename table::c_iterator iterator;
+ table table_;
+ bool empty ()
+ {
+ return table_.size_;
+ }
+ iterator end ()
+ {
+ }
+ std::pair <iterator, bool> insert (value_type)
+ {
+ }
+ unsigned erase (const key_type &);
+ const_iterator find (const key_type);
+ };
+ template <class T, class H, class P, class A>
+ unsigned unordered_set <T, H, P, A>::erase (const key_type &)
+ {
+ }
+ }
+}
+using namespace::rtl;
+namespace skeletonmaker
+{
+ void
+ checkDefaultInterfaces (boost::unordered_set <OString, OStringHash> interfaces,
+ boost::unordered_set <OStringHash> services, OString)
+ {
+ if (services.empty ())
+ interfaces.erase ("com.sun.star.lang.XServiceInfo");
+ else if (interfaces.find ("com.sun.star.lang.XServiceInfo") == interfaces.end ())
+ interfaces.insert ("com.sun.star.lang.XServiceInfo");
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53693.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53693.C
new file mode 100644
index 000000000..b67a484b9
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53693.C
@@ -0,0 +1,21 @@
+// { dg-do compile }
+
+void
+filter_scanlines (void *src_buffer, void *dst_buffer, int dst_pitch, int width)
+{
+ int x;
+ unsigned short *src, *dst_a, *dst_b;
+
+ src = (unsigned short *) src_buffer;
+ dst_a = (unsigned short *) dst_buffer;
+ dst_b = ((unsigned short *) dst_buffer) + (dst_pitch >> 1);
+
+ for (x = 0; x < width; x++)
+ {
+ unsigned char gs, gh;
+ gs = src[x];
+ gh = gs + (gs >> 1);
+ dst_a[x] = (gh << 5) | (gh);
+ dst_b[x] = ((gs - gh) << 5) | (gs - gh);
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53752.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53752.C
new file mode 100644
index 000000000..fd6c68766
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53752.C
@@ -0,0 +1,156 @@
+// { dg-do compile }
+// { dg-options "-g" }
+
+typedef unsigned int uint32_t;
+typedef unsigned long int uint64_t;
+namespace mpl_ {
+ template< typename T, T N > struct integral_c {
+ static const T value = N;
+ };
+}
+namespace mpl {
+ using namespace mpl_;
+};
+template <class T, T val> struct integral_constant : public mpl::integral_c<T, val> {
+ typedef integral_constant<bool,false> type;
+};
+template< typename T > struct is_lvalue_reference : public ::integral_constant<bool,false> {
+};
+template< typename T > struct is_rvalue_reference : public ::integral_constant<bool,false> {
+};
+namespace type_traits {
+ template <bool b1, bool b2, bool b3 = false, bool b4 = false, bool b5 = false, bool b6 = false, bool b7 = false> struct ice_or;
+ template <> struct ice_or<false, false, false, false, false, false, false> {
+ static const bool value = false;
+ };
+}
+template <typename T> struct is_reference_impl {
+ static const bool value = (::type_traits::ice_or< ::is_lvalue_reference<T>::value, ::is_rvalue_reference<T>::value >::value) ;
+};
+template< typename T > struct is_reference : public ::integral_constant<bool,::is_reference_impl<T>::value> {
+};
+struct na {
+};
+namespace mpl {
+ template< bool C , typename T1 , typename T2 > struct if_c {
+ typedef T2 type;
+ };
+ template< typename T1 = na , typename T2 = na , typename T3 = na > struct if_ {
+ typedef if_c< static_cast<bool>(T1::value) , T2 , T3 > almost_type_;
+ typedef typename almost_type_::type type;
+ };
+}
+namespace optional_detail {
+ template<class T> struct types_when_isnt_ref {
+ typedef T & reference_type ;
+ }
+ ;
+ template<class T> struct types_when_is_ref {
+ }
+ ;
+ struct optional_tag {
+ }
+ ;
+ template<class T> class optional_base : public optional_tag {
+ typedef types_when_isnt_ref<T> types_when_not_ref ;
+ typedef types_when_is_ref<T> types_when_ref ;
+ protected :
+ typedef typename is_reference<T>::type is_reference_predicate ;
+ typedef typename mpl::if_<is_reference_predicate,types_when_ref,types_when_not_ref>::type types ;
+ typedef typename types::reference_type reference_type ;
+ }
+ ;
+}
+template<class T> class optional : public optional_detail::optional_base<T> {
+ typedef optional_detail::optional_base<T> base ;
+public :
+ typedef typename base::reference_type reference_type ;
+ reference_type operator *() {
+ }
+};
+namespace noncopyable_ {
+ class noncopyable {
+ };
+}
+typedef noncopyable_::noncopyable noncopyable;
+template<class T> class shared_ptr {
+public:
+ T * operator-> () const {
+ }
+};
+typedef uint64_t block_address;
+class transaction_manager : noncopyable {
+public:
+ typedef shared_ptr<transaction_manager> ptr;
+};
+template <typename ValueType> class NoOpRefCounter {
+};
+struct uint64_traits {
+};
+namespace btree_detail {
+ class shadow_spine : private noncopyable {
+ public:
+ shadow_spine(transaction_manager::ptr tm) : tm_(tm) {
+ }
+ transaction_manager::ptr tm_;
+ };
+}
+template <unsigned Levels, typename ValueTraits> class btree {
+public:
+ typedef shared_ptr<btree<Levels, ValueTraits> > ptr;
+ typedef uint64_t key[Levels];
+ typedef typename ValueTraits::value_type value_type;
+ typedef optional<value_type> maybe_value;
+ btree(typename transaction_manager::ptr tm, typename ValueTraits::ref_counter rc);
+ maybe_value lookup(key const &key) const;
+ void insert(key const &key, typename ValueTraits::value_type const &value);
+ template <typename ValueTraits2> bool insert_location(btree_detail::shadow_spine &spine, block_address block, uint64_t key, int *index);
+ typename transaction_manager::ptr tm_;
+ block_address root_;
+ typename ValueTraits::ref_counter rc_;
+};
+template <unsigned Levels, typename ValueTraits> void btree<Levels, ValueTraits>:: insert(key const &key, typename ValueTraits::value_type const &value) {
+ using namespace btree_detail;
+ block_address block = root_;
+ int index = 0;
+ shadow_spine spine(tm_);
+ for (unsigned level = 0;
+ level < Levels - 1;
+ ++level) {
+ bool need_insert = insert_location<uint64_traits>(spine, block, key[level], &index);
+ if (need_insert) {
+ btree<Levels - 1, ValueTraits> new_tree(tm_, rc_);
+ }
+ }
+}
+struct device_details_disk {
+}
+__attribute__ ((packed));
+struct device_details {
+};
+struct device_details_traits {
+ typedef device_details value_type;
+ typedef NoOpRefCounter<device_details> ref_counter;
+};
+typedef uint32_t thin_dev_t;
+typedef btree<1, device_details_traits> detail_tree;
+struct metadata {
+ typedef shared_ptr<metadata> ptr;
+ detail_tree::ptr details_;
+};
+class thin_pool;
+class thin {
+ void set_snapshot_time(uint32_t time);
+ thin_dev_t dev_;
+ thin_pool *pool_;
+};
+class thin_pool {
+public:
+ metadata::ptr md_;
+};
+void thin::set_snapshot_time(uint32_t time) {
+ uint64_t key[1] = {
+ dev_ };
+ optional<device_details> mdetail = pool_->md_->details_->lookup(key);
+ pool_->md_->details_->insert(key, *mdetail);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53970.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53970.C
new file mode 100644
index 000000000..53cbc1f85
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr53970.C
@@ -0,0 +1,17 @@
+// { dg-do run }
+
+#pragma pack(1)
+struct mystruct {
+ char c;
+ unsigned long l[1024];
+};
+#pragma pack()
+
+int main(int argc, char **argv)
+{
+ mystruct *a = new mystruct;
+ unsigned long i;
+ for (i = 0; i < 1024; ++i)
+ a->l[i] = 0xdeadbeaf;
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr54563.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr54563.C
new file mode 100644
index 000000000..2980320f6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr54563.C
@@ -0,0 +1,14 @@
+// PR tree-optimization/54563
+// { dg-do compile }
+
+extern "C" float powf (float, float);
+struct S { ~S (); };
+double bar ();
+double x;
+
+void
+foo ()
+{
+ S s;
+ x = powf (bar (), 2.);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr54647.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr54647.C
new file mode 100644
index 000000000..2177ecd67
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr54647.C
@@ -0,0 +1,25 @@
+// { dg-do compile }
+
+class A
+{
+};
+template <class type> struct D:A
+{
+ type & operator[](int);
+};
+struct B
+{
+ typedef D <int *>Row;
+ struct C
+ {
+ Row *row;
+ };
+};
+B::C a;
+B::Row & b = *a.row;
+void
+fn1 ()
+{
+ while (1)
+ b[0] = b[0] ? (int *) -1 : 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr54684.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr54684.C
new file mode 100644
index 000000000..4934011e4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr54684.C
@@ -0,0 +1,63 @@
+// { dg-do compile }
+// { dg-options "-fno-short-enums" }
+
+typedef union tree_node *tree;
+typedef union gimple_statement_d *gimple;
+struct vec_prefix { unsigned num_; };
+template<typename T> struct vec_t {
+ unsigned length (void) const;
+ T &operator[] (unsigned);
+ vec_prefix prefix_;
+ T vec_[1];
+};
+template<typename T> inline unsigned vec_t<T>::length (void) const {
+ return prefix_.num_;
+}
+template<typename T> T & vec_t<T>::operator[] (unsigned ix) {
+ ((void)(__builtin_expect(!(ix < prefix_.num_), 0) ? __builtin_unreachable(), 0 : 0));
+ return vec_[ix];
+}
+enum tree_code { PARM_DECL };
+struct tree_base {
+ enum tree_code code : 16;
+ unsigned default_def_flag : 1;
+};
+union tree_node {
+ struct tree_base base;
+};
+struct ipa_param_descriptor {
+ tree decl;
+ unsigned used : 1;
+};
+typedef struct ipa_param_descriptor ipa_param_descriptor_t;
+struct ipa_node_params {
+ vec_t<ipa_param_descriptor_t> *descriptors;
+};
+static inline int ipa_get_param_count (struct ipa_node_params *info) {
+ return ((info->descriptors) ? (info->descriptors)->length () : 0);
+}
+static inline tree ipa_get_param (struct ipa_node_params *info, int i) {
+ return ((*(info->descriptors))[i]).decl;
+}
+static inline void ipa_set_param_used (struct ipa_node_params *info, int i, bool val) {
+ ((*(info->descriptors))[i]).used = val;
+}
+int ipa_get_param_decl_index (struct ipa_node_params *info, tree ptree)
+{
+ int i, count;
+ count = ipa_get_param_count (info);
+ for (i = 0; i < count; i++)
+ if (ipa_get_param (info, i) == ptree) return i;
+ return -1;
+}
+bool visit_ref_for_mod_analysis (gimple stmt __attribute__ ((__unused__)),
+ tree op, void *data)
+{
+ struct ipa_node_params *info = (struct ipa_node_params *) data;
+ if (op && ((enum tree_code) (op)->base.code) == PARM_DECL)
+ {
+ int index = ipa_get_param_decl_index (info, op);
+ ((void)(__builtin_expect(!(index >= 0), 0) ? __builtin_unreachable(), 0 : 0));
+ ipa_set_param_used (info, index, true);
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr54735.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr54735.C
new file mode 100644
index 000000000..0604ec517
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr54735.C
@@ -0,0 +1,179 @@
+// { dg-do compile }
+
+class Gmpfr
+{};
+class M : Gmpfr
+{
+public:
+ Gmpfr infconst;
+ M(int);
+};
+template<typename>struct A;
+template<typename, int, int, int = 0 ? : 0, int = 0, int = 0>class N;
+template<typename>class O;
+template<typename>struct B;
+struct C
+{
+ enum
+ { value };
+};
+class D
+{
+public:
+ enum
+ { ret };
+};
+struct F
+{
+ enum
+ { ret = 0 ? : 0 };
+};
+template<typename Derived>struct G
+{
+ typedef O<Derived>type;
+};
+struct H
+{
+ void operator * ();
+};
+struct I
+{
+ enum
+ { RequireInitialization = C::value ? : 0, ReadCost };
+};
+template<typename Derived>struct J
+{
+ enum
+ { ret = A<Derived>::InnerStrideAtCompileTime };
+};
+template<typename Derived>struct K
+{
+ enum
+ { ret = A<Derived>::OuterStrideAtCompileTime };
+};
+template<typename Derived>class P : H
+{
+public:
+ using H::operator *;
+ typedef typename A<Derived>::Scalar Scalar;
+ enum
+ { RowsAtCompileTime =
+ A<Derived>::RowsAtCompileTime, ColsAtCompileTime =
+ A<Derived>::ColsAtCompileTime, SizeAtCompileTime =
+ F::ret, MaxRowsAtCompileTime =
+ A<Derived>::MaxRowsAtCompileTime, MaxColsAtCompileTime =
+ A<Derived>::MaxColsAtCompileTime, MaxSizeAtCompileTime =
+ F::ret, Flags =
+ A<Derived>::Flags ? : 0 ? : 0, CoeffReadCost =
+ A<Derived>::CoeffReadCost, InnerStrideAtCompileTime =
+ J<Derived>::ret, OuterStrideAtCompileTime = K<Derived>::ret };
+ B<Derived> operator << (const Scalar&);
+};
+
+template<typename Derived>class O : public P<Derived>
+{};
+
+template<int _Cols>class L
+{
+public:
+
+ int cols()
+ {
+ return _Cols;
+ }
+};
+template<typename Derived>class Q : public G<Derived>::type
+{
+public:
+ typedef typename G<Derived>::type Base;
+ typedef typename A<Derived>::Index Index;
+ typedef typename A<Derived>::Scalar Scalar;
+ L<Base::ColsAtCompileTime> m_storage;
+ Index cols()
+ {
+ return m_storage.cols();
+ }
+
+ Scalar& coeffRef(Index,
+ Index);
+};
+
+template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows,
+ int _MaxCols>struct A<N<_Scalar, _Rows, _Cols, _Options, _MaxRows,
+ _MaxCols> >
+{
+ typedef _Scalar Scalar;
+ typedef int Index;
+ enum
+ { RowsAtCompileTime, ColsAtCompileTime =
+ _Cols, MaxRowsAtCompileTime, MaxColsAtCompileTime, Flags =
+ D::ret, CoeffReadCost =
+ I::ReadCost, InnerStrideAtCompileTime, OuterStrideAtCompileTime =
+ 0 ? : 0 };
+};
+template<typename _Scalar, int, int _Cols, int, int,
+ int>class N : public Q<N<_Scalar, 0, _Cols> >
+{
+public:
+ Q<N> Base;
+ template<typename T0, typename T1>N(const T0&,
+ const T1&);
+};
+void
+__assert_fail(int)
+throw() __attribute__((__noreturn__));
+template<typename XprType>struct B
+{
+ typedef typename XprType::Scalar Scalar;
+ typedef typename XprType::Index Index;
+ B(XprType & p1, const Scalar &) : m_xpr(p1), m_col(),
+ m_currentBlockRows(1)
+ {} B& operator, (const Scalar&)
+ {
+ Index a;
+
+ if (m_col == m_xpr.cols())
+ {
+ m_col = 0;
+ m_currentBlockRows = 1;
+ a && "Too " ? static_cast<void>(0) : __assert_fail(0);
+ }
+ m_col < m_xpr.cols()
+ && "Too " ? static_cast<void>(0) : __assert_fail(1);
+ m_currentBlockRows ? static_cast<void>(0) : __assert_fail(4);
+ m_xpr.coeffRef(0, m_col++) = 0;
+ return *this;
+ }
+ ~B()
+ {
+ 1 + m_currentBlockRows && m_col
+ && "Too " ? static_cast<void>(0) : __assert_fail(0);
+ }
+
+ XprType& m_xpr;
+ Index m_col;
+ Index m_currentBlockRows;
+};
+
+template<typename Derived>B<Derived>P<
+ Derived >::operator << (const Scalar&)
+{
+ return B<Derived>(*static_cast<Derived *>(this), 0);
+}
+
+template<class NT, int s>void
+ check_()
+{
+ N<NT, 0, s>m(0, 0);
+ m << 0, 0, 0, 0;
+}
+
+template<class NT>void check()
+{
+ check_<NT, 3>();
+}
+
+int main()
+{
+ check<M>();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr54838.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr54838.C
new file mode 100644
index 000000000..6d34d57a4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr54838.C
@@ -0,0 +1,102 @@
+// { dg-do compile }
+// { dg-options "-ftracer -fno-tree-dce -fno-tree-sra" }
+
+struct bidirectional_iterator_tag
+{};
+struct random_access_iterator_tag:bidirectional_iterator_tag
+{};
+template < typename _Category, typename, typename _Distance, typename > struct iterator
+{
+ typedef _Distance difference_type;
+};
+template < typename _Iterator > struct iterator_traits
+{
+ typedef typename _Iterator::difference_type difference_type;
+};
+template < typename _Tp > struct iterator_traits <_Tp * >
+{
+ typedef random_access_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef int difference_type;
+ typedef _Tp reference;
+};
+template < typename _Iterator > class reverse_iterator:
+ public
+ iterator < typename iterator_traits < _Iterator >::iterator_category,
+ typename iterator_traits < _Iterator >::value_type,
+ typename iterator_traits < _Iterator >::difference_type, typename iterator_traits < _Iterator >::reference >
+{
+ _Iterator current;
+public:
+ typedef _Iterator iterator_type;
+ reverse_iterator (const reverse_iterator & __x):current (__x.current)
+ {}
+ iterator_type base ()
+ {
+ return current;
+ }
+ reverse_iterator operator++ ()
+ {
+ --current;
+ }
+};
+template
+<
+typename
+_Iterator
+>
+bool
+operator
+==
+(reverse_iterator < _Iterator > __x, reverse_iterator < _Iterator > __y)
+{
+ return __x.base () == __y.base ();
+}
+
+template
+<
+typename
+_Iterator
+>
+typename
+reverse_iterator
+<
+_Iterator
+>::difference_type
+operator
+- (reverse_iterator < _Iterator >, reverse_iterator < _Iterator >)
+{}
+template
+<
+typename
+_RandomAccessIterator
+>
+_RandomAccessIterator
+__find
+(_RandomAccessIterator
+ __first, _RandomAccessIterator __last)
+{
+ typename
+ iterator_traits
+ <
+ _RandomAccessIterator
+ >::difference_type __trip_count (__last - __first);
+ for (; __trip_count; --__trip_count)
+ ++__first;
+ return __last;
+}
+typedef reverse_iterator < int* > _ForwardIterator1;
+_ForwardIterator1
+search
+(_ForwardIterator1
+ __first1,
+ _ForwardIterator1
+ __last1)
+{
+ for (;;)
+ {
+ __first1 = __find (__first1, __last1);
+ if (__first1 == __last1)
+ return __last1;
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr54902.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr54902.C
new file mode 100644
index 000000000..790ffe5fc
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr54902.C
@@ -0,0 +1,131 @@
+// { dg-do compile }
+
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Iterator> struct iterator_traits {
+ };
+ template<typename _Tp> struct iterator_traits<_Tp*> {
+ typedef _Tp& reference;
+ };
+}
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
+ using std::iterator_traits;
+ template<typename _Iterator, typename _Container> class __normal_iterator {
+ _Iterator _M_current;
+ typedef iterator_traits<_Iterator> __traits_type;
+ public:
+ typedef typename __traits_type::reference reference;
+ explicit __normal_iterator(const _Iterator& __i) : _M_current(__i) {
+ }
+ reference operator*() const {
+ return *_M_current;
+ }
+ __normal_iterator operator++(int) {
+ return __normal_iterator(_M_current++);
+ }
+ };
+ template<typename _Tp> class new_allocator {
+ public:
+ typedef _Tp* pointer;
+ template<typename _Tp1> struct rebind {
+ typedef new_allocator<_Tp1> other;
+ };
+ };
+}
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Tp> class allocator: public __gnu_cxx::new_allocator<_Tp> {
+ };
+}
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Alloc> struct __alloc_traits {
+ typedef typename _Alloc::pointer pointer;
+ template<typename _Tp> struct rebind {
+ typedef typename _Alloc::template rebind<_Tp>::other other;
+ };
+ };
+}
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Tp, typename _Alloc> struct _Vector_base {
+ typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template rebind<_Tp>::other _Tp_alloc_type;
+ typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type>::pointer pointer;
+ struct _Vector_impl : public _Tp_alloc_type {
+ pointer _M_start;
+ };
+ _Vector_impl _M_impl;
+ };
+ template<typename _Tp, typename _Alloc = std::allocator<_Tp> > class vector : protected _Vector_base<_Tp, _Alloc> {
+ typedef _Vector_base<_Tp, _Alloc> _Base;
+ public:
+ typedef typename _Base::pointer pointer;
+ typedef __gnu_cxx::__normal_iterator<pointer, vector> iterator;
+ iterator begin() {
+ return iterator(this->_M_impl._M_start);
+ }
+ };
+}
+class myServer {
+ static std::vector<myServer *> server_list;
+ class Callback;
+ class myFolder *currentFolder;
+ static bool eventloop(Callback *);
+};
+extern "C" {
+ typedef unsigned int uint32_t;
+ typedef uint32_t unicode_char;
+ extern int strcmp (__const char *__s1, __const char *__s2) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+};
+class CursesObj {
+};
+class Curses : public CursesObj {
+public:
+ class Key {
+ public:
+ unicode_char ukey;
+ const char *keycode;
+ Key(unicode_char ch) : ukey(ch), keycode(0) {
+ }
+ bool plain() const {
+ }
+ bool nokey() const {
+ }
+ bool operator==(const Key &k) const {
+ return strcmp(keycode ? keycode:
+ "", k.keycode ? k.keycode:
+ "") == 0 && ukey == k.ukey;
+ }
+ };
+ static bool processKey(const Key &k);
+};
+class CursesContainer : public Curses {
+};
+class myFolder {
+public:
+ void checkExpunged();
+};
+class Typeahead {
+public:
+ static Typeahead *typeahead;
+ bool empty() {
+ }
+ Curses::Key pop() {
+ }
+};
+class CursesScreen : public CursesContainer {
+public:
+ Key getKey();
+};
+using namespace std;
+extern CursesScreen *cursesScreen;
+bool myServer::eventloop(myServer::Callback *callback) {
+ Curses::Key k1= (callback == __null && !Typeahead::typeahead->empty() ? Typeahead::typeahead->pop() : cursesScreen->getKey());
+ if (callback == __null || (k1.plain() && k1.ukey == '\x03')) {
+ if (!k1.nokey()) {
+ bool rc=Curses::processKey(k1);
+ if (rc) { while (k1.plain() && k1 == '\x03' && !Typeahead::typeahead->empty()) Typeahead::typeahead->pop(); }
+ }
+ }
+ vector<myServer *>::iterator b=server_list.begin();
+ while (1) {
+ myServer *p= *b++;
+ if (p->currentFolder) p->currentFolder->checkExpunged();
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr55260-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr55260-1.C
new file mode 100644
index 000000000..dee5b6035
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr55260-1.C
@@ -0,0 +1,24 @@
+/* { dg-do compile { target c++11 } } */
+/* { dg-options "-fno-inline" } */
+/* { dg-add-options bind_pic_locally } */
+
+ struct B
+ {
+ constexpr B ():
+ bp ()
+ {}
+ ~B ()
+ {
+ if (bp)
+ bp->f ();
+ }
+ void f ();
+ B *bp;
+ };
+struct A { B b;
+};
+
+void foo ()
+{
+ A a;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr55260-2.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr55260-2.C
new file mode 100644
index 000000000..43ed1e775
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr55260-2.C
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-add-options bind_pic_locally } */
+
+struct B
+{
+ virtual void test_suite_finish ();
+};
+void
+fn1 (B & p2)
+{
+ fn1 (p2);
+ B & a = p2;
+ a.test_suite_finish ();
+ B b;
+ fn1 (b);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr55355.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr55355.C
new file mode 100644
index 000000000..6d8f8b6be
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr55355.C
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+
+struct A
+{
+ void funcA(void);
+};
+
+struct B {};
+
+struct C
+{
+ void funcC(void) { a_mp->funcA(); }
+
+ char buf_ma[268435456];
+ A *a_mp;
+ B b_m;
+};
+
+void
+func(C *c_p)
+{
+ c_p->funcC();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr55740.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr55740.C
new file mode 100644
index 000000000..cdd842543
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr55740.C
@@ -0,0 +1,19 @@
+// { dg-do compile }
+
+static bool st_IsPathDelimiter( char c ) { return c == '/'; }
+bool IsValidPath( char const * filename )
+{
+ if ( !filename || filename[0] == 0 )
+ return false;
+ char const * run = filename;
+ while ( run && *run )
+ {
+ if ( run[0] == '.' )
+ if ( run[1] != '.' || ( !st_IsPathDelimiter( run[2] ) && run[2] != 0 ) )
+ return false;
+ while ( *run && !st_IsPathDelimiter( *run ) )
+ ++run;
+ if ( *run )
+ ++run;
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr55789.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr55789.C
new file mode 100644
index 000000000..a5a31a4f5
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr55789.C
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-fno-guess-branch-probability -fno-tree-forwprop --param max-early-inliner-iterations=10 --param=early-inlining-insns=176" } */
+
+template < typename T > struct intrusive_ptr
+{
+ ~intrusive_ptr ()
+ {
+ delete px;
+ }
+ T *px;
+};
+
+struct section_info
+{
+ intrusive_ptr < section_info > parent;
+};
+
+struct file_info
+{
+ intrusive_ptr < file_info > parent;
+ intrusive_ptr < section_info > switched_section;
+};
+
+
+void
+start_file (void)
+{
+ intrusive_ptr < file_info > parent;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr55875.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr55875.C
new file mode 100644
index 000000000..faadf88f4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr55875.C
@@ -0,0 +1,55 @@
+// { dg-do run }
+
+struct A
+{
+ short int a1;
+ unsigned char a2;
+ unsigned int a3;
+};
+
+struct B
+{
+ unsigned short b1;
+ const A *b2;
+};
+
+B b;
+
+__attribute__((noinline, noclone))
+int foo (unsigned x)
+{
+ __asm volatile ("" : "+r" (x) : : "memory");
+ return x;
+}
+
+inline void
+bar (const int &)
+{
+}
+
+__attribute__((noinline)) void
+baz ()
+{
+ const A *a = b.b2;
+ unsigned int i;
+ unsigned short n = b.b1;
+ for (i = 0; i < n; ++i)
+ if (a[i].a1 == 11)
+ {
+ if (i > 0 && (a[i - 1].a2 & 1))
+ continue;
+ bar (foo (2));
+ return;
+ }
+}
+
+int
+main ()
+{
+ A a[4] = { { 10, 0, 0 }, { 11, 1, 0 }, { 11, 1, 0 }, { 11, 1, 0 } };
+ b.b1 = 4;
+ b.b2 = a;
+ baz ();
+ return 0;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56029.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56029.C
new file mode 100644
index 000000000..ca4a82a00
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56029.C
@@ -0,0 +1,126 @@
+// PR tree-optimization/56029
+// { dg-do compile }
+
+template <class T>
+struct DefaultDeleter
+{
+ void operator () (T * ptr) { delete ptr; }
+};
+template <class T, class D>
+struct scoped_ptr_impl
+{
+ scoped_ptr_impl (T * p):data_ (p) {}
+ template <typename U, typename V>
+ scoped_ptr_impl (scoped_ptr_impl <U, V> *other):data_ (other->release (), get_deleter ()) {}
+ ~scoped_ptr_impl () { static_cast <D> (data_) (data_.ptr); }
+ void reset (T * p) { data_.ptr = p; }
+ D get_deleter () {}
+ T *release () { data_.ptr = __null; }
+ struct Data
+ : D
+ {
+ Data (T *) : ptr () {}
+ Data (T *, D) : D (), ptr () {}
+ T *ptr;
+ };
+ Data data_;
+};
+template <class T, class D = DefaultDeleter <T> >
+struct scoped_ptr
+{
+ struct RValue
+ {
+ RValue (scoped_ptr * object):object (object) {}
+ scoped_ptr *object;
+ };
+ scoped_ptr Pass () { return scoped_ptr ((this)); }
+ typedef T element_type;
+ typedef D deleter_type;
+ scoped_ptr () : impl_ (__null) {}
+ scoped_ptr (RValue rvalue) : impl_ (&rvalue.object->impl_) {}
+ void reset (element_type * p) { impl_.reset (p); }
+ scoped_ptr_impl <element_type, deleter_type> impl_;
+};
+template <typename>
+struct Callback;
+struct ClientSocketFactory;
+struct DatagramClientSocket;
+struct DnsSocketPool
+{
+ scoped_ptr <DatagramClientSocket> CreateConnectedSocket ();
+ ClientSocketFactory *socket_factory_;
+};
+int RandInt (int, int);
+struct BindStateBase {};
+struct CallbackBase
+{
+ CallbackBase (BindStateBase *);
+ ~CallbackBase ();
+};
+template <typename, typename, typename>
+struct BindState;
+template <typename R, typename A1, typename A2>
+struct Callback <R (A1, A2)> : CallbackBase
+{
+ template <typename Runnable, typename BindRunType, typename BoundArgsType>
+ Callback (BindState <Runnable, BindRunType, BoundArgsType> *bind_state) : CallbackBase (bind_state) {}
+};
+typedef Callback <int (int, int)>
+RandIntCallback;
+struct ClientSocketFactory
+{
+ virtual DatagramClientSocket *CreateDatagramClientSocket (RandIntCallback) = 0;
+};
+template <typename>
+struct RunnableAdapter;
+template <typename R, typename A1, typename A2>
+struct RunnableAdapter <R (*) (A1, A2)>
+{
+ typedef R (RunType) (A1, A2);
+};
+template <typename T>
+struct FunctorTraits
+{
+ typedef RunnableAdapter <T> RunnableType;
+ typedef typename RunnableType::RunType RunType;
+};
+template <typename T>
+typename FunctorTraits <T>::RunnableType MakeRunnable (T)
+{
+}
+template <int, typename, typename>
+struct Invoker;
+template <typename StorageType, typename R, typename X1, typename X2>
+struct Invoker <0, StorageType, R (X1, X2)>
+{
+ typedef R (UnboundRunType) (X1, X2);
+};
+template <typename Runnable, typename RunType>
+struct BindState <Runnable, RunType, void ()> : BindStateBase
+{
+ typedef Runnable RunnableType;
+ typedef Invoker <0, BindState, RunType> InvokerType;
+ typedef typename InvokerType::UnboundRunType UnboundRunType;
+ BindState (Runnable):runnable_ () {}
+ RunnableType runnable_;
+};
+template <typename Functor>
+Callback <typename BindState <typename FunctorTraits <Functor>::RunnableType, typename FunctorTraits <Functor>::RunType, void ()>::UnboundRunType>
+Bind (Functor functor)
+{
+ typedef typename FunctorTraits <Functor>::RunnableType RunnableType;
+ typedef typename FunctorTraits <Functor>::RunType RunType;
+ typedef BindState <RunnableType, RunType, void ()> BindState;
+ Callback <typename BindState::UnboundRunType> (new BindState (MakeRunnable (functor)));
+}
+struct DatagramClientSocket
+{
+ virtual ~ DatagramClientSocket ();
+};
+scoped_ptr <DatagramClientSocket>
+DnsSocketPool::CreateConnectedSocket ()
+{
+ scoped_ptr <DatagramClientSocket> socket;
+ socket.reset (socket_factory_->CreateDatagramClientSocket (Bind (RandInt)));
+ socket.Pass ();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56302.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56302.C
new file mode 100644
index 000000000..08d47982a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56302.C
@@ -0,0 +1,41 @@
+// PR c++/56302
+// { dg-do compile }
+
+typedef __SIZE_TYPE__ size_t;
+# define STAP_SDT_ARG_CONSTRAINT nor
+# define _SDT_STRINGIFY(x) #x
+# define _SDT_ARG_CONSTRAINT_STRING(x) _SDT_STRINGIFY(x)
+# define _SDT_ARG(n, x) \
+ [_SDT_S##n] "n" ((_SDT_ARGSIGNED (x) ? 1 : -1) * (int) _SDT_ARGSIZE (x)), \
+ [_SDT_A##n] _SDT_ARG_CONSTRAINT_STRING (STAP_SDT_ARG_CONSTRAINT) (_SDT_ARGVAL (x))
+#define _SDT_ARGARRAY(x) (__builtin_classify_type (x) == 14 \
+ || __builtin_classify_type (x) == 5)
+# define _SDT_ARGSIGNED(x) (!_SDT_ARGARRAY (x) \
+ && __sdt_type<__typeof (x)>::__sdt_signed)
+# define _SDT_ARGSIZE(x) (_SDT_ARGARRAY (x) \
+ ? sizeof (void *) : sizeof (x))
+# define _SDT_ARGVAL(x) (x)
+template<typename __sdt_T>
+struct __sdt_type
+{
+ static const bool __sdt_signed = false;
+};
+#define __SDT_ALWAYS_SIGNED(T) \
+template<> struct __sdt_type<T> { static const bool __sdt_signed = true; };
+__SDT_ALWAYS_SIGNED(signed char)
+__SDT_ALWAYS_SIGNED(short)
+__SDT_ALWAYS_SIGNED(int)
+__SDT_ALWAYS_SIGNED(long)
+__SDT_ALWAYS_SIGNED(long long)
+template<typename __sdt_E>
+struct __sdt_type<__sdt_E[]> : public __sdt_type<__sdt_E *> {};
+template<typename __sdt_E, size_t __sdt_N>
+struct __sdt_type<__sdt_E[__sdt_N]> : public __sdt_type<__sdt_E *> {};
+
+struct S { char p[8]; };
+
+void
+foo (const S &str)
+{
+ __asm__ __volatile__ ("" : : _SDT_ARG (0, &str));
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56398.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56398.C
new file mode 100644
index 000000000..5b7bcf279
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56398.C
@@ -0,0 +1,22 @@
+// { dg-do compile }
+// { dg-options "-g" }
+
+namespace
+{
+#0 "/usr/include/c/4.8/bits/postypes.h" 3
+}
+
+vtkpow (int b)
+{
+ int a1;
+ int b1;
+ int c;
+ while (b1)
+ {
+ while (b)
+ b1 = 0;
+ b1 = b1 - 1;
+ c = c * a1;
+ }
+ return c;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56403.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56403.C
new file mode 100644
index 000000000..27b6eeb88
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56403.C
@@ -0,0 +1,12 @@
+// PR c++/56403
+// { dg-do compile }
+
+#include <stdarg.h>
+
+struct S { va_list err_args; };
+
+void *
+foo ()
+{
+ return new S ();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56635.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56635.C
new file mode 100644
index 000000000..53d6bb96a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56635.C
@@ -0,0 +1,17 @@
+// PR tree-optimization/56635
+// { dg-do compile }
+
+struct A { _Complex double a; };
+
+void
+foo (A **x, A **y)
+{
+ A r;
+ if (__real__ x[0]->a)
+ {
+ r.a = y[0]->a / x[0]->a;
+ **x = r;
+ }
+ else
+ **x = **y;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56694.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56694.C
new file mode 100644
index 000000000..d3de05101
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56694.C
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-fopenmp" }
+// { dg-require-effective-target fopenmp }
+
+class GException {
+public:
+ class vector_mismatch {
+ public:
+ vector_mismatch(int size1, int size2);
+ };
+};
+class GVector{
+public:
+ GVector& operator+=(const GVector& v);
+ int m_num;
+ double* m_data;
+};
+inline GVector& GVector::operator+= (const GVector& v)
+{
+ if (m_num != v.m_num)
+ throw GException::vector_mismatch(m_num, v.m_num);
+ for (int i = 0; i < m_num; ++i) m_data[i] += v.m_data[i];
+};
+void eval(GVector* m_gradient, GVector* vect_cpy_grad, int n)
+{
+#pragma omp sections
+ {
+ for (int i = 0; i < n; ++i)
+ *m_gradient += vect_cpy_grad[i];
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56768.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56768.C
new file mode 100644
index 000000000..93d292a9f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56768.C
@@ -0,0 +1,40 @@
+// { dg-do compile { target c++11 } }
+
+struct Iter
+{
+ int& operator* ();
+ void operator++ ();
+};
+
+bool operator!= (Iter &, Iter &) { }
+
+struct Container
+{
+ Iter begin () const;
+ Iter end () const;
+};
+
+struct J
+{
+ virtual J *mutable_child ();
+};
+
+struct M
+{
+ M (const Container &);
+ J ns_;
+};
+namespace
+{
+ J MakeNamespace (const Container &src)
+ {
+ J a;
+ J *b = 0;
+ for (const int &c: src)
+ b = b ? b->mutable_child () : &a;
+ return a;
+ }
+}
+M::M (const Container &ns):ns_ (MakeNamespace (ns))
+{
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56817.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56817.C
new file mode 100644
index 000000000..35fc6f74f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56817.C
@@ -0,0 +1,38 @@
+// { dg-do compile }
+// { dg-options "--param max-unroll-times=32" }
+
+struct A {};
+A **q;
+struct B
+{
+ A **j;
+ B () { j = q; }
+ A *& operator[] (unsigned long x) { return j[x]; }
+};
+struct C
+{
+ C (int r) : v (), s (r) {}
+ A *& operator () (int i, int j) { return v[i * s + j]; }
+ B v;
+ int s;
+};
+struct D
+{
+ D ()
+ {
+ unsigned h = 2;
+ for (int i = 0; i < 1; ++i, h *= 2)
+ {
+ C w (h);
+ for (unsigned j = 0; j < h; ++j)
+ for (unsigned k = 0; k < h; ++k)
+ w (j, k) = new A;
+ }
+ }
+};
+void
+foo ()
+{
+ for (int i = 0; i < 3; i++)
+ A (), A (), D ();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56837.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56837.C
new file mode 100644
index 000000000..d00712280
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56837.C
@@ -0,0 +1,20 @@
+// { dg-do run }
+// { dg-options "-ftree-loop-distribute-patterns" }
+
+extern "C" void abort (void);
+extern "C" int memcmp (const void *, const void *, __SIZE_TYPE__);
+
+bool b1[8];
+bool b2[8] = { true, true, true, true, true, true, true, true };
+
+int main()
+{
+ unsigned int i;
+ for(i=0 ; i < 8; i++)
+ b1[i] = true;
+
+ if (memcmp (b1, b2, 8) != 0)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56854.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56854.C
new file mode 100644
index 000000000..fc7e30299
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr56854.C
@@ -0,0 +1,24 @@
+// PR tree-optimization/56854
+// { dg-do compile }
+
+inline void *
+operator new (__SIZE_TYPE__, void *p) throw ()
+{
+ return p;
+}
+
+struct A
+{
+ int a;
+ A () : a (0) {}
+ ~A () {}
+ A &operator= (const A &v) { this->~A (); new (this) A (v); return *this; }
+};
+A b[4], c[4];
+
+void
+foo ()
+{
+ for (int i = 0; i < 4; ++i)
+ c[i] = b[i];
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr57107.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr57107.C
new file mode 100644
index 000000000..516dec16f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr57107.C
@@ -0,0 +1,193 @@
+// { dg-do compile }
+
+typedef long unsigned int size_t;
+namespace std {
+}
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<class _Sp, class _Tp> struct __traitor {
+ enum {
+ __value = bool(_Sp::__value) || bool(_Tp::__value) };
+ };
+ template<typename _Tp> struct __is_integer {
+ enum {
+ __value = 0 };
+ };
+ template<typename _Tp> struct __is_floating {
+ enum {
+ __value = 0 };
+ };
+ template<typename _Tp> struct __is_pointer {
+ enum {
+ __value = 0 };
+ };
+ template<typename _Tp> struct __is_normal_iterator {
+ enum {
+ __value = 0 };
+ };
+ template<typename _Tp> struct __is_arithmetic : public __traitor<__is_integer<_Tp>, __is_floating<_Tp> > {
+ };
+ template<typename _Tp> struct __is_scalar : public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> > {
+ };
+}
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
+ template<bool, typename> struct __enable_if {
+ };
+ template<typename _Tp> struct __enable_if<true, _Tp> {
+ typedef _Tp __type;
+ };
+}
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Iterator> struct iterator_traits {
+ };
+ template<typename _Tp> struct iterator_traits<_Tp*> {
+ typedef _Tp value_type;
+ };
+ template<typename _Iterator, bool _HasBase> struct _Iter_base {
+ typedef _Iterator iterator_type;
+ };
+}
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
+}
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Iterator> struct _Niter_base : _Iter_base<_Iterator, __is_normal_iterator<_Iterator>::__value> {
+ };
+ template<typename _Iterator> inline typename _Niter_base<_Iterator>::iterator_type __niter_base(_Iterator __it) {
+ }
+ template<typename _OutputIterator, typename _Size, typename _Tp> inline typename __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, _OutputIterator>::__type __fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value) {
+ for (__decltype(__n + 0) __niter = __n;
+ __niter > 0;
+ --__niter, ++__first) *__first = __value;
+ }
+ template<typename _OI, typename _Size, typename _Tp> inline _OI fill_n(_OI __first, _Size __n, const _Tp& __value) {
+ return _OI(std::__fill_n_a(std::__niter_base(__first), __n, __value));
+ }
+}
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Tp> class new_allocator {
+ public:
+ typedef size_t size_type;
+ typedef _Tp* pointer;
+ ~new_allocator() throw() {
+ }
+ pointer allocate(size_type __n, const void* = 0) {
+ return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp)));
+ }
+ };
+}
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Tp> class allocator: public __gnu_cxx::new_allocator<_Tp> {
+ public:
+ template<typename _Tp1> struct rebind {
+ typedef allocator<_Tp1> other;
+ };
+ };
+}
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Alloc> struct __alloc_traits {
+ typedef typename _Alloc::pointer pointer;
+ template<typename _Tp> struct rebind {
+ typedef typename _Alloc::template rebind<_Tp>::other other;
+ };
+ };
+}
+class QString {
+public:
+ bool isEmpty() const;
+};
+class QObject {
+};
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<bool _TrivialValueType> struct __uninitialized_fill_n {
+ template<typename _ForwardIterator, typename _Size, typename _Tp> static void __uninit_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) {
+ std::fill_n(__first, __n, __x);
+ }
+ };
+ template<typename _ForwardIterator, typename _Size, typename _Tp> inline void uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) {
+ typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
+ std::__uninitialized_fill_n<__is_trivial(_ValueType)>:: __uninit_fill_n(__first, __n, __x);
+ }
+ template<typename _ForwardIterator, typename _Size, typename _Tp, typename _Tp2> inline void __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n, const _Tp& __x, allocator<_Tp2>&) {
+ std::uninitialized_fill_n(__first, __n, __x);
+ }
+ template<typename _Tp, typename _Alloc> struct _Vector_base {
+ typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template rebind<_Tp>::other _Tp_alloc_type;
+ typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type>::pointer pointer;
+ struct _Vector_impl : public _Tp_alloc_type {
+ pointer _M_start;
+ pointer _M_finish;
+ pointer _M_end_of_storage;
+ _Vector_impl(_Tp_alloc_type const& __a) : _Tp_alloc_type(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0) {
+ }
+ };
+ typedef _Alloc allocator_type;
+ _Tp_alloc_type& _M_get_Tp_allocator() {
+ }
+ _Vector_base(size_t __n, const allocator_type& __a) : _M_impl(__a) {
+ _M_create_storage(__n);
+ }
+ _Vector_impl _M_impl;
+ pointer _M_allocate(size_t __n) {
+ return __n != 0 ? _M_impl.allocate(__n) : 0;
+ }
+ void _M_create_storage(size_t __n) {
+ this->_M_impl._M_start = this->_M_allocate(__n);
+ this->_M_impl._M_finish = this->_M_impl._M_start;
+ }
+ };
+ template<typename _Tp, typename _Alloc = std::allocator<_Tp> > class vector : protected _Vector_base<_Tp, _Alloc> {
+ typedef _Vector_base<_Tp, _Alloc> _Base;
+ typedef _Tp value_type;
+ typedef size_t size_type;
+ typedef _Alloc allocator_type;
+ using _Base::_M_get_Tp_allocator;
+ public:
+ explicit vector(size_type __n, const value_type& __value = value_type(), const allocator_type& __a = allocator_type()) : _Base(__n, __a) {
+ _M_fill_initialize(__n, __value);
+ }
+ void _M_fill_initialize(size_type __n, const value_type& __value) {
+ std::__uninitialized_fill_n_a(this->_M_impl._M_start, __n, __value, _M_get_Tp_allocator());
+ }
+ };
+};
+class QPaintDevice {
+public:
+ int width() const {
+ }
+ int height() const {
+ }
+};
+class QImage : public QPaintDevice {
+};
+extern "C" {
+ struct __jmp_buf_tag {
+ };
+ typedef struct __jmp_buf_tag jmp_buf[1];
+ extern int _setjmp (struct __jmp_buf_tag __env[1]) throw ();
+ extern void longjmp (struct __jmp_buf_tag __env[1], int __val) throw () __attribute__ ((__noreturn__));
+}
+typedef unsigned int png_uint_32;
+typedef void * png_voidp;
+typedef const char * png_const_charp;
+extern "C" {
+ typedef struct png_struct_def png_struct;
+ typedef png_struct * png_structp;
+ typedef void ( *png_error_ptr) (png_structp, png_const_charp);
+ typedef void ( *png_longjmp_ptr) (jmp_buf, int);
+ extern __attribute__((__malloc__)) png_structp ( png_create_write_struct) (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn) ;
+ extern jmp_buf* ( png_set_longjmp_fn) (png_structp png_ptr, png_longjmp_ptr longjmp_fn, size_t jmp_buf_size) ;
+}
+class PngWriter : public QObject {
+ const QImage *m_out_qimage;
+ QString m_fname;
+ bool writeQImageToPng();
+};
+bool PngWriter::writeQImageToPng() {
+ png_uint_32 width = m_out_qimage->width();
+ png_uint_32 height = m_out_qimage->height();
+ if ( !m_fname.isEmpty() ) {
+ std::vector<char> t(width * height * 4 + (width * height * 4) * 0.1);
+ }
+ png_structp png_ptr = png_create_write_struct ("1.5.13", __null, __null, __null);
+ if (_setjmp ((*png_set_longjmp_fn((png_ptr), longjmp, sizeof (jmp_buf))))) {
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr57140.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr57140.C
new file mode 100644
index 000000000..2ea2f9c4d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr57140.C
@@ -0,0 +1,186 @@
+// { dg-do compile }
+
+namespace std {
+ typedef long unsigned int size_t;
+ template<typename> class allocator;
+ template<class _CharT> struct char_traits;
+ template<typename _CharT, typename _Traits = char_traits<_CharT>, typename _Alloc = allocator<_CharT> > class basic_string;
+ typedef basic_string<char> string;
+}
+namespace std __attribute__ ((__visibility__ ("default"))) {
+}
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
+}
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Tp> class new_allocator {
+ };
+}
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Tp> class allocator: public __gnu_cxx::new_allocator<_Tp> {
+ public:
+ template<typename _Tp1> struct rebind {
+ typedef allocator<_Tp1> other;
+ };
+ };
+}
+namespace std {
+}
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
+}
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<typename _CharT, typename _Traits, typename _Alloc> class basic_string {
+ struct _Alloc_hider : _Alloc {
+ _Alloc_hider(_CharT* __dat, const _Alloc& __a) : _Alloc(__a), _M_p(__dat) {
+ }
+ _CharT* _M_p;
+ };
+ mutable _Alloc_hider _M_dataplus;
+ public:
+ basic_string(const _CharT* __s, const _Alloc& __a = _Alloc());
+ };
+ template<typename _CharT, typename _Traits, typename _Alloc> inline bool operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const _CharT* __rhs) {
+ }
+}
+extern "C" {
+}
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ namespace __detail {
+ struct _List_node_base {
+ _List_node_base* _M_next;
+ };
+ }
+ template<typename _Tp> struct _List_node : public __detail::_List_node_base {
+ };
+ template<typename _Tp> struct _List_iterator {
+ typedef _List_iterator<_Tp> _Self;
+ typedef _Tp& reference;
+ reference operator*() const {
+ }
+ bool operator!=(const _Self& __x) const {
+ }
+ };
+ template<typename _Tp, typename _Alloc> class _List_base {
+ protected:
+ typedef typename _Alloc::template rebind<_List_node<_Tp> >::other _Node_alloc_type;
+ struct _List_impl : public _Node_alloc_type {
+ __detail::_List_node_base _M_node;
+ _List_impl() : _Node_alloc_type(), _M_node() {
+ }
+ _List_impl(const _Node_alloc_type& __a) : _Node_alloc_type(__a), _M_node() {
+ }
+ };
+ _List_impl _M_impl;
+ ~_List_base() {
+ }
+ void _M_clear();
+ };
+ template<typename _Tp, typename _Alloc = std::allocator<_Tp> > class list : protected _List_base<_Tp, _Alloc> {
+ typedef _List_iterator<_Tp> iterator;
+ typedef size_t size_type;
+ public:
+ iterator begin() {
+ }
+ iterator end() {
+ }
+ bool empty() const {
+ }
+ size_type size() const {
+ }
+ void swap(list& __x) {
+ }
+ template<typename _StrictWeakOrdering> void merge(list& __x, _StrictWeakOrdering __comp);
+ template<typename _StrictWeakOrdering> void sort(_StrictWeakOrdering);
+ };
+ template<typename _Tp, typename _Alloc> template <typename _StrictWeakOrdering> void list<_Tp, _Alloc>:: merge(list& __x, _StrictWeakOrdering __comp) {
+ if (this != &__x) {
+ iterator __first1 = begin();
+ iterator __last1 = end();
+ iterator __first2 = __x.begin();
+ iterator __last2 = __x.end();
+ while (__first1 != __last1 && __first2 != __last2) if (__comp(*__first2, *__first1)) {
+ iterator __next = __first2;
+ __first2 = __next;
+ }
+ }
+ }
+ template<typename _Tp, typename _Alloc> template <typename _StrictWeakOrdering> void list<_Tp, _Alloc>:: sort(_StrictWeakOrdering __comp) {
+ if (this->_M_impl._M_node._M_next != &this->_M_impl._M_node && this->_M_impl._M_node._M_next->_M_next != &this->_M_impl._M_node) {
+ list __carry;
+ list __tmp[64];
+ list * __fill = &__tmp[0];
+ list * __counter;
+ do {
+ for(__counter = &__tmp[0];
+ __counter != __fill && !__counter->empty();
+ ++__counter) { __counter->merge(__carry, __comp); __carry.swap(*__counter); }
+ }
+ while ( !empty() );
+ for (__counter = &__tmp[1];
+ __counter != __fill;
+ ++__counter) __counter->merge(*(__counter - 1), __comp);
+ }
+ }
+}
+namespace gloox {
+ class Tag {
+ };
+ class StanzaExtension {
+ };
+}
+namespace gloox {
+}
+using namespace gloox;
+class AbstractPurpleRequest {
+};
+class AdhocCommandHandler : public AbstractPurpleRequest {
+};
+class AdhocTag : public Tag {
+};
+class AbstractConfigInterfaceHandler {
+};
+namespace gloox {
+ class DataFormField {
+ public:
+ const std::string& value() const {
+ }
+ };
+ class DataFormFieldContainer {
+ public:
+ bool hasField( const std::string& field ) const {
+ }
+ DataFormField* field( const std::string& field ) const;
+ };
+ class DataForm : public StanzaExtension, public DataFormFieldContainer {
+ };
+}
+enum {
+ SORT_BY_JID, SORT_BY_UIN, SORT_BY_BUDDIES, };
+struct SortData {
+};
+struct ListData {
+ std::list<SortData> output;
+ int sort_by;
+};
+class AdhocAdmin : public AdhocCommandHandler, public AbstractConfigInterfaceHandler {
+ AdhocTag *handleAdhocTag(Tag *stanzaTag);
+ AdhocTag *handleUnregisterUserForm(Tag *tag, const DataForm &form);
+ AdhocTag *handleListUsersForm(Tag *tag, const DataForm &form);
+ ListData m_listUsersData;
+};
+namespace gloox {
+}
+static bool compareIDataASC(SortData &a, SortData &b) {
+}
+AdhocTag *AdhocAdmin::handleListUsersForm(Tag *tag, const DataForm &form) {
+ ListData &data = m_listUsersData;
+ if (data.output.size() == 0) {
+ if (!form.hasField("users_vip") || !form.hasField("show_jid") || !form.hasField("show_uin") || !form.hasField("show_buddies") || !form.hasField("show_sort_by") || !form.hasField("show_sort_order") || !form.hasField("show_max_per_page") ) {
+ }
+ bool sort_asc = form.field("show_sort_order")->value() == "asc";
+ if (data.sort_by == SORT_BY_BUDDIES) {
+ if (sort_asc) data.output.sort(compareIDataASC);
+ }
+ else {
+ }
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr57190.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr57190.C
new file mode 100644
index 000000000..9fa11cd26
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr57190.C
@@ -0,0 +1,42 @@
+// { dg-do compile }
+
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Tp> class new_allocator {
+ };
+}
+namespace std {
+ template<typename> class allocator;
+ template<class _CharT> struct char_traits;
+ template<typename _CharT, typename _Traits = char_traits<_CharT>, typename _Alloc = allocator<_CharT> > class basic_string;
+ typedef basic_string<char> string;
+ template<typename _Tp> class allocator: public __gnu_cxx::new_allocator<_Tp> {
+ };
+ template<typename _CharT, typename _Traits, typename _Alloc> class basic_string {
+ public:
+ basic_string(const _CharT* __s, const _Alloc& __a = _Alloc());
+ };
+}
+class UIException {
+};
+class PasswordDialog {
+ void run() throw (UIException);
+};
+class MessageBox {
+public:
+ MessageBox (std::string t) throw (UIException);
+ virtual int run() throw (UIException) ;
+};
+extern "C" {
+ struct __jmp_buf_tag {
+ };
+ extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) throw ();
+ typedef struct __jmp_buf_tag sigjmp_buf[1];
+}
+sigjmp_buf password_dialog_sig_jmp_buf;
+void PasswordDialog::run() throw (UIException)
+{
+ __sigsetjmp (password_dialog_sig_jmp_buf, 1);
+ MessageBox* errmsg = __null;
+ errmsg = new MessageBox ("E R R O R");
+ errmsg->run();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr57235.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr57235.C
new file mode 100644
index 000000000..fd5663348
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr57235.C
@@ -0,0 +1,156 @@
+// { dg-do compile }
+
+namespace std
+{
+ template < class _Elem > struct char_traits
+ {
+ };
+ struct _Container_base
+ {
+ };
+ template < class _Ty > struct _Allocator_base
+ {
+ };
+ template < class _Ty > class allocator:public _Allocator_base < _Ty >
+ {
+ };
+ class _String_base:public _Container_base
+ {
+ };
+template < class _Ty, class _Alloc > class _String_val:public _String_base
+ {
+ };
+template < class _Elem, class _Traits, class _Ax > class basic_string:public _String_val < _Elem,
+ _Ax
+ >
+ {
+ public:typedef basic_string < _Elem, _Traits, _Ax > _Myt;
+ typedef _String_val < _Elem, _Ax > _Mybase;
+ basic_string (const _Elem * _Ptr):_Mybase ()
+ {
+ }
+ };
+ typedef basic_string < char, char_traits < char >,
+ allocator < char > >string;
+}
+
+
+namespace google
+{
+ namespace protobuf
+ {
+ namespace internal
+ {
+ template < class C > class scoped_ptr
+ {
+ public:typedef C element_type;
+ explicit scoped_ptr (C * p = __null):ptr_ (p)
+ {
+ }
+ ~scoped_ptr ()
+ {
+ delete ptr_;
+ }
+ C *get () const
+ {
+ return ptr_;
+ }
+ private: C * ptr_;
+ };
+ }
+ using internal::scoped_ptr;
+ enum LogLevel
+ {
+ LOGLEVEL_INFO, LOGLEVEL_WARNING, LOGLEVEL_ERROR, LOGLEVEL_FATAL,
+ LOGLEVEL_DFATAL = LOGLEVEL_ERROR
+ };
+ namespace internal
+ {
+ class LogMessage
+ {
+ public:LogMessage (LogLevel level, const char *filename,
+ int line);
+ ~LogMessage ();
+ LogMessage & operator<< (const std::string & value);
+ };
+ class LogFinisher
+ {
+ public:void operator= (LogMessage & other);
+ };
+ }
+ using namespace std;
+ class Descriptor
+ {
+ };
+ class FieldDescriptor
+ {
+ public:
+ const Descriptor *message_type () const;
+ string DebugString () const;
+ };
+ class MessageLite
+ {
+ };
+ class Message:public MessageLite
+ {
+ public:inline Message ()
+ {
+ }
+ virtual ~ Message ();
+ virtual Message *New () const = 0;
+ };
+ class MessageFactory
+ {
+ };
+ class UnknownFieldSet
+ {
+ };
+ class DynamicMessageFactory:public MessageFactory
+ {
+ public:DynamicMessageFactory ();
+ const Message *GetPrototype (const Descriptor * type);
+ };
+ namespace io
+ {
+ class ErrorCollector
+ {
+ public:inline ErrorCollector ()
+ {
+ }
+ virtual ~ ErrorCollector ();
+ };
+ }
+ class DescriptorBuilder
+ {
+ class OptionInterpreter
+ {
+ bool SetAggregateOption (const FieldDescriptor * option_field,
+ UnknownFieldSet * unknown_fields);
+ DynamicMessageFactory dynamic_factory_;
+ };
+ };
+ namespace
+ {
+ class AggregateErrorCollector:public io::ErrorCollector
+ {
+ };
+ }
+ bool DescriptorBuilder::OptionInterpreter::
+ SetAggregateOption (const FieldDescriptor * option_field,
+ UnknownFieldSet * unknown_fields)
+ {
+ const Descriptor *type = option_field->message_type ();
+ scoped_ptr < Message >
+ dynamic (dynamic_factory_.GetPrototype (type)->New ());
+ !(!(dynamic.get () !=
+ __null)) ? (void) 0 : ::google::protobuf::internal::
+ LogFinisher () =::google::protobuf::internal::LogMessage (::google::
+ protobuf::
+ LOGLEVEL_FATAL,
+ "descriptor.cc",
+ 4396) <<
+ option_field->DebugString ();
+ AggregateErrorCollector collector;
+ }
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr57499.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr57499.C
new file mode 100644
index 000000000..fd985a199
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr57499.C
@@ -0,0 +1,14 @@
+// PR middle-end/57499
+// { dg-do compile }
+
+struct S
+{
+ ~S () __attribute__ ((noreturn)) {} // { dg-warning "function does return" }
+};
+
+void
+foo ()
+{
+ S s;
+ throw 1;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58201.h b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58201.h
new file mode 100644
index 000000000..6071ccdf8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58201.h
@@ -0,0 +1,24 @@
+class A
+{
+ protected:
+ A();
+ virtual ~A();
+};
+
+class B : virtual public A
+{
+ public:
+ B();
+ virtual ~B();
+};
+
+class C
+{
+ private:
+ class C2 : public B
+ {
+ public:
+ C2();
+ virtual ~C2();
+ };
+};
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58201_0.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58201_0.C
new file mode 100644
index 000000000..f8fa7173c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58201_0.C
@@ -0,0 +1,9 @@
+#include "pr58201.h"
+
+C::C2::C2(){ }
+C::C2::~C2() { }
+
+int main ()
+{
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58201_1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58201_1.C
new file mode 100644
index 000000000..132cd5a43
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58201_1.C
@@ -0,0 +1,10 @@
+/* { dg-do link } */
+/* { dg-options "-O2" } */
+/* { dg-additional-sources "pr58201_0.C" } */
+#include "pr58201.h"
+
+A::A() { }
+A::~A() { }
+B::B() { }
+B::~B() { }
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58252.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58252.C
new file mode 100644
index 000000000..d38a7a7ea
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58252.C
@@ -0,0 +1,142 @@
+// { dg-do compile }
+// { dg-options "-fpermissive" }
+typedef long unsigned int size_t;
+ typedef bool _CORBA_Boolean;
+ typedef unsigned int _CORBA_ULong;
+ template <class T> class _CORBA_Sequence {
+ public: typedef _CORBA_Sequence<T> T_seq;
+ inline T_seq &operator= (const T_seq &s) {
+ for (unsigned long i=0;
+ i < pd_len;
+ i++) {
+ }
+ }
+ _CORBA_ULong pd_len;
+ };
+ template <class T> class _CORBA_Unbounded_Sequence : public _CORBA_Sequence<T> {
+ inline _CORBA_Unbounded_Sequence_WChar() { // { dg-warning "forbids declaration" }
+ }
+ };
+ class _CORBA_ObjRef_Var_base {
+ };
+ template <class T, class T_Helper> class _CORBA_ObjRef_Var : public _CORBA_ObjRef_Var_base {
+ public: typedef T* ptr_t;
+ typedef T* T_ptr;
+ inline _CORBA_ObjRef_Var() : pd_objref(T_Helper::_nil()) {
+ }
+ inline _CORBA_ObjRef_Var(T_ptr p) : pd_objref(p) {
+ }
+ private: T_ptr pd_objref;
+ };
+ class omniLocalIdentity;
+ class omniObjRef {
+ };
+ class omniServant {
+ public: virtual ~omniServant();
+ virtual void* _ptrToInterface(const char* repoId);
+ };
+ namespace CORBA {
+ class NVList {
+ };
+ class Object {
+ };
+ struct StructMember {
+ };
+ class StructMemberSeq : public _CORBA_Unbounded_Sequence< StructMember > {
+ };
+ class _objref_IRObject : public virtual ::CORBA::Object, public virtual omniObjRef {
+ };
+ class _impl_IRObject : public virtual omniServant {
+ };
+ class _objref_Container;
+ typedef _objref_Container* Container_ptr;
+ class _impl_Contained : public virtual _impl_IRObject {
+ };
+ class _objref_ExceptionDef;
+ typedef _objref_ExceptionDef* ExceptionDef_ptr;
+ class ExceptionDef_Helper {
+ public: typedef ExceptionDef_ptr _ptr_type;
+ static _ptr_type _nil();
+ };
+ typedef _CORBA_ObjRef_Var<_objref_ExceptionDef, ExceptionDef_Helper> ExceptionDef_var;
+ class Container {
+ public: typedef Container_ptr _ptr_type;
+ static const char* _PD_repoId;
+ };
+ class _objref_Container : public virtual _objref_IRObject {
+ ExceptionDef_ptr create_exception(const char* id, const char* name, const char* version, const ::CORBA::StructMemberSeq& members);
+ };
+ class _impl_Container : public virtual _impl_IRObject {
+ public: virtual ~_impl_Container();
+ virtual ExceptionDef_ptr create_exception(const char* id, const char* name, const char* version, const ::CORBA::StructMemberSeq& members) = 0;
+ };
+ class _impl_IDLType : public virtual _impl_IRObject {
+ };
+ class _impl_TypedefDef : public virtual _impl_Contained, public virtual _impl_IDLType {
+ };
+ class _impl_StructDef : public virtual _impl_TypedefDef, public virtual _impl_Container {
+ };
+ }
+ namespace PortableServer {
+ class ServantBase : public virtual omniServant {
+ };
+ }
+ namespace POA_CORBA {
+ class IRObject : public virtual CORBA::_impl_IRObject, public virtual ::PortableServer::ServantBase {
+ };
+ class Contained : public virtual CORBA::_impl_Contained, public virtual IRObject {
+ };
+ class Container : public virtual CORBA::_impl_Container, public virtual IRObject {
+ };
+ class IDLType : public virtual CORBA::_impl_IDLType, public virtual IRObject {
+ };
+ class TypedefDef : public virtual CORBA::_impl_TypedefDef, public virtual Contained, public virtual IDLType {
+ };
+ class StructDef : public virtual CORBA::_impl_StructDef, public virtual TypedefDef, public virtual Container {
+ public: virtual ~StructDef();
+ };
+ }
+ namespace omni {
+ class omniOrbPOA;
+ class giopAddress;
+ }
+ class omniCallDescriptor {
+ public: typedef void (*LocalCallFn)(omniCallDescriptor*, omniServant*);
+ inline omniCallDescriptor(LocalCallFn lcfn, const char* op_, int op_len_, _CORBA_Boolean oneway, const char*const* user_excns_, int n_user_excns_, _CORBA_Boolean is_upcall_) : pd_localCall(lcfn), pd_op(op_), pd_oplen(op_len_), pd_user_excns(user_excns_), pd_n_user_excns(n_user_excns_), pd_is_oneway(oneway), pd_is_upcall(is_upcall_), pd_contains_values(0), pd_first_address_used(0), pd_current_address(0), pd_objref(0), pd_poa(0), pd_localId(0), pd_deadline_secs(0), pd_deadline_nanosecs(0) {
+ }
+ private: LocalCallFn pd_localCall;
+ const char* pd_op;
+ size_t pd_oplen;
+ const char*const* pd_user_excns;
+ int pd_n_user_excns;
+ _CORBA_Boolean pd_is_oneway;
+ _CORBA_Boolean pd_is_upcall;
+ _CORBA_Boolean pd_contains_values;
+ const omni::giopAddress* pd_first_address_used;
+ const omni::giopAddress* pd_current_address;
+ omniObjRef* pd_objref;
+ omni::omniOrbPOA* pd_poa;
+ omniLocalIdentity* pd_localId;
+ unsigned long pd_deadline_secs;
+ unsigned long pd_deadline_nanosecs;
+ };
+ class _0RL_cd_7963219a43724a61_f2000000 : public omniCallDescriptor {
+ public: inline _0RL_cd_7963219a43724a61_f2000000(LocalCallFn lcfn,const char* op_,size_t oplen,_CORBA_Boolean upcall=0): omniCallDescriptor(lcfn, op_, oplen, 0, _user_exns, 0, upcall) {
+ }
+ static const char* const _user_exns[];
+ const char* arg_0;
+ const char* arg_1;
+ const char* arg_2;
+ const CORBA::StructMemberSeq* arg_3;
+ CORBA::ExceptionDef_var result;
+ };
+ static void _0RL_lcfn_7963219a43724a61_03000000(omniCallDescriptor* cd, omniServant* svnt) {
+ _0RL_cd_7963219a43724a61_f2000000* tcd = (_0RL_cd_7963219a43724a61_f2000000*)cd;
+ CORBA::_impl_Container* impl = (CORBA::_impl_Container*) svnt->_ptrToInterface(CORBA::Container::_PD_repoId);
+ tcd->result = impl->create_exception(tcd->arg_0, tcd->arg_1, tcd->arg_2, *tcd->arg_3);
+ }
+ CORBA::ExceptionDef_ptr CORBA::_objref_Container::create_exception(const char* id, const char* name, const char* version, const ::CORBA::StructMemberSeq& members) {
+ _0RL_cd_7963219a43724a61_f2000000 _call_desc(_0RL_lcfn_7963219a43724a61_03000000, "create_exception", 17);
+ }
+ POA_CORBA::StructDef::~StructDef() {
+ }
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58369.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58369.C
new file mode 100644
index 000000000..9284e2ca7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58369.C
@@ -0,0 +1,109 @@
+// { dg-do compile }
+// Reduced from boost-1.54
+
+int pow(int, int);
+int sqrt(int);
+
+class PolicyA { };
+
+template <class>
+int max_value() { return 0x7fffffff; }
+
+template <class>
+int min_value() { return 1; }
+
+void raise_denorm_error();
+
+template <class T>
+void raise_domain_error(int, int, const T &, const PolicyA &);
+
+template <class>
+int check_overflow(long double p1) {
+ long double __trans_tmp_2 = __builtin_fabsl(p1);
+ if (__trans_tmp_2 > max_value<int>())
+ return 1;
+ return 0;
+}
+
+template <class>
+int check_underflow(long double p1) {
+ if (p1 && (double)p1)
+ return 1;
+ return 0;
+}
+
+template <class>
+int check_denorm(long double p1) {
+ long double __trans_tmp_3 = __builtin_fabsl(p1);
+ if (__trans_tmp_3 < min_value<int>() && (double)p1) {
+ raise_denorm_error();
+ return 1;
+ }
+ return 0;
+}
+
+template <class, class>
+double checked_narrowing_cast(long double p1) {
+ if (check_overflow<int>(p1))
+ return 0;
+ if (check_underflow<int>(p1))
+ return 0;
+ if (check_denorm<int>(p1))
+ return 0;
+ return (double)p1;
+}
+
+long double ellint_rf_imp(long double, long double, long double);
+
+template <typename T, typename Policy>
+T ellint_rj_imp(T p1, T p2, T p3, T p4, Policy &p5) {
+ T value, tolerance, P, S3;
+ if (p4)
+ return 0;
+ if (p3 || p1)
+ raise_domain_error(0, 0, 0, p5);
+ tolerance = pow(0, 0);
+ if (p4) {
+ T q = -p4;
+ {
+ long double q6 = ellint_rj_imp((long double)p1, (long double)(double)p2, (long double)(double)p3, (long double)(int)0, p5);
+ value = checked_narrowing_cast<T, int>(q6);
+ }
+ {
+ long double q7 = ellint_rf_imp((long double)p1, (long double)(double)p2, (long double)(double)p3);
+ value -= checked_narrowing_cast<T, const int>(q7);
+ }
+ value += p1 * p3 + p4 * q;
+ return value;
+ }
+ do {
+ P = p4 / p1;
+ if (0 < tolerance)
+ break;
+ sqrt(p3);
+ } while (1);
+ S3 = P * p2 * 0;
+ value = S3 / p1;
+ return value;
+}
+
+template <typename Policy>
+void ellint_pi_imp4(double, double p3, Policy &p4) {
+ double x, y, z;
+ ellint_rj_imp(x, y, z, p3, p4);
+}
+
+template <typename Policy>
+double ellint_pi_imp5(double, double p3, double p4, Policy &p5) {
+ double x, y, z, p;
+ if (p3 > 0)
+ return 0;
+ ellint_rj_imp(x, y, z, p, p5);
+ ellint_pi_imp4((double)0, p4, p5);
+}
+
+void boost_ellint_3f() {
+ PolicyA p4;
+ ellint_pi_imp5((double)0, (double)0, (double)0, p4);
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58380.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58380.C
new file mode 100644
index 000000000..3a6ca9420
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58380.C
@@ -0,0 +1,173 @@
+// { dg-do compile }
+// { dg-options "-w" }
+
+class iplugin_factory;
+class idocument_plugin_factory {
+ virtual idocument_plugin_factory *create_plugin(iplugin_factory &, int &);
+};
+template <typename _Iterator, typename> class __normal_iterator {
+ _Iterator _M_current;
+
+public:
+ _Iterator iterator_type;
+ __normal_iterator(const _Iterator &p1) : _M_current(p1) {}
+ void operator++();
+ _Iterator &base() { return _M_current; }
+};
+
+template <typename _IteratorL, typename _IteratorR, typename _Container>
+int operator!=(__normal_iterator<_IteratorL, _Container> &p1,
+ __normal_iterator<_IteratorR, _Container> &p2) {
+ return p1.base() != p2.base();
+}
+
+class new_allocator {
+public:
+ typedef int *const_pointer;
+ int *allocate();
+};
+template <typename> class allocator : public new_allocator {};
+
+class basic_string {
+public:
+ basic_string(char *);
+};
+struct __uninitialized_copy {
+ template <typename _InputIterator, typename _ForwardIterator>
+ static _ForwardIterator __uninit_copy(_InputIterator p1, _InputIterator p2,
+ _ForwardIterator p3) try {
+ for (; p1 != p2; ++p1, ++p3)
+ ;
+ return p3;
+ }
+ catch (...) {
+ }
+};
+
+template <typename _InputIterator, typename _ForwardIterator>
+_ForwardIterator uninitialized_copy(_InputIterator p1, _InputIterator p2,
+ _ForwardIterator p3) {
+ return __uninitialized_copy::__uninit_copy(p1, p2, p3);
+}
+
+template <typename _InputIterator, typename _ForwardIterator, typename _Tp>
+_ForwardIterator __uninitialized_copy_a(_InputIterator p1, _InputIterator p2,
+ _ForwardIterator p3, allocator<_Tp> &) {
+ return uninitialized_copy(p1, p2, p3);
+}
+
+struct _Vector_base {
+ struct _Vector_impl : allocator<int> {
+ int *_M_start;
+ int *_M_finish;
+ };
+ allocator<int> &_M_get_Tp_allocator() {}
+ _Vector_base() {}
+ _Vector_base(int p1) { _M_create_storage(p1); }
+ _Vector_impl _M_impl;
+ int *_M_allocate(int p1) { p1 ? _M_impl.allocate() : 0; }
+ void _M_create_storage(int p1) {
+ this->_M_impl._M_start = this->_M_allocate(p1);
+ }
+};
+
+class vector : _Vector_base {
+ _Vector_base _Base;
+
+public:
+ vector() {}
+ vector(const vector &p1) : _Base(p1.size()) {
+ this->_M_impl._M_finish = __uninitialized_copy_a(
+ p1.begin(), p1.end(), this->_M_impl._M_start, _M_get_Tp_allocator());
+ }
+ ~vector();
+ __normal_iterator<typename allocator<int>::const_pointer, int> begin() const {
+ return this->_M_impl._M_start;
+ }
+ __normal_iterator<typename allocator<int>::const_pointer, int> end() const {
+ return this->_M_impl._M_finish;
+ }
+ int size() const { return this->_M_impl._M_finish - this->_M_impl._M_start; }
+};
+class iplugin_factory {
+public:
+ typedef enum {
+ STABLE,
+ EXPERIMENTAL
+ } quality_t;
+};
+class plugin_factory : public iplugin_factory {
+public:
+ plugin_factory(const int &, const basic_string &, const basic_string &,
+ const basic_string &, quality_t);
+};
+template <typename plugin_t>
+class document_plugin_factory : plugin_factory, idocument_plugin_factory {
+public:
+ document_plugin_factory(const int &p1, const basic_string &,
+ const basic_string &, const basic_string &, quality_t)
+ : plugin_factory(0, 0, 0, 0, STABLE) {}
+ idocument_plugin_factory *create_plugin(iplugin_factory &p1, int &p2) {
+ plugin_t(p1, p2);
+ }
+};
+
+class container {
+public:
+ template <typename init_t> container(init_t &);
+};
+template <class init_t> class initializer_t : init_t {
+public:
+ initializer_t(const init_t &p1) : init_t(p1) {}
+};
+
+class composition_t {};
+template <typename lhs_t, typename rhs_t>
+const initializer_t<composition_t> operator+(const initializer_t<lhs_t> &,
+ const initializer_t<rhs_t> &);
+template <typename value_t> class value_initializer_t {
+public:
+ value_initializer_t(const value_t &p1) : m_value(p1) {}
+ value_t m_value;
+};
+
+template <typename value_t>
+initializer_t<value_initializer_t<value_t> > init_value(const value_t &p1) {
+ initializer_t<value_initializer_t<value_t> >(
+ value_initializer_t<value_t>(p1));
+}
+
+class name_t {};
+class label_t {};
+class description_t {};
+class owner_initializer_t {};
+template <typename owner_t>
+initializer_t<owner_initializer_t> init_owner(owner_t &);
+class set : vector {};
+class node {
+public:
+ node(iplugin_factory &, int &);
+};
+initializer_t<name_t> init_name();
+initializer_t<label_t> init_label();
+initializer_t<description_t> init_description();
+template <typename base_t> class mesh_selection_sink : base_t {
+public:
+ mesh_selection_sink(iplugin_factory &p1, int &p2)
+ : base_t(p1, p2),
+ m_mesh_selection(init_owner(*this) + init_name() + init_label() +
+ init_description() + init_value(set())) {}
+ container m_mesh_selection;
+};
+
+class selection_to_stdout : mesh_selection_sink<node> {
+public:
+ selection_to_stdout(iplugin_factory &p1, int &p2)
+ : mesh_selection_sink(p1, p2) {}
+ static iplugin_factory &get_factory() {
+ document_plugin_factory<selection_to_stdout>(0, "", 0, "",
+ iplugin_factory::EXPERIMENTAL);
+ }
+};
+
+void selection_to_stdout_factory() { selection_to_stdout::get_factory(); }
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58464.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58464.C
new file mode 100644
index 000000000..3d9a2279d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58464.C
@@ -0,0 +1,268 @@
+// { dg-do compile }
+
+typedef __SIZE_TYPE__ size_t;
+extern "C" void *memcpy(void *, const void *, size_t);
+void *xmalloc(size_t);
+enum {
+ _sch_isdigit, _sch_isidst, _sch_isidnum
+};
+extern const unsigned _sch_istable[256];
+typedef struct ht cpp_hash_table;
+typedef struct ht_identifier *hashnode;
+enum ht_lookup_option {
+ HT_NO_INSERT
+};
+struct ht {
+ struct cpp_reader *pfile;
+};
+hashnode ht_lookup_with_hash(cpp_hash_table *, unsigned char *, size_t, unsigned, ht_lookup_option);
+typedef unsigned source_location;
+enum cpp_ttype {
+ CPP_OTHER, CPP_STRING, CPP_STRING16, CPP_UTF8STRING
+};
+struct cpp_token {
+ source_location src_loc;
+};
+typedef int cppchar_t;
+struct cpp_options {
+ char user_literals;
+ unsigned warn_literal_suffix;
+};
+enum node_type { };
+struct cpp_hashnode {
+ node_type type:6;
+};
+enum {
+ CPP_DL_ERROR
+};
+enum {
+ CPP_W_LITERAL_SUFFIX
+};
+bool cpp_error_with_line(cpp_reader *, int, source_location, unsigned, ...);
+bool cpp_warning_with_line(cpp_reader *, int, source_location, unsigned, const char *);
+cpp_ttype cpp_userdef_string_add_type(cpp_ttype);
+cpp_ttype cpp_userdef_char_add_type(cpp_ttype);
+typedef unsigned char uchar;
+struct _cpp_buff {
+ _cpp_buff *next;
+ unsigned char *base, *cur, *limit;
+};
+_cpp_buff *_cpp_get_buff(cpp_reader *, size_t);
+void _cpp_release_buff(cpp_reader *, _cpp_buff *);
+unsigned char *_cpp_unaligned_alloc(cpp_reader *, size_t);
+struct lexer_state {
+ unsigned skipping;
+ unsigned angled_headers;
+};
+struct _cpp_line_note {
+ unsigned pos;
+ unsigned type;
+};
+struct cpp_buffer {
+ unsigned char *cur;
+ unsigned char *line_base;
+ _cpp_line_note *notes;
+ unsigned cur_note;
+};
+struct cpp_reader {
+ cpp_buffer *buffer;
+ lexer_state state;
+ _cpp_buff *u_buff;
+ _cpp_buff *free_buffs;
+ ht *hash_table;
+ cpp_options opts;
+};
+static void create_literal(cpp_reader *pfile, cpp_token *, uchar *, unsigned len, cpp_ttype type)
+{
+ uchar *dest = _cpp_unaligned_alloc(pfile, len + 1);
+ dest[len] = type;
+}
+static void bufring_append(cpp_reader *pfile, uchar *base, size_t len, _cpp_buff **first_buff_p, _cpp_buff **last_buff_p)
+{
+ _cpp_buff *first_buff = *first_buff_p;
+ _cpp_buff *last_buff = *last_buff_p;
+ if (!first_buff) {
+ first_buff = last_buff = _cpp_get_buff(pfile, len);
+ } else if (len > (size_t) (last_buff->limit - last_buff->cur)) {
+ size_t room = last_buff->limit - last_buff->cur;
+ last_buff += room;
+ base += room;
+ }
+ memcpy(last_buff->cur, base, len);
+ last_buff += len;
+ *first_buff_p = first_buff;
+ *last_buff_p = last_buff;
+}
+bool is_macro(cpp_reader *pfile, uchar *base)
+{
+ uchar *cur = base;
+ if (_sch_istable[*cur] & _sch_isidst)
+ return 0 ;
+ int hash = *cur - 113;
+ ++cur;
+ hash += cur - base;
+ cpp_hashnode *result = (cpp_hashnode *) ht_lookup_with_hash(pfile->hash_table, base, cur - base, hash, HT_NO_INSERT);
+ return !result ? 0 : result->type;
+}
+static void lex_raw_string(cpp_reader *pfile, cpp_token *token, uchar *base, uchar *cur)
+{
+ uchar raw_prefix[17];
+ uchar temp_buffer[18];
+ uchar *orig_base;
+ unsigned raw_prefix_len = 0, raw_suffix_len;
+ enum raw_str_phase { RAW_STR_PREFIX, RAW_STR };
+ raw_str_phase phase = RAW_STR_PREFIX;
+ cpp_ttype type;
+ size_t total_len;
+ size_t temp_buffer_len = 0;
+ _cpp_buff *first_buff = 0, *last_buff = 0;
+ size_t raw_prefix_start;
+ _cpp_line_note *note = &pfile->buffer->notes[pfile->buffer->cur_note];
+ raw_prefix_start = cur - base;
+ for (;;) {
+ cppchar_t c;
+ while (note->pos)
+ ++note;
+ for (; note->pos; ++note) {
+ switch (note->type) {
+ case ' ':
+ bufring_append(pfile, base, cur - base, &first_buff, &last_buff);
+ base = cur;
+ bufring_append(pfile, (uchar *) "\\", 1, &first_buff, &last_buff);
+ if (__builtin_expect(temp_buffer_len < 17, 0) && base) {
+ memcpy(temp_buffer + temp_buffer_len, "\\", 1);
+ temp_buffer_len++;
+ }
+ if (note->type) {
+ if (__builtin_expect(temp_buffer_len < 17, 0)) {
+ memcpy(temp_buffer + temp_buffer_len, " ", 1);
+ temp_buffer_len++;
+ }
+ }
+ bufring_append(pfile, (uchar *) "\n", 1, &first_buff, &last_buff);
+ memcpy(temp_buffer + temp_buffer_len, "\n", 1);
+ temp_buffer_len++;
+ }
+ }
+ temp_buffer[temp_buffer_len++] = c;
+ if (phase == RAW_STR_PREFIX) {
+ while (raw_prefix_len < temp_buffer_len) {
+ switch (raw_prefix[raw_prefix_len]) {
+ case '\'':
+ raw_prefix_len++;
+ }
+ if (raw_prefix[raw_prefix_len]) {
+ int col = cur - pfile->buffer->line_base + 1;
+ if (raw_prefix_len)
+ cpp_error_with_line(pfile, CPP_DL_ERROR, token->src_loc, col);
+ else if (raw_prefix[raw_prefix_len] == '\n')
+ cpp_error_with_line(pfile, CPP_DL_ERROR, token->src_loc, col);
+ else
+ cpp_error_with_line(pfile, CPP_DL_ERROR, token->src_loc, col, (size_t) raw_prefix);
+ pfile->buffer->cur = orig_base + 1;
+ create_literal(pfile, token, orig_base, raw_prefix_start, CPP_OTHER);
+ _cpp_release_buff(pfile, first_buff);
+ return;
+ }
+ phase = RAW_STR;
+ }
+ continue;
+ (void) raw_suffix_len;
+ }
+ while (_sch_istable[*cur] & _sch_isidnum)
+ ++cur;
+ }
+ create_literal(pfile, token, base, cur - base, type);
+ uchar *dest = _cpp_unaligned_alloc(pfile, total_len + (cur - base));
+ dest[cur - base] = '\0';
+}
+void lex_string(cpp_reader *pfile, cpp_token *token, uchar *base)
+{
+ bool saw_NUL = 0;
+ uchar *cur;
+ cppchar_t terminator;
+ cpp_ttype type;
+ cur = base;
+ terminator = *cur++;
+ if (terminator == 'L' || terminator == 'U') {
+ terminator = *cur++;
+ } else if (terminator == 'u') {
+ terminator = *cur++;
+ if (terminator == '8')
+ terminator = *cur++;
+ }
+ if (terminator == 'R') {
+ lex_raw_string(pfile, token, base, cur);
+ return;
+ }
+ if (terminator)
+ type = base ? (base[1] ? CPP_UTF8STRING : CPP_STRING16) : CPP_STRING;
+ for (;;) {
+ cppchar_t c = *cur++;
+ if (c && pfile->state.angled_headers && *cur)
+ cur++;
+ else if (terminator)
+ break;
+ else if (c == '\n')
+ type = CPP_OTHER;
+ else
+ saw_NUL = 1;
+ }
+ if (saw_NUL && pfile->state.skipping)
+ if (pfile->opts.user_literals) {
+ if (is_macro(pfile, cur))
+ if (pfile->opts.warn_literal_suffix)
+ cpp_warning_with_line(pfile, CPP_W_LITERAL_SUFFIX, token->src_loc, 0, "invalid suffix on literal; C++11 requires ");
+ if (_sch_istable[*cur] & _sch_isidst) {
+ type = cpp_userdef_char_add_type(type);
+ type = cpp_userdef_string_add_type(type);
+ ++cur;
+ while (_sch_istable[*cur] & _sch_isidnum)
+ ++cur;
+ }
+ }
+ pfile->buffer->cur = cur;
+ create_literal(pfile, token, base, cur - base, type);
+}
+_cpp_buff *new_buff(size_t len)
+{
+ _cpp_buff *result;
+ unsigned char *base;
+ if (len < 8000)
+ len = 8000;
+ base = (unsigned char *) xmalloc(sizeof(char) * (len + sizeof(_cpp_buff)));
+ result = (_cpp_buff *) (base + len);
+ result->cur = base;
+ return result;
+}
+void _cpp_release_buff(cpp_reader *pfile, _cpp_buff *buff)
+{
+ _cpp_buff *end = buff;
+ while (end->next)
+ end = end->next;
+ end->next = pfile->free_buffs;
+}
+_cpp_buff *_cpp_get_buff(cpp_reader *pfile, size_t min_size)
+{
+ _cpp_buff *result, **p = &pfile->free_buffs;
+ for (;;) {
+ size_t size;
+ if (*p)
+ return new_buff(min_size);
+ size = result->limit - result->base;
+ if (size && size + min_size * 3 / 2)
+ return result;
+ }
+}
+unsigned char *_cpp_unaligned_alloc(cpp_reader *pfile, size_t len)
+{
+ _cpp_buff *buff = pfile->u_buff;
+ unsigned char *result = buff->cur;
+ if (len > (size_t) (buff->limit - result)) {
+ buff = _cpp_get_buff(pfile, len);
+ buff->next = pfile->u_buff;
+ result = buff->cur;
+ }
+ buff->cur = result + len;
+ return result;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58552.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58552.C
new file mode 100644
index 000000000..17c0d1cf6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58552.C
@@ -0,0 +1,29 @@
+// { dg-do compile }
+// { dg-additional-options "-fcompare-debug" }
+
+extern void fancy_abort () __attribute__ ((__noreturn__));
+extern "C" {
+ struct __jmp_buf_tag { };
+ typedef struct __jmp_buf_tag jmp_buf[1];
+ extern int _setjmp (struct __jmp_buf_tag __env[1]) throw ();
+}
+extern void *gfc_state_stack;
+static jmp_buf eof_buf;
+static void push_state ()
+{
+ if (!gfc_state_stack)
+ fancy_abort ();
+}
+bool gfc_parse_file (void)
+{
+ int seen_program=0;
+ if (_setjmp (eof_buf))
+ return false;
+ if (seen_program)
+ goto duplicate_main;
+ seen_program = 1;
+ push_state ();
+ push_state ();
+duplicate_main:
+ return true;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58555.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58555.C
new file mode 100644
index 000000000..ac5009a7b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58555.C
@@ -0,0 +1,114 @@
+/* { dg-do compile } */
+template <typename _Tp> _Tp *__addressof(_Tp &) {}
+template <typename _Tp> class A {
+public:
+ typedef _Tp *pointer;
+};
+template <typename _Tp> class M : public A<_Tp> {
+public:
+ typedef M other;
+ ~M();
+};
+class B {
+public:
+ B(int *);
+};
+class C {
+public:
+ void GetNext();
+ C *GetChildren();
+};
+template <typename _Tp> void _Destroy(_Tp *p1) { p1->~_Tp(); }
+struct D {
+ template <typename _ForwardIterator>
+ static void __destroy(_ForwardIterator p1, _ForwardIterator p2) {
+ for (; p1 != p2; ++p1)
+ _Destroy(__addressof(*p1));
+ }
+};
+template <typename _ForwardIterator>
+void _Destroy(_ForwardIterator p1, _ForwardIterator p2) {
+ D::__destroy(p1, p2);
+}
+template <typename _ForwardIterator, typename _Tp>
+void _Destroy(_ForwardIterator p1, _ForwardIterator p2, M<_Tp> &) {
+ _Destroy(p1, p2);
+}
+template <typename _Alloc> struct F {
+ typedef _Alloc _Tp_alloc_type;
+ typedef typename _Tp_alloc_type::pointer pointer;
+ struct N : _Tp_alloc_type {
+ pointer _M_start;
+ pointer _M_finish;
+ };
+ _Tp_alloc_type &_M_get_Tp_allocator();
+ N _M_impl;
+};
+template <typename _Tp, typename _Alloc = M<_Tp> > class O : F<_Alloc> {
+using F<_Alloc>::_M_get_Tp_allocator;
+public:
+ ~O() {
+ _Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
+ _M_get_Tp_allocator());
+ }
+};
+template <class T> void checked_delete(T *p1) { delete p1; }
+template <class> class I;
+template <class T> struct J {
+ typedef T *type;
+};
+class K;
+class L {
+public:
+ virtual ~L();
+};
+class P : L {
+ O<I<int> > databasesM;
+ O<I<K> > usersM;
+public:
+ I<int> addDatabase();
+};
+C a;
+C *b;
+int atomic_exchange_and_add();
+class G {
+public:
+ virtual void dispose() = 0;
+ void release() {
+ if (atomic_exchange_and_add() == 1)
+ dispose();
+ }
+};
+class Q : G {
+ P *px_;
+ Q() {}
+ void dispose() { checked_delete(px_); }
+};
+class H {
+ G *pi_;
+public:
+ H();
+ H(P *);
+ ~H() {
+ if (pi_)
+ pi_->release();
+ }
+};
+template <class T, class Y> void sp_pointer_construct(I<T> *, Y, H);
+template <class T> class I {
+public:
+ typedef T element_type;
+ template <class Y> I(Y *p1) { sp_pointer_construct(this, 0, 0); }
+ typename J<T>::type operator->();
+ H pn;
+};
+void getNodeContent(const B &) {
+ for (C *n = a.GetChildren(); n; n->GetNext())
+ ;
+}
+void parseDatabase(I<P> p1) {
+ I<int> c = p1->addDatabase();
+ for (; b;)
+ getNodeContent(0);
+}
+void addServer() { I<int>(new P); }
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58585.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58585.C
new file mode 100644
index 000000000..69fcf04dd
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr58585.C
@@ -0,0 +1,20 @@
+// { dg-do compile }
+// { dg-options "-fpic" { target fpic } }
+struct A
+{
+ virtual void foo() {}
+ void bar();
+};
+void A::bar() { foo(); }
+
+struct B : virtual A
+{
+ virtual void foo() {}
+ char c;
+};
+
+struct C : virtual B
+{
+ C();
+};
+C::C() { bar(); }
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr59163.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr59163.C
new file mode 100644
index 000000000..2f9a99970
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr59163.C
@@ -0,0 +1,30 @@
+// PR target/59163
+// { dg-do run }
+
+struct A { float a[4]; };
+struct B { int b; A a; };
+
+__attribute__((noinline, noclone)) void
+bar (A &a)
+{
+ if (a.a[0] != 36.0f || a.a[1] != 42.0f || a.a[2] != 48.0f || a.a[3] != 54.0f)
+ __builtin_abort ();
+}
+
+__attribute__((noinline, noclone)) void
+foo (A &a)
+{
+ int i;
+ A c = a;
+ for (i = 0; i < 4; i++)
+ c.a[i] *= 6.0f;
+ a = c;
+ bar (a);
+}
+
+int
+main ()
+{
+ B b = { 5, { 6, 7, 8, 9 } };
+ foo (b.a);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr59208.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr59208.C
new file mode 100644
index 000000000..3dc110c55
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr59208.C
@@ -0,0 +1,25 @@
+// { dg-do compile }
+class A {
+public:
+ A();
+ A(int *);
+};
+class B {};
+class C : B {
+public:
+ virtual void m_fn1();
+ void operator+=(int) { m_fn1(); }
+};
+enum DebuggerType {};
+C a;
+DebuggerType b;
+void operator==(A &, const A &);
+static A get_dbx_doc(A &p1) { p1 == 0; }
+
+void add_button() {
+ A c;
+ switch (b)
+ case 0:
+ get_dbx_doc(c);
+ a += 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr59226.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr59226.C
new file mode 100644
index 000000000..cb0ebbe35
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr59226.C
@@ -0,0 +1,27 @@
+// { dg-do compile }
+struct A
+{
+ virtual void foo() {}
+};
+
+struct B
+{
+ virtual void foo() {}
+};
+
+struct C : virtual A {};
+
+struct D : virtual A, B
+{
+ virtual void foo() {}
+};
+
+struct E : C, D
+{
+ virtual void foo() {}
+};
+
+void bar(A* p)
+{
+ p->foo();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr59265.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr59265.C
new file mode 100644
index 000000000..be4c6e1e8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr59265.C
@@ -0,0 +1,22 @@
+// { dg-do compile { target c++11 } }
+// { dg-options "-fprofile-use" }
+
+class A {
+ int m_fn1() const;
+ unsigned m_fn2() const;
+};
+class B {
+public:
+ virtual void m_fn1();
+};
+class C final : B {
+ C();
+ virtual void m_fn2() { m_fn1(); }
+};
+int a;
+unsigned A::m_fn2() const {
+ if (m_fn1())
+ return 0;
+ a = m_fn2();
+}
+C::C() {}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr59775.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr59775.C
new file mode 100644
index 000000000..10c497587
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr59775.C
@@ -0,0 +1,21 @@
+// { dg-do compile }
+struct A
+{
+ virtual void foo () = 0;
+ void bar () { foo (); }
+ bool a;
+};
+struct B : public virtual A
+{
+ virtual void foo ();
+};
+struct C : public B
+{
+ C ();
+};
+void
+baz ()
+{
+ C c;
+ c.bar ();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr59822.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr59822.C
new file mode 100644
index 000000000..7357b6dc3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr59822.C
@@ -0,0 +1,14 @@
+// { dg-do compile }
+
+typedef struct rtvec_def *rtvec;
+enum machine_mode { VOIDmode };
+struct rtvec_def { void *elem[1]; };
+extern void *const_tiny_rtx[2];
+void
+ix86_build_const_vector (enum machine_mode mode, bool vect,
+ void *value, rtvec v, int n_elt)
+{
+ int i;
+ for (i = 1; i < n_elt; ++i)
+ ((v)->elem[i]) = vect ? value : (const_tiny_rtx[(int) (mode)]);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr59882.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr59882.C
new file mode 100644
index 000000000..b61f24703
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr59882.C
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+class A;
+class B {};
+struct C {
+ virtual void dispatch();
+ int traversal_map_;
+};
+template <typename> class F : public virtual C {};
+
+struct I : F<A>, F<int> {};
+struct J : B, I {};
+class D {};
+struct L {
+ L(D &, int &p2) : map_(p2) {}
+ virtual void traverse(int &p1) {
+ int &s = p1;
+ names<L>(s, names_);
+ }
+ int &map_;
+ J names_;
+ template <typename> void names(int &, C &p2) { p2.dispatch(); }
+};
+
+struct G : D {
+ G(D &, int &p2) : map_(p2) { L(*this, map_); }
+ int &map_;
+};
+
+int a;
+void fn1(D &p1) { G(p1, a); }
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr59918.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr59918.C
new file mode 100644
index 000000000..b30d33eb3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr59918.C
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+struct E {
+ ~E();
+ virtual void f() const;
+};
+struct B : E {};
+struct G : virtual B {};
+struct A {
+ virtual ~A();
+};
+struct J : E {
+ void f() const {
+ E *p = 0;
+ p->f();
+ }
+};
+J h;
+struct I : A, G, virtual B {};
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60058.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60058.C
new file mode 100644
index 000000000..1144137cb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60058.C
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-require-visibility "" } */
+
+typedef enum {} UErrorCode;
+class A {
+public:
+ virtual A &m_fn1(A &, const A &, UErrorCode &) const;
+ void m_fn2();
+ A();
+ A(int);
+};
+class __attribute__((visibility("hidden"))) B : public A {
+public:
+ B(A &p1) : norm2(p1), set(0) {}
+ A &m_fn1(A &, const A &, UErrorCode &) const;
+ A &norm2;
+ const int &set;
+};
+
+UErrorCode a;
+A c;
+void fn1(A *p1) {
+ A b;
+ p1->m_fn1(b, 0, a).m_fn2();
+}
+
+void fn2() {
+ B d(c);
+ fn1(&d);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60131.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60131.C
new file mode 100644
index 000000000..23dde316d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60131.C
@@ -0,0 +1,23 @@
+// { dg-do compile }
+struct A { short a; };
+int **b;
+unsigned long c;
+
+bool foo ();
+unsigned bar (unsigned i);
+extern void baz () __attribute__((noreturn));
+
+int *
+test (unsigned x, struct A *y)
+{
+ unsigned v;
+ if (foo () || y[x].a == -1)
+ {
+ c = bar (x);
+ return 0;
+ }
+ v = y[x].a;
+ if (v >= 23)
+ baz ();
+ return b[v];
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60438-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60438-1.C
new file mode 100644
index 000000000..748295aab
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60438-1.C
@@ -0,0 +1,26 @@
+// { dg-do compile }
+// { dg-options "-fomit-frame-pointer" }
+
+struct A { int a; };
+struct B { A foo (); };
+struct C { B *foo (); };
+int foo (struct C *, float);
+void bar (struct C *);
+void baz (struct A *);
+int a, b, c;
+
+int
+foo (struct C *y, float x)
+{
+ struct A d;
+ if (c)
+ bar (y);
+ else
+ {
+ C g;
+ g.foo ()->foo ();
+ a = b;
+ d.a = (int) (b * x);
+ }
+ baz (&d);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60438-2.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60438-2.C
new file mode 100644
index 000000000..b32576f67
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60438-2.C
@@ -0,0 +1,3 @@
+// { dg-do compile }
+// { dg-options "-fomit-frame-pointer -fno-crossjumping" }
+#include "pr60438-1.C"
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60474.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60474.C
new file mode 100644
index 000000000..4b9fbe656
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr60474.C
@@ -0,0 +1,16 @@
+// { dg-do compile }
+
+struct Layer;
+template <typename> struct A
+{
+ Layer *m_fn1 ();
+ Layer &operator[](int p1) { return m_fn1 ()[p1]; }
+};
+struct Layer
+{
+};
+void fn1 (A<int> &p1, int Layer::*p2, int p3)
+{
+ for (int a = 0;; ++a, ++p3)
+ p1[p3].*p2 = p1[a].*p2;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/predcom-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/predcom-1.C
new file mode 100644
index 000000000..9e9a4b38c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/predcom-1.C
@@ -0,0 +1,29 @@
+/* Test for ICE in predictive commoning with empty loop header block
+ on arm-none-linux-*. */
+
+struct Foo
+{
+ double *ptr;
+
+ Foo (double *ptr_)
+ : ptr (ptr_)
+ {
+ }
+
+ Foo PostInc ()
+ {
+ return Foo (ptr++);
+ }
+};
+
+bool Baz (Foo first, double *last)
+{
+ Foo prev (first.ptr);
+
+ first.ptr++;
+
+ while (first.ptr != last)
+ if (*first.PostInc ().ptr < *prev.PostInc ().ptr)
+ return false;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pushpop_macro.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pushpop_macro.C
new file mode 100644
index 000000000..98065e6ee
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pushpop_macro.C
@@ -0,0 +1,19 @@
+/* Do the preprocessor push_macro/pop_macro test. */
+
+/* { dg-do run } */
+
+extern "C" void abort ();
+
+#define _ 2
+#pragma push_macro("_")
+#undef _
+#define _ 1
+#pragma pop_macro("_")
+
+int main ()
+{
+ if (_ != 2)
+ abort ();
+ return 0;
+}
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/check.h b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/check.h
new file mode 100644
index 000000000..af1988512
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/check.h
@@ -0,0 +1,36 @@
+#include <stddef.h>
+#ifdef DEBUG
+#include <stdio.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" void abort (void);
+#else
+extern void abort (void);
+#endif
+
+int
+check_int (int *i, int align)
+{
+ *i = 20;
+ if ((((ptrdiff_t) i) & (align - 1)) != 0)
+ {
+#ifdef DEBUG
+ printf ("\nUnalign address (%d): %p!\n", align, i);
+#endif
+ abort ();
+ }
+ return *i;
+}
+
+void
+check (void *p, int align)
+{
+ if ((((ptrdiff_t) p) & (align - 1)) != 0)
+ {
+#ifdef DEBUG
+ printf ("\nUnalign address (%d): %p!\n", align, p);
+#endif
+ abort ();
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-alloca-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-alloca-1.C
new file mode 100644
index 000000000..89b0a6a67
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-alloca-1.C
@@ -0,0 +1,57 @@
+/* { dg-do run } */
+/* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } "*" "" } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+bar (char *p, int size)
+{
+ __builtin_strncpy (p, "good", size);
+}
+
+class Base {};
+
+struct A : virtual public Base
+{
+ A() {}
+};
+
+struct B {};
+
+void
+foo (int size) throw (B,A)
+{
+ char *p = (char*) __builtin_alloca (size + 1);
+ aligned i;
+
+ bar (p, size);
+ if (__builtin_strncmp (p, "good", size) != 0)
+ {
+#ifdef DEBUG
+ p[size] = '\0';
+ printf ("Failed: %s != good\n", p);
+#endif
+ abort ();
+ }
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ throw A();
+}
+
+int
+main()
+{
+ try { foo (5); }
+ catch (A& a) { }
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-fastcall-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-fastcall-1.C
new file mode 100644
index 000000000..2c24ea3bc
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-fastcall-1.C
@@ -0,0 +1,43 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+class Base {};
+
+struct A : virtual public Base
+{
+ A() {}
+};
+
+struct B {};
+
+__attribute__ ((fastcall))
+void
+foo (int j, int k, int m, int n, int o) throw (B,A)
+{
+ aligned i;
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ if (i != 20 || j != 1 || k != 2 || m != 3 || n != 4 || o != 5)
+ abort ();
+
+ throw A();
+}
+
+int
+main()
+{
+ try { foo (1, 2, 3, 4, 5); }
+ catch (A& a) { }
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-global-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-global-1.C
new file mode 100644
index 000000000..cc05ed04f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-global-1.C
@@ -0,0 +1,40 @@
+/* { dg-do run } */
+/* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } "*" "" } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+class Base {};
+
+struct A : virtual public Base
+{
+ A() {}
+};
+
+struct B {};
+
+void
+foo (void) throw (B,A)
+{
+ aligned i;
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ throw A();
+}
+
+int
+main()
+{
+ try { foo (); }
+ catch (A& a) { }
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-1.C
new file mode 100644
index 000000000..d2555f2e2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-1.C
@@ -0,0 +1,40 @@
+/* { dg-do run } */
+/* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } "*" "" } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+class Base {};
+
+struct A : virtual public Base
+{
+ A() {}
+};
+
+struct B {};
+
+static void
+inline __attribute__((always_inline))
+foo (void) throw (B,A)
+{
+ aligned i;
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+ throw A();
+}
+
+int
+main()
+{
+ try { foo (); }
+ catch (A& a) { }
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-2.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-2.C
new file mode 100644
index 000000000..1cbc68cc4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-2.C
@@ -0,0 +1,58 @@
+/* { dg-do run } */
+/* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } "*" "" } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+bar (char *p, int size)
+{
+ __builtin_strncpy (p, "good", size);
+}
+
+class Base {};
+
+struct A : virtual public Base
+{
+ A() {}
+};
+
+struct B {};
+
+static void
+inline __attribute__((always_inline))
+foo (int size) throw (B,A)
+{
+ char *p = (char *) __builtin_alloca (size + 1);
+ aligned i;
+
+ bar (p, size);
+ if (__builtin_strncmp (p, "good", size) != 0)
+ {
+#ifdef DEBUG
+ p[size] = '\0';
+ printf ("Failed: %s != good\n", p);
+#endif
+ abort ();
+ }
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ throw A();
+}
+
+int
+main()
+{
+ try { foo (5); }
+ catch (A& a) { }
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-thiscall-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-thiscall-1.C
new file mode 100644
index 000000000..403497a9a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-thiscall-1.C
@@ -0,0 +1,43 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+class Base {};
+
+struct A : virtual public Base
+{
+ A() {}
+};
+
+struct B {};
+
+__attribute__ ((thiscall))
+void
+foo (int j, int k, int m, int n, int o) throw (B,A)
+{
+ aligned i;
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ if (i != 20 || j != 1 || k != 2 || m != 3 || n != 4 || o != 5)
+ abort ();
+
+ throw A();
+}
+
+int
+main()
+{
+ try { foo (1, 2, 3, 4, 5); }
+ catch (A& a) { }
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-1.C
new file mode 100644
index 000000000..b9ba81b12
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-1.C
@@ -0,0 +1,73 @@
+/* { dg-do run } */
+/* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } "*" "" } */
+
+#include <stdarg.h>
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+bar (char *p, int size)
+{
+ __builtin_strncpy (p, "good", size);
+}
+
+class Base {};
+
+struct A : virtual public Base
+{
+ A() {}
+};
+
+struct B {};
+
+void
+foo (const char *fmt, ...) throw (B,A)
+{
+ va_list arg;
+ char *p;
+ aligned i;
+ int size;
+ double x;
+
+ va_start (arg, fmt);
+ size = va_arg (arg, int);
+ if (size != 5)
+ abort ();
+ p = (char *) __builtin_alloca (size + 1);
+
+ x = va_arg (arg, double);
+ if (x != 5.0)
+ abort ();
+
+ bar (p, size);
+ if (__builtin_strncmp (p, "good", size) != 0)
+ {
+#ifdef DEBUG
+ p[size] = '\0';
+ printf ("Failed: %s != good\n", p);
+#endif
+ abort ();
+ }
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ throw A();
+
+ va_end (arg);
+}
+
+int
+main()
+{
+ try { foo ("foo", 5, 5.0); }
+ catch (A& a) { }
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-2.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-2.C
new file mode 100644
index 000000000..5e282179c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-2.C
@@ -0,0 +1,79 @@
+/* { dg-options "-Wno-abi" {target arm_eabi} } */
+/* { dg-do run } */
+/* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } "*" "" } */
+
+#include <stdarg.h>
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+bar (char *p, int size)
+{
+ __builtin_strncpy (p, "good", size);
+}
+
+class Base {};
+
+struct A : virtual public Base
+{
+ A() {}
+};
+
+struct B {};
+
+void
+test (va_list arg) throw (B,A)
+{
+ char *p;
+ aligned i;
+ int size;
+ double x;
+
+ size = va_arg (arg, int);
+ if (size != 5)
+ abort ();
+
+ p = (char *) __builtin_alloca (size + 1);
+
+ x = va_arg (arg, double);
+ if (x != 5.0)
+ abort ();
+
+ bar (p, size);
+ if (__builtin_strncmp (p, "good", size) != 0)
+ {
+#ifdef DEBUG
+ p[size] = '\0';
+ printf ("Failed: %s != good\n", p);
+#endif
+ abort ();
+ }
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ throw A();
+}
+
+void
+foo (const char *fmt, ...)
+{
+ va_list arg;
+ va_start (arg, fmt);
+ test (arg);
+ va_end (arg);
+}
+int
+main()
+{
+ try { foo ("foo", 5, 5.0); }
+ catch (A& a) { }
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/stackalign.exp b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/stackalign.exp
new file mode 100644
index 000000000..ad08fc08a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/stackalign.exp
@@ -0,0 +1,57 @@
+# Copyright (C) 2008-2014 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
+# <http://www.gnu.org/licenses/>.
+
+# This harness is for tests that should be run at all optimisation levels.
+
+load_lib g++-dg.exp
+load_lib torture-options.exp
+
+global DG_TORTURE_OPTIONS LTO_TORTURE_OPTIONS
+
+dg-init
+torture-init
+
+# default_flags are replaced by a dg-options test directive, or appended
+# to by using dg-additional-options. Use default_flags for options that
+# are used in all of the torture sets to limit the amount of noise in
+# test summaries.
+set default_flags ""
+
+# torture_flags are combined with other torture options and do not
+# affect options specified within a test.
+set torture_flags ""
+
+set stackalign_options [list]
+
+# If automatic stack alignment is supported, force it on.
+if { [check_effective_target_automatic_stack_alignment] } then {
+ append default_flags " -mstackrealign"
+ append default_flags " -mpreferred-stack-boundary=5"
+}
+lappend stackalign_options [join $torture_flags]
+
+if { [check_effective_target_fpic] } then {
+ lappend torture_flags "-fpic"
+ lappend stackalign_options [join $torture_flags]
+}
+
+# Combine stackalign options with the usual torture optimization flags.
+set-torture-options [concat $DG_TORTURE_OPTIONS $LTO_TORTURE_OPTIONS] $stackalign_options
+
+gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.C]] "$default_flags"
+
+torture-finish
+dg-finish
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/stdcall-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/stdcall-1.C
new file mode 100644
index 000000000..18c02be09
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/stdcall-1.C
@@ -0,0 +1,17 @@
+// { dg-do compile { target { { i?86-*-* x86_64-*-* } && ia32 } } }
+
+// This case is to detect an assertion failure in stack branch development.
+
+bool f();
+struct S {
+ __attribute__ ((stdcall)) ~S();
+};
+void g() {
+ for (;;) {
+ S s1, s2, s3;
+ if (f())
+ continue;
+ if (f())
+ return;
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/test-unwind.h b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/test-unwind.h
new file mode 100644
index 000000000..ff5602784
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/test-unwind.h
@@ -0,0 +1,142 @@
+#include "check.h"
+
+
+#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname)
+#define ASMNAME2(prefix, cname) STRING (prefix) cname
+#define STRING(x) #x
+
+#ifdef __cplusplus
+extern "C" void abort (void);
+#else
+extern void abort (void);
+#endif
+
+extern void foo(void);
+
+#define INIT_EDI 1
+#define INIT_ESI 2
+#define INIT_EBX 3
+
+/* Set DI/SI/BX to wrong value
+ Use following template so that RA will save/restore callee
+ save registers in prologue/epilogue */
+#define ALTER_REGS() \
+ { \
+ int dummy; \
+ __asm__ __volatile__ (\
+ "movl %1, %0" : "=D" (dummy) : "i" (-INIT_EDI)\
+ );\
+ __asm__ __volatile__ (\
+ "movl %1, %0" : "=S" (dummy) : "i" (-INIT_ESI)\
+ );\
+ __asm__ __volatile__ (\
+ "movl %1, %0" : "=b" (dummy) : "i" (-INIT_EBX)\
+ );\
+ }
+
+#if defined __PIC__ || defined __USING_SJLJ_EXCEPTIONS__
+int
+main ()
+{
+ return 0;
+}
+#else
+void __attribute__ ((noinline))
+copy (char *p, int size)
+{
+ __builtin_strncpy (p, "good", size);
+}
+
+int g_edi __attribute__((externally_visible)) =INIT_EDI;
+int g_esi __attribute__((externally_visible)) =INIT_ESI;
+int g_ebx __attribute__((externally_visible)) = INIT_EBX;
+int g_ebp __attribute__((externally_visible));
+int g_esp __attribute__((externally_visible));
+int g_ebp_save __attribute__((externally_visible));
+int g_esp_save __attribute__((externally_visible));
+int n_error;
+
+int
+main()
+{
+ int dummy;
+ // Init registers to correct value.
+ // Use following template so that RA will save/restore callee
+ // save registers in prologue/epilogue
+ __asm__ __volatile__ (
+ "movl %1, %0"
+ : "=D" (dummy)
+ : "i" (INIT_EDI)
+ );
+ __asm__ __volatile__ (
+ "movl %1, %0"
+ : "=S" (dummy)
+ : "i" (INIT_ESI)
+ );
+ __asm__ __volatile__ (
+ "movl %1, %0"
+ : "=b" (dummy)
+ : "i" (INIT_EBX)
+ );
+ __asm__ __volatile__ (
+ "movl %ebp," ASMNAME("g_ebp_save")"\n\t"
+ "movl %esp," ASMNAME("g_esp_save")"\n\t"
+ );
+ try {
+ foo();
+ }
+ catch (...)
+ {
+ }
+
+ // Get DI/SI/BX register value after exception caught
+ __asm__ __volatile__ (
+ "movl %edi," ASMNAME("g_edi")"\n\t"
+ "movl %esi," ASMNAME("g_esi")"\n\t"
+ "movl %ebx," ASMNAME("g_ebx")"\n\t"
+ "movl %ebp," ASMNAME("g_ebp")"\n\t"
+ "movl %esp," ASMNAME("g_esp")"\n\t"
+ );
+
+ // Check if DI/SI/BX register value are the same as before calling
+ // foo.
+ if (g_edi != INIT_EDI)
+ {
+ n_error++;
+#ifdef DEBUG
+ printf("edi=%d, correct value:%d\n", g_edi, INIT_EDI);
+#endif
+ }
+ if (g_esi != INIT_ESI)
+ {
+ n_error++;
+#ifdef DEBUG
+ printf("esi=%d, correct value:%d\n", g_esi, INIT_ESI);
+#endif
+ }
+ if (g_ebx != INIT_EBX)
+ {
+ n_error++;
+#ifdef DEBUG
+ printf("ebx=%d, correct value:%d\n", g_ebx, INIT_EBX);
+#endif
+ }
+ if (g_ebp != g_ebp_save)
+ {
+ n_error++;
+#ifdef DEBUG
+ printf("ebp=0x%x, correct value:0x%x\n", g_ebp, g_ebp_save);
+#endif
+ }
+ if (g_esp != g_esp_save)
+ {
+ n_error++;
+#ifdef DEBUG
+ printf("esp=0x%x, correct value:0x%x\n", g_esp, g_esp_save);
+#endif
+ }
+ if (n_error !=0)
+ abort();
+ return 0;
+}
+#endif
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/throw-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/throw-1.C
new file mode 100644
index 000000000..3eddc1d02
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/throw-1.C
@@ -0,0 +1,62 @@
+/* { dg-do run } */
+/* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } "*" "" } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int t_align __attribute__((aligned(ALIGNMENT)));
+
+
+int global, global2;
+void bar()
+{
+ volatile t_align a = 1;
+ int i,j,k,l,m,n;
+ i=j=k=0;
+ for (i=0; i < global; i++)
+ for (j=0; j < i; j++)
+ for (k=0; k < j; k++)
+ for (l=0; l < k; l++)
+ for (m=0; m < l; m++)
+ for (n=0; n < m; n++)
+ global2 = k;
+ if (check_int ((int *) &a, __alignof__(a)) != a)
+ abort ();
+ throw 0;
+}
+
+void foo()
+{
+ bar();
+}
+
+int main()
+{
+ int ll = 1;
+ int i = 0,j = 1,k = 2,l = 3,m = 4,n = 5;
+ try {
+ for (; i < global; i++)
+ for (; j < i; j++)
+ for (; k < j; k++)
+ for (; l < k; l++)
+ for (; m < l; m++)
+ for (; n < m; n++)
+ global2 = k;
+ foo();
+ }
+ catch (...)
+ {
+ }
+ ll = i+j+k+l+m+n;
+ if (ll != 15)
+ {
+#ifdef DEBUG
+ printf("FAIL: sum %d != 15\n", ll);
+#endif
+ abort();
+ }
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/throw-2.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/throw-2.C
new file mode 100644
index 000000000..63a8c6e7c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/throw-2.C
@@ -0,0 +1,53 @@
+/* { dg-do run } */
+/* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } "*" "" } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int t_align __attribute__((aligned(ALIGNMENT)));
+
+
+int global, global2;
+void bar()
+{
+ volatile t_align a = 1;
+ int i,j,k;
+ i=j=k=0;
+ for (i=0; i < global; i++)
+ for (j=0; j < i; j++)
+ global2 = k;
+ if (check_int ((int *) &a, __alignof__(a)) != a)
+ abort ();
+ throw 0;
+}
+
+int main()
+{
+ int ll = 1;
+ int i = 0,j = 1,k = 2,l = 3,m = 4,n = 5;
+ try {
+ for (; i < global; i++)
+ for (; j < i; j++)
+ for (; k < j; k++)
+ for (; l < k; l++)
+ for (; m < l; m++)
+ for (; n < m; n++)
+ global2 = k;
+ bar ();
+ }
+ catch (...)
+ {
+ }
+ ll = i+j+k+l+m+n;
+ if (ll != 15)
+ {
+#ifdef DEBUG
+ printf("FAIL: sum %d != 15\n", ll);
+#endif
+ abort();
+ }
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/throw-3.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/throw-3.C
new file mode 100644
index 000000000..d3e53b829
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/throw-3.C
@@ -0,0 +1,52 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int t_align __attribute__((aligned(ALIGNMENT)));
+
+
+int global, global2;
+void bar()
+{
+ volatile t_align a = 1;
+ int i,j,k;
+ i=j=k=0;
+ for (i=0; i < global; i++)
+ for (j=0; j < i; j++)
+ global2 = k;
+ throw 0;
+ if (check_int ((int *) &a, __alignof__(a)) != a)
+ abort ();
+}
+
+int main()
+{
+ int ll = 1;
+ int i = 0,j = 1,k = 2,l = 3,m = 4,n = 5;
+ try {
+ for (; i < global; i++)
+ for (; j < i; j++)
+ for (; k < j; k++)
+ for (; l < k; l++)
+ for (; m < l; m++)
+ for (; n < m; n++)
+ global2 = k;
+ bar ();
+ }
+ catch (...)
+ {
+ }
+ ll = i+j+k+l+m+n;
+ if (ll != 15)
+ {
+#ifdef DEBUG
+ printf("FAIL: sum %d != 15\n", ll);
+#endif
+ abort();
+ }
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/throw-4.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/throw-4.C
new file mode 100644
index 000000000..52e6f7ff7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/throw-4.C
@@ -0,0 +1,55 @@
+/* { dg-do run } */
+/* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } "*" "" } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int t_align __attribute__((aligned(ALIGNMENT)));
+
+
+int global, global2;
+void bar()
+{
+ volatile t_align a = 1;
+ int i,j,k;
+ i=j=k=0;
+ for (i=0; i < global; i++)
+ for (j=0; j < i; j++)
+ {
+ global2 = k;
+ throw 0;
+ }
+ if (check_int ((int *) &a, __alignof__(a)) != a)
+ abort ();
+}
+
+int main()
+{
+ int ll = 1;
+ int i = 0,j = 1,k = 2,l = 3,m = 4,n = 5;
+ try {
+ for (; i < global; i++)
+ for (; j < i; j++)
+ for (; k < j; k++)
+ for (; l < k; l++)
+ for (; m < l; m++)
+ for (; n < m; n++)
+ global2 = k;
+ bar ();
+ }
+ catch (...)
+ {
+ }
+ ll = i+j+k+l+m+n;
+ if (ll != 15)
+ {
+#ifdef DEBUG
+ printf("FAIL: sum %d != 15\n", ll);
+#endif
+ abort();
+ }
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-0.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-0.C
new file mode 100644
index 000000000..b1e79d892
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-0.C
@@ -0,0 +1,12 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
+
+#include "test-unwind.h"
+
+#if !defined __PIC__ && !defined __USING_SJLJ_EXCEPTIONS__
+void __attribute__ ((noinline)) foo()
+{
+ ALTER_REGS();
+ // Throw the except and expect returning to main
+ throw 1;
+}
+#endif
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-1.C
new file mode 100644
index 000000000..d61b1ba75
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-1.C
@@ -0,0 +1,16 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
+
+#include "test-unwind.h"
+
+#if !defined __PIC__ && !defined __USING_SJLJ_EXCEPTIONS__
+/* Test situation 1: Stack really realign without DRAP */
+void __attribute__ ((noinline))
+foo ()
+{
+ int __attribute__ ((aligned(64))) a=1;
+ if (check_int (&a, __alignof__(a)) != a)
+ abort ();
+ ALTER_REGS();
+ throw a;
+}
+#endif
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-2.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-2.C
new file mode 100644
index 000000000..7ed0a8d14
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-2.C
@@ -0,0 +1,29 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
+
+#include "test-unwind.h"
+
+#if !defined __PIC__ && !defined __USING_SJLJ_EXCEPTIONS__
+/* Test situation 2: stack really realign with DRAP reg CX */
+void __attribute__ ((noinline))
+foo ()
+{
+ int __attribute__ ((aligned(64))) a=4;
+ char * s = (char *) __builtin_alloca (a + 1);
+
+ copy (s, a);
+ if (__builtin_strncmp (s, "good", a) != 0)
+ {
+#ifdef DEBUG
+ s[a] = '\0';
+ printf ("Failed: %s != good\n", s);
+#endif
+ abort ();
+ }
+
+ if (check_int (&a, __alignof__(a)) != a)
+ abort ();
+
+ ALTER_REGS();
+ throw a;
+}
+#endif
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-3.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-3.C
new file mode 100644
index 000000000..e3368bfd9
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-3.C
@@ -0,0 +1,35 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
+
+#include "test-unwind.h"
+
+#if !defined __PIC__ && !defined __USING_SJLJ_EXCEPTIONS__
+/* Test situation 3: Stack realign really happen with DRAP reg DI */
+void __attribute__ ((noinline)) __attribute__ ((regparm(3)))
+bar (int arg1, int arg2, int arg3)
+{
+ int __attribute__ ((aligned(64))) a=1;
+ char * s = (char *) __builtin_alloca (arg3 + 1);
+
+ copy (s, arg3);
+ if (__builtin_strncmp (s, "good", arg3) != 0)
+ {
+#ifdef DEBUG
+ s[arg3] = '\0';
+ printf ("Failed: %s != good\n", s);
+#endif
+ abort ();
+ }
+
+ if (check_int (&a, __alignof__(a)) != a)
+ abort ();
+
+ ALTER_REGS();
+ throw arg1+arg2+arg3+a;
+}
+
+void
+foo()
+{
+ bar (1,2,3);
+}
+#endif
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-4.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-4.C
new file mode 100644
index 000000000..fddf27625
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-4.C
@@ -0,0 +1,17 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
+
+#include "test-unwind.h"
+
+#if !defined __PIC__ && !defined __USING_SJLJ_EXCEPTIONS__
+volatile int __attribute__ ((aligned(32))) g_a=1;
+/* Test situation 4: no Drap and stack realign doesn't really happen */
+void __attribute__ ((noinline))
+foo()
+{
+ int i;
+ ALTER_REGS();
+ for (i=0; i < 10; i++)
+ g_a++;
+ throw g_a;
+}
+#endif
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-5.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-5.C
new file mode 100644
index 000000000..e3e1a855f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-5.C
@@ -0,0 +1,31 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
+
+#include "test-unwind.h"
+
+#if !defined __PIC__ && !defined __USING_SJLJ_EXCEPTIONS__
+double g_f=1.0;
+/* Test situation 5: Stack realign dosn't really happen with DRAP reg CX */
+void __attribute__ ((noinline)) __attribute__ ((regparm(2)))
+bar(int arg1, int arg2, int arg3, int arg4)
+{
+ char * s = (char *) __builtin_alloca (arg4 + 1);
+
+ copy (s, arg4);
+ if (__builtin_strncmp (s, "good", arg4) != 0)
+ {
+#ifdef DEBUG
+ s[arg4] = '\0';
+ printf ("Failed: %s != good\n", s);
+#endif
+ abort ();
+ }
+ ALTER_REGS();
+ if (g_f) throw arg1+arg2+arg3+ g_f;
+}
+
+void __attribute__((noinline))
+foo()
+{
+ bar(1,2,3,4);
+}
+#endif
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-6.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-6.C
new file mode 100644
index 000000000..f1188f8a2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/stackalign/unwind-6.C
@@ -0,0 +1,31 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
+
+#include "test-unwind.h"
+
+#if !defined __PIC__ && !defined __USING_SJLJ_EXCEPTIONS__
+double g_f=1.0;
+/* Test situation 6: Stack realign dosn't really happen with DRAP reg DI */
+void __attribute__ ((noinline)) __attribute__ ((regparm(3)))
+bar(int arg1, int arg2, int arg3, int arg4)
+{
+ char * s = (char *) __builtin_alloca (arg4 + 1);
+
+ copy (s, arg4);
+ if (__builtin_strncmp (s, "good", arg4) != 0)
+ {
+#ifdef DEBUG
+ s[arg4] = '\0';
+ printf ("Failed: %s != good\n", s);
+#endif
+ abort ();
+ }
+ ALTER_REGS();
+ if (g_f) throw arg1+arg2+arg3+ g_f;
+}
+
+void __attribute__((noinline))
+foo()
+{
+ bar(1,2,3,4);
+}
+#endif
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/str_empty.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/str_empty.C
new file mode 100644
index 000000000..e24f0b6ac
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/str_empty.C
@@ -0,0 +1,15 @@
+// PR c++/31617
+// Segfault in integer_zerop
+// Origin: Andrew Pinski <andrew_pinski@playstation.sony.com>
+// { dg-do compile }
+
+struct polynomial {
+ ~polynomial ();
+};
+
+void spline_rep1 ()
+{
+ new polynomial[0]; // { dg-bogus "allocating zero-element array" }
+}
+
+
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/type-generic-1.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/type-generic-1.C
new file mode 100644
index 000000000..4d82592af
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/type-generic-1.C
@@ -0,0 +1,13 @@
+/* Do the type-generic tests. Unlike pr28796-2.c, we test these
+ without any fast-math flags. */
+
+/* { dg-do run } */
+/* { dg-add-options ieee } */
+/* { dg-skip-if "No Inf/NaN support" { spu-*-* } } */
+
+#include "../../gcc.dg/tg-tests.h"
+
+int main(void)
+{
+ return main_tests ();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-16.inc b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-16.inc
new file mode 100644
index 000000000..7507305e3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-16.inc
@@ -0,0 +1,50 @@
+/* Test fragment for vectors with 16 elements. */
+
+#ifndef UNSUPPORTED
+
+constexpr V in1[] = { { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
+ { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
+ { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
+ { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
+ { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }};
+
+
+
+
+
+constexpr VI mask1[] = { { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, },
+ { 0x10, 0x21, 0x32, 0x43, 0x54, 0x65, 0x76, 0x87,
+ 0x98, 0xa9, 0xba, 0xcb, 0xdc, 0xed, 0xfe, 0xff } ,
+ { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 },
+ { 0, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13, 15 },
+ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }};
+
+constexpr V out1[] = { { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
+ { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
+ { 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 },
+ { 1, 3, 5, 7, 9, 11, 13, 15, 2, 4, 6, 8, 10, 12, 14, 16 },
+ { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 },
+};
+
+constexpr V in2[] = { { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 },
+ { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 },
+ { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 },
+ { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 },
+ { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }};
+
+
+constexpr V in3 = { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45 };
+
+constexpr VI mask2[] = { { 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 },
+ { 7, 6, 5, 4, 16, 17, 18, 19, 31, 30, 29, 28, 3, 2, 1, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63 }};
+constexpr V out2[] = { { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 },
+ { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45 },
+ { 17, 16, 15, 14, 30, 31, 32, 33, 45, 44, 43, 42, 13, 12, 11, 10 },
+ { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 },
+ { 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45 },
+};
+
+#endif
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-2.inc b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-2.inc
new file mode 100644
index 000000000..68055835c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-2.inc
@@ -0,0 +1,22 @@
+/* Test fragment for vectors of 2 elements. */
+
+#ifndef UNSUPPORTED
+
+constexpr V in1[] = { { A, B}, {A, B}, { A, B},
+ { A, B}, {X, Y}, { X, Y}};
+constexpr VI mask1[] = { {0, 1}, {(unsigned)-16, 1}, {1, 0},
+ {0, 0}, { 1, 1}, {1, 0}};
+constexpr V out1[] = { {A, B}, {A, B}, {B, A},
+ {A, A}, {Y, Y}, {Y, X}};
+
+constexpr V in2[] = { { A, B}, {A, B}, {A, B}, {A, B},
+ { A, B}, {A, B}, {A, B}};
+constexpr V in3 = {X, Y};
+constexpr VI mask2[] = { {0, 1}, {2, 3}, {0, 2}, {2, 1},
+ {3, 0}, {0, 0}, {3, 3}};
+
+constexpr V out2[] = { {A, B}, {X, Y}, {A, X}, {X, B},
+ {Y, A}, {A, A}, {Y, Y}};
+
+
+#endif
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-4.inc b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-4.inc
new file mode 100644
index 000000000..2a18812e1
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-4.inc
@@ -0,0 +1,25 @@
+/* Test fragment for vectors of 4 elements. */
+
+#ifndef UNSUPPORTED
+
+constexpr V in1[] = { {A, B, C, D}, {A, B, C, D}, {A, B, C, D}, {A, B, C, D},
+ {A, B, C, D}, {W, X, Y, Z}, {W, X, Y, Z}, {W, X, Y, Z}};
+
+constexpr VI mask1[] = { {0, 1, 2, 3}, {0+1*4, 1+2*4, 2+3*4, 3+4*4}, {3, 2, 1, 0},
+ {0, 3, 2, 1}, {0, 2, 1, 3}, {3, 1, 2, 0}, {0, 0, 0, 0},
+ {1, 2, 1, 2}};
+
+constexpr V out1[] = { { A, B, C, D}, {A, B, C, D}, {D, C, B, A}, {A, D, C, B},
+ { A, C, B, D}, {Z, X, Y, W}, {W, W, W, W}, {X, Y, X, Y}};
+
+
+constexpr V in2[] = { {A, B, C, D}, {A, B, C, D}, {A, B, C, D}, {A, B, C, D},
+ {A, B, C, D}, {A, B, C, D}};
+constexpr V in3 = {W, X, Y, Z};
+constexpr VI mask2[] = { {0, 1, 2, 3}, {4, 5, 6, 7}, {0, 4, 1, 5}, {0, 7, 4, 3},
+ {0, 0, 0, 0}, {7, 7, 7, 7}};
+constexpr V out2[] = { {A, B, C, D}, {W, X, Y, Z}, {A, W, B, X}, {A, Z, W, D},
+ {A, A, A, A}, {Z, Z, Z, Z}};
+
+
+#endif
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-8.inc b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-8.inc
new file mode 100644
index 000000000..177e9f166
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-8.inc
@@ -0,0 +1,56 @@
+/* Test fragment for vectors of 8 elements. */
+
+#ifndef UNSUPPORTED
+
+constexpr V in1[] = { { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { A2, B2, C2, D2, E2, F2, G2, H2 },
+ { A2, B2, C2, D2, E2, F2, G2, H2 },
+ { A2, B2, C2, D2, E2, F2, G2, H2 }};
+
+constexpr VI mask1[] = { { 0, 1, 2, 3, 4, 5, 6, 7 },
+ { 0x10, 0x21, 0x32, 0x43, 0x54, 0x65, 0x76, 0x87 },
+ { 7, 6, 5, 4, 3, 2, 1, 0 },
+ { 7, 0, 5, 3, 2, 4, 1, 6 },
+ { 0, 2, 1, 3, 4, 6, 5, 7 },
+ { 3, 1, 2, 0, 7, 5, 6, 4 },
+ { 0, 0, 0, 0 },
+ { 1, 6, 1, 6, 1, 6, 1, 6 }};
+
+constexpr V out1[] = { { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { H1, G1, F1, E1, D1, C1, B1, A1 },
+ { H1, A1, F1, D1, C1, E1, B1, G1 },
+ { A1, C1, B1, D1, E1, G1, F1, H1 },
+ { D2, B2, C2, A2, H2, F2, G2, E2 },
+ { A2, A2, A2, A2, A2, A2, A2, A2 },
+ { B2, G2, B2, G2, B2, G2, B2, G2 }};
+
+constexpr V in2 [] = { { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { A1, B1, C1, D1, E1, F1, G1, H1 }};
+
+
+constexpr V in3 = { A2, B2, C2, D2, E2, F2, G2, H2};
+
+constexpr VI mask2[] = { { 0, 1, 2, 3, 4, 5, 6, 7 },
+ { 8, 9, 10, 11, 12, 13, 14, 15 },
+ { 0, 8, 1, 9, 2, 10, 3, 11 },
+ { 0, 15, 4, 11, 12, 3, 7, 8 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0x1e, 0x2e, 0x3e, 0x4e, 0x5e, 0x6e, 0x7e, 0x8e }};
+
+constexpr V out2[] = { { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { A2, B2, C2, D2, E2, F2, G2, H2 },
+ { A1, A2, B1, B2, C1, C2, D1, D2 },
+ { A1, H2, E1, D2, E2, D1, H1, A2 },
+ { A1, A1, A1, A1, A1, A1, A1, A1 },
+ { G2, G2, G2, G2, G2, G2, G2, G2 }};
+
+#endif
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-main.inc b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-main.inc
new file mode 100644
index 000000000..697bd0197
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-main.inc
@@ -0,0 +1,28 @@
+/* Driver fragment for __builtin_shuffle of any vector shape. */
+
+// { dg-do run { target c++11 } }
+
+extern "C" void abort(void);
+
+int main()
+{
+#ifndef UNSUPPORTED
+ int i;
+
+ for (i = 0; i < sizeof(in1)/sizeof(in1[0]); ++i)
+ {
+ V r = __builtin_shuffle(in1[i], mask1[i]);
+ if (__builtin_memcmp(&r, &out1[i], sizeof(V)) != 0)
+ abort();
+ }
+
+ for (i = 0; i < sizeof(in2)/sizeof(in2[0]); ++i)
+ {
+ V r = __builtin_shuffle(in2[i], in3, mask2[i]);
+ if (__builtin_memcmp(&r, &out2[i], sizeof(V)) != 0)
+ abort();
+ }
+#endif
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v16hi.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v16hi.C
new file mode 100644
index 000000000..501d9dacc
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v16hi.C
@@ -0,0 +1,7 @@
+// { dg-do run { target c++11 } }
+
+typedef unsigned short V __attribute__((vector_size(32)));
+typedef V VI;
+
+#include "vshuf-16.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v16qi.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v16qi.C
new file mode 100644
index 000000000..1cc8bea0c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v16qi.C
@@ -0,0 +1,7 @@
+// { dg-do run { target c++11 } }
+
+typedef unsigned char V __attribute__((vector_size(16)));
+typedef V VI;
+
+#include "vshuf-16.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v2df.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v2df.C
new file mode 100644
index 000000000..71a6ac4c3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v2df.C
@@ -0,0 +1,16 @@
+// // { dg-do run { target c++11 } }
+#if __SIZEOF_DOUBLE__ == 8 && __SIZEOF_LONG_LONG__ == 8
+typedef double V __attribute__((vector_size(16)));
+typedef unsigned long long VI __attribute__((vector_size(16)));
+#else
+#define UNSUPPORTED
+#endif
+
+#define A 0.69314718055994530942
+#define B 2.7182818284590452354
+
+#define X 3.14159265358979323846
+#define Y 1.41421356237309504880
+
+#include "vshuf-2.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v2di.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v2di.C
new file mode 100644
index 000000000..dd521f2e4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v2di.C
@@ -0,0 +1,17 @@
+// // { dg-do run { target c++11 } }
+
+#if __SIZEOF_LONG_LONG__ == 8
+typedef unsigned long long V __attribute__((vector_size(16)));
+typedef V VI;
+#else
+#define UNSUPPORTED
+#endif
+
+#define A 0x1112131415161718
+#define B 0x2122232425262728
+
+#define X 0xc1c2c3c4c5c6c7c8
+#define Y 0xd1d2d3d4d5d6d7d8
+
+#include "vshuf-2.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v2sf.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v2sf.C
new file mode 100644
index 000000000..274dacdae
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v2sf.C
@@ -0,0 +1,22 @@
+// // { dg-do run { target c++11 } }
+#if __SIZEOF_FLOAT__ == 4
+typedef float V __attribute__((vector_size(8)));
+# if __SIZEOF_INT__ == 4
+typedef unsigned int VI __attribute__((vector_size(8)));
+# elif __SIZEOF_LONG__ == 4
+typedef unsigned long VI __attribute__((vector_size(8)));
+# else
+# define UNSUPPORTED
+# endif
+#else
+# define UNSUPPORTED
+#endif
+
+#define A 0.69314718055994530942f
+#define B 2.7182818284590452354f
+
+#define X 3.14159265358979323846f
+#define Y 1.41421356237309504880f
+
+#include "vshuf-2.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v2si.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v2si.C
new file mode 100644
index 000000000..36aeb82b7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v2si.C
@@ -0,0 +1,19 @@
+// { dg-do run { target c++11 } }
+#if __SIZEOF_INT__ == 4
+typedef unsigned int V __attribute__((vector_size(8)));
+typedef V VI;
+#elif __SIZEOF_LONG__ == 4
+typedef unsigned long V __attribute__((vector_size(8)));
+typedef V VI;
+#else
+#define UNSUPPORTED
+#endif
+
+#define A 0x11121314
+#define B 0x21222324
+
+#define X 0xd1d2d3d4
+#define Y 0xe1e2e3e4
+
+#include "vshuf-2.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v4df.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v4df.C
new file mode 100644
index 000000000..a1694b21e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v4df.C
@@ -0,0 +1,21 @@
+// { dg-do run { target c++11 } }
+
+#if __SIZEOF_DOUBLE__ == 8 && __SIZEOF_LONG_LONG__ == 8
+typedef double V __attribute__((vector_size(32)));
+typedef unsigned long long VI __attribute__((vector_size(32)));
+#else
+#define UNSUPPORTED
+#endif
+
+#define A 0.69314718055994530942
+#define B 2.7182818284590452354
+#define C 2.30258509299404568402
+#define D 1.4426950408889634074
+
+#define W 0.31830988618379067154
+#define X 3.14159265358979323846
+#define Y 1.41421356237309504880
+#define Z 0.70710678118654752440
+
+#include "vshuf-4.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v4di.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v4di.C
new file mode 100644
index 000000000..8a5e5c507
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v4di.C
@@ -0,0 +1,21 @@
+// { dg-do run { target c++11 } }
+
+#if __SIZEOF_LONG_LONG__ == 8
+typedef unsigned long long V __attribute__((vector_size(32)));
+typedef V VI;
+#else
+#define UNSUPPORTED
+#endif
+
+#define A 0x1112131415161718
+#define B 0x2122232425262728
+#define C 0x3132333435363738
+#define D 0x4142434445464748
+
+#define W 0xc1c2c3c4c5c6c7c8
+#define X 0xd1d2d3d4d5d6d7d8
+#define Y 0xe1e2e3e4e5e6e7e8
+#define Z 0xf1f2f3f4f5f6f7f8
+
+#include "vshuf-4.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v4sf.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v4sf.C
new file mode 100644
index 000000000..aa67dbbe6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v4sf.C
@@ -0,0 +1,28 @@
+// { dg-do run { target c++11 } }
+
+
+#if __SIZEOF_FLOAT__ == 4
+typedef float V __attribute__((vector_size(16)));
+# if __SIZEOF_INT__ == 4
+typedef unsigned int VI __attribute__((vector_size(16)));
+# elif __SIZEOF_LONG__ == 4
+typedef unsigned long VI __attribute__((vector_size(16)));
+# else
+# define UNSUPPORTED
+# endif
+#else
+# define UNSUPPORTED
+#endif
+
+#define A 0.69314718055994530942f
+#define B 2.7182818284590452354f
+#define C 2.30258509299404568402f
+#define D 1.4426950408889634074f
+
+#define W 0.31830988618379067154f
+#define X 3.14159265358979323846f
+#define Y 1.41421356237309504880f
+#define Z 0.70710678118654752440f
+
+#include "vshuf-4.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v4si.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v4si.C
new file mode 100644
index 000000000..4d377c114
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v4si.C
@@ -0,0 +1,24 @@
+// { dg-do run { target c++11 } }
+
+#if __SIZEOF_INT__ == 4
+typedef unsigned int V __attribute__((vector_size(16)));
+typedef V VI;
+#elif __SIZEOF_LONG__ == 4
+typedef unsigned long V __attribute__((vector_size(16)));
+typedef V VI;
+#else
+# define UNSUPPORTED
+#endif
+
+#define A 0x11121314
+#define B 0x21222324
+#define C 0x31323334
+#define D 0x41424344
+
+#define W 0xc1c2c3c4
+#define X 0xd1d2d3d4
+#define Y 0xe1e2e3e4
+#define Z 0xf1f2f3f4
+
+#include "vshuf-4.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v8hi.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v8hi.C
new file mode 100644
index 000000000..c2be87f5b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v8hi.C
@@ -0,0 +1,25 @@
+// { dg-do run { target c++11 } }
+
+typedef unsigned short V __attribute__((vector_size(16)));
+typedef V VI;
+
+#define A1 0x1112
+#define B1 0x2122
+#define C1 0x3132
+#define D1 0x4142
+#define E1 0x5152
+#define F1 0x6162
+#define G1 0x7172
+#define H1 0x8182
+
+#define A2 0x9192
+#define B2 0xa1a2
+#define C2 0xb1b2
+#define D2 0xc1c2
+#define E2 0xd1d2
+#define F2 0xe1e2
+#define G2 0xf1f2
+#define H2 0x0102
+
+#include "vshuf-8.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v8qi.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v8qi.C
new file mode 100644
index 000000000..5ec040e14
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v8qi.C
@@ -0,0 +1,25 @@
+// { dg-do run { target c++11 } }
+
+typedef unsigned char V __attribute__((vector_size(8)));
+typedef V VI;
+
+#define A1 0x11
+#define B1 0x12
+#define C1 0x13
+#define D1 0x14
+#define E1 0x15
+#define F1 0x16
+#define G1 0x17
+#define H1 0x18
+
+#define A2 0xf1
+#define B2 0xf2
+#define C2 0xf3
+#define D2 0xf4
+#define E2 0xf5
+#define F2 0xf6
+#define G2 0xf7
+#define H2 0xf8
+
+#include "vshuf-8.inc"
+#include "vshuf-main.inc"
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v8si.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v8si.C
new file mode 100644
index 000000000..27631d775
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/vshuf-v8si.C
@@ -0,0 +1,32 @@
+// { dg-do run { target c++11 } }
+
+#if __SIZEOF_INT__ == 4
+typedef unsigned int V __attribute__((vector_size(32)));
+typedef V VI;
+#elif __SIZEOF_LONG__ == 4
+typedef unsigned long V __attribute__((vector_size(32)));
+typedef V VI;
+#else
+# define UNSUPPORTED
+#endif
+
+#define A1 0x11121314
+#define B1 0x21222324
+#define C1 0x31323334
+#define D1 0x41424344
+#define E1 0x51525354
+#define F1 0x61626364
+#define G1 0x71727374
+#define H1 0x81828384
+
+#define A2 0x91929394
+#define B2 0xa1a2a3a4
+#define C2 0xb1b2b3b4
+#define D2 0xc1c2c3c4
+#define E2 0xd1d2d3d4
+#define F2 0xe1e2e3e4
+#define G2 0xf1f2f3f4
+#define H2 0x01020304
+
+#include "vshuf-8.inc"
+#include "vshuf-main.inc"