RE: A GCC bug related to inline?

2018-11-10 Thread Kumar, Venkataramanan
Hi Bin, > -Original Message- > From: gcc-ow...@gcc.gnu.org On Behalf Of > Bin.Cheng > Sent: Sunday, November 11, 2018 12:28 PM > To: GCC Development > Subject: A GCC bug related to inline? > > Hi, > Given below simple code: > > inline int foo (int a) { > return a + 1; > } > int g = 5

A GCC bug related to inline?

2018-11-10 Thread Bin.Cheng
Hi, Given below simple code: inline int foo (int a) { return a + 1; } int g = 5; int main(void) { return foo(g); } When compiled with -O0, GCC generates below assembly: .file "test.c" .text .globl g .data .align 4 .type g, @object .size g, 4 g: .long 5 .text .globl main .type main, @function