Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by Super User
Wed, 27 Nov 1996 00:00
GCC 2.7.2 Error in inline function expansion.
Author: Super User
Date: Wed, 27 Nov 1996 00:00
Date: Wed, 27 Nov 1996 00:00
558 lines
14269 bytes
14269 bytes
GCC 2.7.2 Inline Function expansion Error.
OS: i486-linux
Modified linux-1.2.13 compiled with gcc-2.6.3.
(Linux-FT 1.1 with modificatios to make it backword compatible with
the programs from my Linux-FT 1.0 system)
Binary Utilities: binutils-2.7.0.3
(gas patched with the gnat-3.05 gas-2.7 patch.)
Compiler: gcc-2.7.2 with g77-0.5.18 and gnat-3.05.
./configure --host=i486-linux
Patches Applied:
gnat-3.05 patch: gcc-272.diff
gnat-3.05 patch: msdos.diff
g77-0.5.18 patch: f/gbe/2.7.2.diff
linux patch: gcc-2.7.2-linux.diff
(The patches are not required to generate the error. See Below.)
The 'C' compiler does not expand inline functions properly.
The error was found while trying to re-compile my linux kernel.
The kernel compiled correctly using gcc-2.6.3 but nolonger have
an installed copy of the 2.6.3 compiler. It can't be compiled
with gcc-2.7.2 on my system.
The test program below demonstrates the error resulting in the
following:
gcc -O2 -fomit-frame-pointer -dr -S test.c
test.c: In function `error_function':
test.c:9: inconsistent operand constraints in an `asm'
test.c:9: inconsistent operand constraints in an `asm'
The test program was also compiled with the gcc-2.7.2 compiler
before applying the gnat, g77 and linux patches to confirm that
the error was not in these patches.
Test Progarm: test.c
______________________________________________________________________________
extern __inline__ void __outb_p (unsigned char value, unsigned short port)
{
__asm__ __volatile__ ("out" "b" " %" "b" "0,%" "w" "1" : : "a" (value), "d" (port));
__asm__ __volatile__("outb %al,$0x80");
}
extern __inline__ void __outbc_p (unsigned char value, unsigned short port)
{
__asm__ __volatile__ ("out" "b" " %" "b" "0,%" "" "1" : : "a" (value), "i" (port));
__asm__ __volatile__("outb %al,$0x80") ;
}
error_function() /* Generated by expanding macroes in io.h and bitops.h */
{
((__builtin_constant_p(( 0xf1 )) && ( 0xf1 ) < 256) ? __outbc_p(( 0 ),( 0xf1 )) : __outb_p(( 0 ),( 0xf1 ))) ;
((__builtin_constant_p(( 0xf1 )) && ( 0xf1 ) < 256) ?
printf( "CONST\n" ) : printf( "REG\n" ));
__asm__ __volatile__ ("out" "b" " %" "b" "0,%" "" "1" : : "a" ((0)), "i" (0xf1) );
__asm__ __volatile__("outb %al,$0x80") ;
}
______________________________________________________________________________
GCC 2.7.2 rtl dump:
______________________________________________________________________________
;; Function __outb_p
(note 2 0 4 "" NOTE_INSN_DELETED)
(insn 4 2 8 (set (reg:SI 22)
(mem:SI (reg:SI 17))) -1 (nil)
(nil))
(insn 8 4 6 (set (reg:SI 24)
(mem:SI (plus:SI (reg:SI 17)
(const_int 4)))) -1 (nil)
(nil))
(insn 6 8 10 (set (reg/v:QI 21)
(subreg:QI (reg:SI 22) 0)) -1 (nil)
(nil))
(insn 10 6 11 (set (reg/v:HI 23)
(subreg:HI (reg:SI 24) 0)) -1 (nil)
(nil))
(note 11 10 12 "" NOTE_INSN_FUNCTION_BEG)
(note 12 11 14 "" NOTE_INSN_DELETED)
(note 14 12 15 "" NOTE_INSN_DELETED)
(insn 15 14 17 (asm_operands/v ("outb %b0,%w1") ("") 0[
(reg/v:QI 21)
(reg/v:HI 23)
]
[
(asm_input:QI ("a"))
(asm_input:HI ("d"))
] ("test.c") 3) -1 (nil)
(nil))
(insn 17 15 19 (asm_input ("outb %al,$0x80")) -1 (nil)
(nil))
(note 19 17 21 "" NOTE_INSN_FUNCTION_END)
(code_label 21 19 0 1 "")
;; Function __outbc_p
(note 2 0 4 "" NOTE_INSN_DELETED)
(insn 4 2 8 (set (reg:SI 22)
(mem:SI (reg:SI 17))) -1 (nil)
(nil))
(insn 8 4 6 (set (reg:SI 24)
(mem:SI (plus:SI (reg:SI 17)
(const_int 4)))) -1 (nil)
(nil))
(insn 6 8 10 (set (reg/v:QI 21)
(subreg:QI (reg:SI 22) 0)) -1 (nil)
(nil))
(insn 10 6 17 (set (reg:HI 25)
(subreg:HI (reg:SI 24) 0)) -1 (nil)
(nil))
(insn 17 10 11 (set (mem:HI (plus:SI (reg:SI 18)
(const_int -2)))
(reg:HI 25)) -1 (nil)
(nil))
(note 11 17 12 "" NOTE_INSN_FUNCTION_BEG)
(note 12 11 14 "" NOTE_INSN_DELETED)
(note 14 12 18 "" NOTE_INSN_DELETED)
(insn 18 14 20 (asm_operands/v ("outb %b0,%1") ("") 0[
(reg/v:QI 21)
(mem:HI (plus:SI (reg:SI 18)
(const_int -2)))
]
[
(asm_input:QI ("a"))
(asm_input:HI ("i"))
] ("test.c") 9) -1 (nil)
(nil))
(insn 20 18 22 (asm_input ("outb %al,$0x80")) -1 (nil)
(nil))
(note 22 20 24 "" NOTE_INSN_FUNCTION_END)
(code_label 24 22 0 2 "")
;; Function error_function
(note 2 0 3 "" NOTE_INSN_DELETED)
(note 3 2 4 "" NOTE_INSN_FUNCTION_BEG)
(note 4 3 6 "" NOTE_INSN_DELETED)
(note 6 4 7 "" NOTE_INSN_BLOCK_BEG)
(note 7 6 9 "" NOTE_INSN_BLOCK_BEG)
(insn 9 7 12 (set (reg/v:QI 22)
(const_int 0)) -1 (nil)
(nil))
(insn 12 9 13 (set (mem:HI (plus:SI (reg:SI 18)
(const_int -2)))
(const_int 241)) -1 (nil)
(nil))
(insn/i 13 12 14 (asm_operands/v ("outb %b0,%1") ("") 0[
(const_int 0)
(mem:HI (plus:SI (reg:SI 18)
(const_int -2)))
]
[
(asm_input:QI ("a"))
(asm_input:HI ("i"))
] ("test.c") 9) -1 (nil)
(nil))
(insn/i 14 13 15 (asm_input ("outb %al,$0x80")) -1 (nil)
(nil))
(code_label/i 15 14 16 6 "")
(note 16 15 18 "" NOTE_INSN_BLOCK_END)
(jump_insn 18 16 19 (set (pc)
(label_ref 30)) -1 (nil)
(nil))
(barrier 19 18 20)
(code_label 20 19 21 4 "")
(note 21 20 23 "" NOTE_INSN_BLOCK_BEG)
(insn 23 21 25 (set (reg/v:QI 23)
(const_int 0)) -1 (nil)
(nil))
(insn 25 23 26 (set (reg/v:HI 24)
(const_int 241)) -1 (nil)
(nil))
(insn/i 26 25 27 (asm_operands/v ("outb %b0,%w1") ("") 0[
(const_int 0)
(const_int 241)
]
[
(asm_input:QI ("a"))
(asm_input:HI ("d"))
] ("test.c") 3) -1 (nil)
(nil))
(insn/i 27 26 28 (asm_input ("outb %al,$0x80")) -1 (nil)
(nil))
(code_label/i 28 27 29 7 "")
(note 29 28 30 "" NOTE_INSN_BLOCK_END)
(code_label 30 29 33 5 "")
(insn 33 30 35 (set (mem:SI (pre_dec:SI (reg:SI 7 %esp)))
(symbol_ref:SI ("*.LC0"))) -1 (nil)
(nil))
(call_insn 35 33 36 (set (reg:SI 0 %eax)
(call (mem:QI (symbol_ref:SI ("printf")))
(const_int 4))) -1 (nil)
(nil)
(nil))
(insn 36 35 37 (set (reg:SI 7 %esp)
(plus:SI (reg:SI 7 %esp)
(const_int 4))) -1 (nil)
(nil))
(jump_insn 37 36 38 (set (pc)
(label_ref 45)) -1 (nil)
(nil))
(barrier 38 37 39)
(code_label 39 38 41 8 "")
(insn 41 39 43 (set (mem:SI (pre_dec:SI (reg:SI 7 %esp)))
(symbol_ref:SI ("*.LC1"))) -1 (nil)
(nil))
(call_insn 43 41 44 (set (reg:SI 0 %eax)
(call (mem:QI (symbol_ref:SI ("printf")))
(const_int 4))) -1 (nil)
(nil)
(nil))
(insn 44 43 45 (set (reg:SI 7 %esp)
(plus:SI (reg:SI 7 %esp)
(const_int 4))) -1 (nil)
(nil))
(code_label 45 44 47 9 "")
(insn 47 45 49 (asm_operands/v ("outb %b0,%1") ("") 0[
(const_int 0)
(const_int 241)
]
[
(asm_input:SI ("a"))
(asm_input:SI ("i"))
] ("test.c") 20) -1 (nil)
(nil))
(insn 49 47 51 (asm_input ("outb %al,$0x80")) -1 (nil)
(nil))
(note 51 49 52 "" NOTE_INSN_BLOCK_END)
(note 52 51 54 "" NOTE_INSN_FUNCTION_END)
(code_label 54 52 0 3 "")
______________________________________________________________________________
GCC 2.6.3 correctly handles the inline function expansion.
/usr/src/gnu/gcc-2.6.3/xgcc -B/usr/src/gnu/gcc-2.6.3/ -O2 -fomit-frame-pointer -dr -S test.c
GCC 2.6.3 rtl dump:
______________________________________________________________________________
;; Function __outb_p
(note 2 0 4 "" NOTE_INSN_DELETED)
(insn 4 2 8 (set (reg:SI 22)
(mem:SI (reg:SI 17))) -1 (nil)
(nil))
(insn 8 4 6 (set (reg:SI 24)
(mem:SI (plus:SI (reg:SI 17)
(const_int 4)))) -1 (nil)
(nil))
(insn 6 8 10 (set (reg/v:QI 21)
(subreg:QI (reg:SI 22) 0)) -1 (nil)
(nil))
(insn 10 6 11 (set (reg/v:HI 23)
(subreg:HI (reg:SI 24) 0)) -1 (nil)
(nil))
(note 11 10 12 "" NOTE_INSN_FUNCTION_BEG)
(note 12 11 14 "" NOTE_INSN_DELETED)
(note 14 12 15 "" NOTE_INSN_DELETED)
(insn 15 14 17 (asm_operands/v ("outb %b0,%w1") ("") 0[
(reg/v:QI 21)
(reg/v:HI 23)
]
[
(asm_input:QI ("a"))
(asm_input:HI ("d"))
] ("test.c") 3) -1 (nil)
(nil))
(insn 17 15 19 (asm_input ("outb %al,$0x80")) -1 (nil)
(nil))
(note 19 17 21 "" NOTE_INSN_FUNCTION_END)
(code_label 21 19 0 1 "")
;; Function __outbc_p
(note 2 0 4 "" NOTE_INSN_DELETED)
(insn 4 2 8 (set (reg:SI 22)
(mem:SI (reg:SI 17))) -1 (nil)
(nil))
(insn 8 4 6 (set (reg:SI 24)
(mem:SI (plus:SI (reg:SI 17)
(const_int 4)))) -1 (nil)
(nil))
(insn 6 8 10 (set (reg/v:QI 21)
(subreg:QI (reg:SI 22) 0)) -1 (nil)
(nil))
(insn 10 6 11 (set (reg/v:HI 23)
(subreg:HI (reg:SI 24) 0)) -1 (nil)
(nil))
(note 11 10 12 "" NOTE_INSN_FUNCTION_BEG)
(note 12 11 14 "" NOTE_INSN_DELETED)
(note 14 12 15 "" NOTE_INSN_DELETED)
(insn 15 14 17 (asm_operands/v ("outb %b0,%1") ("") 0[
(reg/v:QI 21)
(reg/v:HI 23)
]
[
(asm_input:QI ("a"))
(asm_input:HI ("i"))
] ("test.c") 9) -1 (nil)
(nil))
(insn 17 15 19 (asm_input ("outb %al,$0x80")) -1 (nil)
(nil))
(note 19 17 21 "" NOTE_INSN_FUNCTION_END)
(code_label 21 19 0 2 "")
;; Function error_function
(note 2 0 3 "" NOTE_INSN_DELETED)
(note 3 2 4 "" NOTE_INSN_FUNCTION_BEG)
(note 4 3 6 "" NOTE_INSN_DELETED)
(note 6 4 7 "" NOTE_INSN_BLOCK_BEG)
(note 7 6 10 "" NOTE_INSN_BLOCK_BEG)
(insn 10 7 12 (set (reg/v:QI 22)
(const_int 0)) -1 (nil)
(nil))
(insn 12 10 13 (set (reg/v:HI 23)
(const_int 241)) -1 (nil)
(nil))
(insn/i 13 12 14 (asm_operands/v ("outb %b0,%1") ("") 0[
(const_int 0)
(const_int 241)
]
[
(asm_input:QI ("a"))
(asm_input:HI ("i"))
] ("test.c") 9) -1 (nil)
(nil))
(insn/i 14 13 15 (asm_input ("outb %al,$0x80")) -1 (nil)
(nil))
(code_label/i 15 14 16 6 "")
(note 16 15 18 "" NOTE_INSN_BLOCK_END)
(jump_insn 18 16 19 (set (pc)
(label_ref 32)) -1 (nil)
(nil))
(barrier 19 18 20)
(code_label 20 19 21 4 "")
(note 21 20 24 "" NOTE_INSN_BLOCK_BEG)
(insn 24 21 26 (set (reg/v:QI 24)
(const_int 0)) -1 (nil)
(nil))
(insn 26 24 27 (set (reg/v:HI 25)
(const_int 241)) -1 (nil)
(nil))
(insn/i 27 26 28 (asm_operands/v ("outb %b0,%w1") ("") 0[
(const_int 0)
(const_int 241)
]
[
(asm_input:QI ("a"))
(asm_input:HI ("d"))
] ("test.c") 3) -1 (nil)
(nil))
(insn/i 28 27 29 (asm_input ("outb %al,$0x80")) -1 (nil)
(nil))
(code_label/i 29 28 30 7 "")
(note 30 29 32 "" NOTE_INSN_BLOCK_END)
(code_label 32 30 35 5 "")
(insn 35 32 37 (set (mem:SI (pre_dec:SI (reg:SI 7 %esp)))
(symbol_ref:SI ("*.LC0"))) -1 (nil)
(nil))
(call_insn 37 35 38 (set (reg:SI 0 %eax)
(call (mem:QI (symbol_ref:SI ("printf")))
(const_int 4))) -1 (nil)
(nil)
(nil))
(insn 38 37 39 (set (reg:SI 7 %esp)
(plus:SI (reg:SI 7 %esp)
(const_int 4))) -1 (nil)
(nil))
(jump_insn 39 38 40 (set (pc)
(label_ref 47)) -1 (nil)
(nil))
(barrier 40 39 41)
(code_label 41 40 43 8 "")
(insn 43 41 45 (set (mem:SI (pre_dec:SI (reg:SI 7 %esp)))
(symbol_ref:SI ("*.LC1"))) -1 (nil)
(nil))
(call_insn 45 43 46 (set (reg:SI 0 %eax)
(call (mem:QI (symbol_ref:SI ("printf")))
(const_int 4))) -1 (nil)
(nil)
(nil))
(insn 46 45 47 (set (reg:SI 7 %esp)
(plus:SI (reg:SI 7 %esp)
(const_int 4))) -1 (nil)
(nil))
(code_label 47 46 49 9 "")
(insn 49 47 51 (asm_operands/v ("outb %b0,%1") ("") 0[
(const_int 0)
(const_int 241)
]
[
(asm_input:SI ("a"))
(asm_input:SI ("i"))
] ("test.c") 20) -1 (nil)
(nil))
(insn 51 49 53 (asm_input ("outb %al,$0x80")) -1 (nil)
(nil))
(note 53 51 54 "" NOTE_INSN_BLOCK_END)
(note 54 53 56 "" NOTE_INSN_FUNCTION_END)
(code_label 56 54 0 3 "")
______________________________________________________________________________
GCC 2.6.3 asm output: test.s
______________________________________________________________________________
.file "test.c"
.version "01.01"
gcc2_compiled.:
.section .rodata
.LC0:
.string "CONST\n"
.LC1:
.string "REG\n"
.text
.align 16
.globl error_function
.type error_function,@function
error_function:
xorb %al,%al
#APP
outb %al,$241
outb %al,$0x80
#NO_APP
pushl $.LC0
call printf
addl $4,%esp
xorl %eax,%eax
#APP
outb %al,$241
outb %al,$0x80
#NO_APP
ret
.Lfe1:
.size error_function,.Lfe1-error_function
.ident "GCC: (GNU) 2.6.3"
______________________________________________________________________________
Email: mark@mtfhpc.demon.co.uk
M.T.Fortescue.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads