Backport PRs 40033, 41020, 41345, 41497, 41673, 41775, 41785, 41801, 41863

2009-10-30  H.J. Lu  <hongjiu.lu@intel.com>

	Backport from mainline:
	2009-10-30  Dodji Seketeli  <dodji@redhat.com>

	PR c++/41863
	* g++.dg/template/sizeof12.C: New test.

	2009-10-29  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/41775
	* g++.dg/torture/pr41775.C: New testcase.

	2009-10-28  Jakub Jelinek  <jakub@redhat.com>

	PR debug/41801
	* g++.dg/ext/sync-3.C: New test.

	2009-10-27  Jakub Jelinek  <jakub@redhat.com>

	PR c++/41020
	* g++.dg/lookup/extern-c-redecl5.C: Fix up regexp.

	2009-10-26  Jakub Jelinek  <jakub@redhat.com>

	PR bootstrap/41345
	* gcc.dg/pr41345.c: New test.

	2009-10-26  Dodji Seketeli  <dodji@redhat.com>

	PR c++/41785
	* g++.dg/cpp0x/variadic96.C: New test.

	2009-10-26  Dodji Seketeli  <dodji@redhat.com>

	PR c++/41020
	* g++.dg/lookup/extern-c-redecl2.C: New test.
	* g++.dg/lookup/extern-c-redecl3.C: Likewise.
	* g++.dg/lookup/extern-c-redecl4.C: Likewise.
	* g++.dg/lookup/extern-c-redecl5.C: Likewise.

	2009-10-23  Joseph Myers  <joseph@codesourcery.com>

	PR c/40033
	* gcc.dg/noncompile/pr40033-1.c: New test.

	2009-10-23  Joseph Myers  <joseph@codesourcery.com>

	PR c/41673
	* gcc.dg/Wstrict-aliasing-bogus-vla-1.c: New test.

	2009-10-21  Sebastian Pop  <sebastian.pop@amd.com>

	PR tree-optimization/41497
	* gcc.dg/tree-ssa/pr41497.c: New.

From-SVN: r153759
This commit is contained in:
H.J. Lu 2009-10-30 16:04:41 +00:00 committed by H.J. Lu
parent b5a0520c21
commit fa9f1e1404
13 changed files with 545 additions and 0 deletions

View File

@ -1,3 +1,59 @@
2009-10-30 H.J. Lu <hongjiu.lu@intel.com>
Backport from mainline:
2009-10-30 Dodji Seketeli <dodji@redhat.com>
PR c++/41863
* g++.dg/template/sizeof12.C: New test.
2009-10-29 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/41775
* g++.dg/torture/pr41775.C: New testcase.
2009-10-28 Jakub Jelinek <jakub@redhat.com>
PR debug/41801
* g++.dg/ext/sync-3.C: New test.
2009-10-27 Jakub Jelinek <jakub@redhat.com>
PR c++/41020
* g++.dg/lookup/extern-c-redecl5.C: Fix up regexp.
2009-10-26 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/41345
* gcc.dg/pr41345.c: New test.
2009-10-26 Dodji Seketeli <dodji@redhat.com>
PR c++/41785
* g++.dg/cpp0x/variadic96.C: New test.
2009-10-26 Dodji Seketeli <dodji@redhat.com>
PR c++/41020
* g++.dg/lookup/extern-c-redecl2.C: New test.
* g++.dg/lookup/extern-c-redecl3.C: Likewise.
* g++.dg/lookup/extern-c-redecl4.C: Likewise.
* g++.dg/lookup/extern-c-redecl5.C: Likewise.
2009-10-23 Joseph Myers <joseph@codesourcery.com>
PR c/40033
* gcc.dg/noncompile/pr40033-1.c: New test.
2009-10-23 Joseph Myers <joseph@codesourcery.com>
PR c/41673
* gcc.dg/Wstrict-aliasing-bogus-vla-1.c: New test.
2009-10-21 Sebastian Pop <sebastian.pop@amd.com>
PR tree-optimization/41497
* gcc.dg/tree-ssa/pr41497.c: New.
2009-10-30 Tobias Burnus <burnus@net-b.de>
PR fortran/41777
@ -25,6 +81,7 @@
2009-10-21 H.J. Lu <hongjiu.lu@intel.com>
Backport from mainline:
2009-10-16 Richard Guenther <rguenther@suse.de>
PR tree-optimization/41728

