This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GCC GNAT 6856 & BLKmode question


I was looking into GCC GNAT 6856 which was reported against the HPPA
platform and found that I could reproduce it on IA64 Linux as well and I
think it can occur on other platforms depending on their alignment
requirements.  I have tracked down where things are going wrong but I
don't really understand what should be happening and was hoping someone
could offer some advice.  I believe the bug is in the ARRAY_TYPE code of
layout_type() in stor-layout.c (starts in line 1494).  There is a chunk
of code which sets TYPE_MODE to BLKmode and sets TYPE_NO_FORCE_BLK.  I
wonder if this type setting is supposed to ever get outside of
stor-layout.c because nothing else outside of stor-layout.c ever checks
TYPE_NO_FORCE_BLK.  The end result of this code is that GCC tries to do
a move between a BLKmode type and a non BLKmode type and that causes an
ICE.  This apparently does not happen on IA32 Linux GCC probably because
of the alignment rules and it doesn't happen on IA64 HP-UX because I set
MEMBER_TYPE_FORCES_BLK.  This if statement is also very odd in that it
checks "TYPE_MODE (type) != BLKmode" twice which makes me wonder if it
got mangled at some point.

	    if (TYPE_MODE (type) != BLKmode
		&& STRICT_ALIGNMENT && TYPE_ALIGN (type) < BIGGEST_ALIGNMENT
		&& TYPE_ALIGN (type) < GET_MODE_ALIGNMENT (TYPE_MODE (type))
		&& TYPE_MODE (type) != BLKmode)
	      {
		TYPE_NO_FORCE_BLK (type) = 1;
		TYPE_MODE (type) = BLKmode;
	      }

Here is the test case that fails with -O1 or -O2, it dies when
initializing _user_exns to _PD_repoID.


	class A {
	public:
	  inline A(const char* const* user_excns) {}
	  virtual ~A() {}
	};
	
	static const char* _PD_repoId = "BLA";
	
	class B : public A
	{
	public:
	  inline B(): A(_user_exns) {}
	  static const char* const _user_exns[];
	};
	
	const char* const B::_user_exns[] = {
	  _PD_repoId
	};


Steve Ellcey
sje@cup.hp.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]