The following code should generate outb, outw and outl statements. gcc-3.4.6 produces an ICE: foo.cc: In function `void out(unsigned int, T) [with T = unsigned char]': foo.cc:14: instantiated from here foo.cc:5: internal compiler error: in print_operand, at config/i386/i386.c:7375
gcc-4.1.2 produces an ICE: foo.cc: In function 'void out(unsigned int, T) [with T = unsigned char]': foo.cc:5: internal compiler error: in print_operand, at config/i386/i386.c:7226 gcc-4.3.0 generates wrong code (outs instead of outw) for T=unsigned short foo.cc: Assembler messages: foo.cc:5: Error: suffix or operands invalid for `outs' Code snippet: template <typename T> static inline void out (unsigned port, T val) { asm volatile ("out%z0 %0, %w1" : : "a" (val), "Nd" (port)); } int main() { unsigned char a; unsigned short b; unsigned long c; out (0x80, a); out (0x80, b); out (0x80, c); } -- Summary: Invalid code or ICE for %z constraint Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: inline-asm AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: us15 at os dot inf dot tu-dresden dot de http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31768