View File

@ -0,0 +1,26 @@
// Contributed by Dodji Seketeli <dodji@redhat.com>
// Origin: PR c++/41785
// { dg-options -std=c++0x }
struct a {};
template < typename T, typename ENCLOSING >
struct base;
template < typename... T >
struct derived
: public base< T, derived< T... > >...
{};
template < typename... T>
struct base< a, derived< T... > >
{
typedef derived< T... >
Derived;
};
int main()
{
derived< a > instance;
}

View File

@ -0,0 +1,21 @@
// PR debug/41801
// { dg-do compile }
// { dg-options "-O2 -g" }
struct T
{
void
foo () volatile
{
__sync_lock_release (&t);
__sync_synchronize ();
}
bool t;
};
int
main ()
{
T t = { false };
t.foo ();
}

View File

@ -0,0 +1,21 @@
// Contributed by Dodji Seketeli <dodji@redhat.com>
// Origin PR c++/41020
// { dg-do compile }
extern "C"
{
int fork (void);
}
class frok
{
int this_errno;
friend int fork (void);
};
extern "C" int
fork (void)
{
frok grouped;
return grouped.this_errno;
}

View File

@ -0,0 +1,22 @@
// Contributed by Dodji Seketeli <dodji@redhat.com>
// Origin: PR c++/41020
// { dg-do compile }
// { dg-final { scan-assembler-not "call\[\t \]+_Z4forkv" } }
// { dg-final { scan-assembler "call\[\t \]+fork" } }
extern "C" int fork (void);
void
foo ()
{
extern int fork (void);
fork ();
}
extern "C"
int
fork (void)
{
return 0;
}

View File

@ -0,0 +1,19 @@
// Contributed by Dodji Seketeli <dodji@redhat.com>
// Origin: PR c++/41020
// Avoid the "-ansi -pedantic" option
// { dg-options "" }
// { dg-do compile }
// { dg-final { scan-assembler "call\[\t \]+_Z4forkv" } }
class frok
{
int this_errno;
friend int fork (void);
};
void
foo ()
{
fork ();
}

View File

@ -0,0 +1,18 @@
// Contributed by Dodji Seketeli <dodji@redhat.com>
// Origin: PR c++/41020
// { dg-do compile }
class frok
{
int this_errno;
friend int fork (void); // { dg-error "previous declaration .*?C\\+\\+. linkage" }
};
extern "C" int
fork (void) // { dg-error "conflicts with new declaration .*?C. linkage" }}
{
frok grouped;
return grouped.this_errno;
}

View File

@ -0,0 +1,19 @@
// Contributed by Dodji Seketeli <dodji@redhat.com>
// Origin PR c++/41863
template<int X>
struct Bar
{
};
template<typename T>
class Foo
{
T m_foo;
void
crash()
{
Bar<sizeof(m_foo)> bar;
}
};

View File

@ -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);
}
}
}
}

View File

@ -0,0 +1,10 @@
/* PR 41673: bogus -Wstrict-aliasing warning from VLA dereference. */
/* { dg-do compile } */
/* { dg-options "-std=gnu99 -O2 -Wall" } */
int main(int argc, char *argv[])
{
float x[argc];
float y[argc];
return 0 == __builtin_memcpy(y, x, argc * sizeof(*x));
}

View File

@ -0,0 +1,7 @@
/* ICE from error_mark_node being wrapped in a C_MAYBE_CONST_EXPR. PR
40033. */
void foo()
{
({ 0,; }); /* { dg-error "expected" } */
}

View File

@ -0,0 +1,14 @@
/* PR bootstrap/41345 */
/* { dg-do compile } */
/* { dg-options "-O2 -g -fcompare-debug" } */
void
foo (int *x)
{
int a;
for (a = 0; a < 2; a++)
if (x[a])
goto lab;
__builtin_unreachable ();
lab:;
}

View File

@ -0,0 +1,27 @@
/* { dg-do run } */
/* { dg-options "-Os" } */
extern void abort (void);
unsigned int a;
int b, c;
void
foo (void)
{
b = 0;
do {
for (a = -13; a == 0; a = (unsigned short)a)
c = 1;
b++;
} while (b == 0);
}
int
main ()
{
foo ();
if (a != -13)
abort ();
return 0;
}