Article View: gnu.g++.bug
Article #946(none)
From: dak
Date: Fri, 11 Sep 1992 18:06
Date: Fri, 11 Sep 1992 18:06
40 lines
1154 bytes
1154 bytes
Subject: g++-2.2.2 template constants work not in asm statements
The following will bomb the cc1plus with signal 6 (no line numbers given)
when FAULTY is defined. It will work with an instruction replacing the
asm, even with templates.
#ifdef FAULTY
template <const unsigned k>
#else
const unsigned k=300;
#endif
class modular {
public:
unsigned value;
modular(unsigned u=0)
{
value = u;
}
modular operator *(const modular &b)
{
unsigned __u;
asm("mull %2; divl %3" : "=d" (__u) : "&a" (value)
, "g" (b.value) , "g" (k));
return modular(__u);
}
};
main()
{
#ifdef FAULTY
typedef modular<300> mod3;
#else
typedef modular mod3;
#endif
mod3 gurke(3U), heinz;
heinz = gurke * mod3(200U);
return 0;
}
Technical Details
Message-ID:
<9209111406.AA14240@rama>Path:
arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!pool.INformatik.rwth-aachen.DE!dakShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!pool.INformatik.rwth-aachen.DE!dak From: dak@pool.INformatik.rwth-aachen.DE Newsgroups: gnu.g++.bug Subject: (none) Message-ID: <9209111406.AA14240@rama> Date: 11 Sep 92 18:06:00 GMT Sender: gnulists@ai.mit.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 40 Approved: bug-g++@prep.ai.mit.edu