Article View: comp.unix.programmer
Article #3681Re: gcc -O2 bug
From: Christopher R Volpe
Date: Mon, 12 Aug 1996 00:00
Date: Mon, 12 Aug 1996 00:00
31 lines
2099 bytes
2099 bytes
Preston F. Crow wrote:
>
> Christopher R Volpe <volpe@ash.crd.ge.com> writes:
>
> >comp.std.c answer: The compiler is allowed to know the semantics of
> >printf, and should know that the printf function will not modify
> >flag_pt, despite the fact that other user-defined functions could.
>
> No, the compiler can't assume anything about printf(), as the user
Bzzzt. Thanks for playing.
> could have stupidly defined his own function of the same name,
^^^^^^^^
And the reason this would be "stupid" is that it's not legal for him to
do so, since the compiler is allowed to know what printf does.
> overriding the expected behaviour of the version in libc.
>
> In some of my Mach programming, I've done just that. [Well, with
"The behavior is undefined", even if you were (un)lucky enough to have
it do what you wanted.
--
Chris Volpe Phone: (518) 387-7766
GE Corporate R&D Fax: (518) 387-6560
PO Box 8 Email: volpecr@crd.ge.com
Schenectady, NY 12301 Web: http://www.crd.ge.com/~volpecr
Technical Details
Message-ID:
<320F47BA.39E9@ash.crd.ge.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<4ubnat$75u@freeside.fc.net> <danpop.839504721@news.cern.ch> <vkohklaizj.fsf@atari.connectinc.com> <4udd3i$90k@solutions.solon.com> <vkn3059yhu.fsf@atari.connectinc.com> <320B6599.2C8E@ash.crd.ge.com> <4uh4vh$aj2@dartvax.dartmouth.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,7d30cae02ba9b089 X-Google-Attributes: gid11318c,public X-Google-Thread: 10c696,7d30cae02ba9b089 X-Google-Attributes: gid10c696,public X-Google-Thread: fc89c,7d30cae02ba9b089 X-Google-Attributes: gidfc89c,public X-Google-Thread: 1014db,7d30cae02ba9b089 X-Google-Attributes: gid1014db,public From: Christopher R Volpe <volpe@ash.crd.ge.com> Subject: Re: gcc -O2 bug Date: 1996/08/12 Message-ID: <320F47BA.39E9@ash.crd.ge.com> X-Deja-AN: 173704323 references: <4ubnat$75u@freeside.fc.net> <danpop.839504721@news.cern.ch> <vkohklaizj.fsf@atari.connectinc.com> <4udd3i$90k@solutions.solon.com> <vkn3059yhu.fsf@atari.connectinc.com> <320B6599.2C8E@ash.crd.ge.com> <4uh4vh$aj2@dartvax.dartmouth.edu> content-type: text/plain; charset=us-ascii organization: GE Corporate Research & Development, Schenectady, NY mime-version: 1.0 newsgroups: comp.unix.programmer,gnu.gcc.help,comp.os.linux.development.apps,comp.lang.c x-mailer: Mozilla 2.0 (X11; I; SunOS 5.4 sun4m)