public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: another binutils-2.8.1 bug?
       [not found] <199801102021.MAA28966@netcom9.netcom.com>
@ 1998-01-10 16:43 ` H.J. Lu
  1998-01-11  0:31   ` Paul Eggert
  0 siblings, 1 reply; 2+ messages in thread
From: H.J. Lu @ 1998-01-10 16:43 UTC (permalink / raw)
  To: Toshiyasu Morita; +Cc: gcc2, egcs

> 
> 
> 
> Yup, it's local.
> 
> Evidently, if you change a static function into a non-static function, 
> but the static prototype is left floating around, GCC converts the 
> function to a static automatically, which seems rather dangerous.
> 

I don't know what ANSI C says on it.

# gcc -S x.c -O 
x.c:4: conflicting types for `foo'
x.c:1: previous declaration of `foo'
----
	.file	"x.c"
	.version	"01.01"
/ GNU C version 2.8.0 (i586-unknown-linux-gnulibc1) compiled by GNU C version 2.8.0.
/ options passed:  -O
/ options enabled:  -fdefer-pop -fthread-jumps -fpeephole -ffunction-cse
/ -finline -fkeep-static-consts -fpcc-struct-return -fcommon -fverbose-asm
/ -fgnu-linker -m80387 -mhard-float -mno-soft-float -mieee-fp
/ -mfp-ret-in-387 -mschedule-prologue -mcpu=pentium -march=pentium

gcc2_compiled.:
.text
	.align 4
	.type	 foo,@function
foo:
	pushl %ebp
	movl %esp,%ebp
	movl %ebp,%esp
	popl %ebp
	ret
.Lfe1:
	.size	 foo,.Lfe1-foo
	.ident	"GCC: (GNU) 2.8.0"
---
static void foo ();

foo ()
{
}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: another binutils-2.8.1 bug?
  1998-01-10 16:43 ` another binutils-2.8.1 bug? H.J. Lu
@ 1998-01-11  0:31   ` Paul Eggert
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggert @ 1998-01-11  0:31 UTC (permalink / raw)
  To: hjl; +Cc: tm, gcc2, egcs

   From: hjl@lucon.org (H.J. Lu)
   Date: Sat, 10 Jan 1998 13:45:43 -0800 (PST)

   > Evidently, if you change a static function into a non-static function, 
   > but the static prototype is left floating around, GCC converts the 
   > function to a static automatically, which seems rather dangerous.

   I don't know what ANSI C says on it.

ANSI C requires that behavior.

It might be nice if GCC warned about the situation, but I don't think
it's dangerous all that often.  All that happens is that the function
is unexpectedly static, which normally just leads to a link error.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-01-11  0:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <199801102021.MAA28966@netcom9.netcom.com>
1998-01-10 16:43 ` another binutils-2.8.1 bug? H.J. Lu
1998-01-11  0:31   ` Paul Eggert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).