public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/12003] New: FILE* variable initialized to stderr (not constant error)
@ 2003-08-21 4:12 Castalia at idaeim dot com
2003-08-21 11:50 ` [Bug c/12003] " pinskia at gcc dot gnu dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Castalia at idaeim dot com @ 2003-08-21 4:12 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12003
Summary: FILE* variable initialized to stderr (not constant
error)
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: Castalia at idaeim dot com
CC: gcc-bugs at gcc dot gnu dot org
The code:
#include <stdio.h>
FILE *OUTPUT = stderr;
main ()
{
fprintf (OUTPUT, "Try this!\n");
exit (0);
}
Fails to build:
idaeim:castalia>> gcc try.c -o try
try.c:4: error: initializer element is not constant
idaeim:castalia>> gcc --version
gcc (GCC) 3.3.1 [FreeBSD]
idaeim:castalia>> uname -a
FreeBSD idaeim 4.8-STABLE FreeBSD 4.8-STABLE #0: Sun Jul 13 13:11:51 MST
2003 root@idaeim:/usr/obj/usr/src/sys/IDAEIM i386
N.B.: The same problem occurs with gcc 3.2.1,
but it does NOT occur with gcc 3.2.2 for Solaris.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/12003] FILE* variable initialized to stderr (not constant error)
2003-08-21 4:12 [Bug c/12003] New: FILE* variable initialized to stderr (not constant error) Castalia at idaeim dot com
@ 2003-08-21 11:50 ` pinskia at gcc dot gnu dot org
2003-08-21 12:46 ` jsm at polyomino dot org dot uk
2003-08-21 15:45 ` Castalia at idaeim dot com
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-21 11:50 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12003
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-08-21 11:50 -------
Note stderr is defined by the libc, not by GCC so that is why it worked in Solaris and not
in FreeBSD but also the c standard allows stderr/stdout/stdin to be non-constant values
so this is a non-bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/12003] FILE* variable initialized to stderr (not constant error)
2003-08-21 4:12 [Bug c/12003] New: FILE* variable initialized to stderr (not constant error) Castalia at idaeim dot com
2003-08-21 11:50 ` [Bug c/12003] " pinskia at gcc dot gnu dot org
@ 2003-08-21 12:46 ` jsm at polyomino dot org dot uk
2003-08-21 15:45 ` Castalia at idaeim dot com
2 siblings, 0 replies; 4+ messages in thread
From: jsm at polyomino dot org dot uk @ 2003-08-21 12:46 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12003
------- Additional Comments From jsm at polyomino dot org dot uk 2003-08-21 12:46 -------
Subject: Re: FILE* variable initialized to stderr (not constant
error)
On Thu, 21 Aug 2003, pinskia at gcc dot gnu dot org wrote:
> Note stderr is defined by the libc, not by GCC so that is why it worked
> in Solaris and not in FreeBSD but also the c standard allows
> stderr/stdout/stdin to be non-constant values so this is a non-bug.
It is also explicitly listed as a non-bug in the bug reporting
instructions, under "Cannot initialize a static variable with stdin.".
Perhaps mentioning stdout and stderr there as well would make bug
submitters more likely to see that this non-bug is what they're
encountering? (And indicating that FreeBSD now has this property as well,
not just GNU libc.)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/12003] FILE* variable initialized to stderr (not constant error)
2003-08-21 4:12 [Bug c/12003] New: FILE* variable initialized to stderr (not constant error) Castalia at idaeim dot com
2003-08-21 11:50 ` [Bug c/12003] " pinskia at gcc dot gnu dot org
2003-08-21 12:46 ` jsm at polyomino dot org dot uk
@ 2003-08-21 15:45 ` Castalia at idaeim dot com
2 siblings, 0 replies; 4+ messages in thread
From: Castalia at idaeim dot com @ 2003-08-21 15:45 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12003
------- Additional Comments From Castalia at idaeim dot com 2003-08-21 15:45 -------
Subject: Re: FILE* variable initialized to stderr (not constant
error)
Thanks for the prompt reply. You've confirmed my suspicions.
This does create a really awkward situation for C code that expects to
initialize error/warning reporting FILE* variables to stderr by default.
Any suggestions for a workaround?
Thnx,
Bradford Castalia Senior Systems Analyst
Planetary Image Research Laboratory University of Arizona
jsm at polyomino dot org dot uk wrote:
>
> PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12003
>
> ------- Additional Comments From jsm at polyomino dot org dot uk 2003-08-21 12:46 -------
> Subject: Re: FILE* variable initialized to stderr (not constant
> error)
>
> On Thu, 21 Aug 2003, pinskia at gcc dot gnu dot org wrote:
>
> > Note stderr is defined by the libc, not by GCC so that is why it worked
> > in Solaris and not in FreeBSD but also the c standard allows
> > stderr/stdout/stdin to be non-constant values so this is a non-bug.
>
> It is also explicitly listed as a non-bug in the bug reporting
> instructions, under "Cannot initialize a static variable with stdin.".
> Perhaps mentioning stdout and stderr there as well would make bug
> submitters more likely to see that this non-bug is what they're
> encountering? (And indicating that FreeBSD now has this property as well,
> not just GNU libc.)
>
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-08-21 15:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-21 4:12 [Bug c/12003] New: FILE* variable initialized to stderr (not constant error) Castalia at idaeim dot com
2003-08-21 11:50 ` [Bug c/12003] " pinskia at gcc dot gnu dot org
2003-08-21 12:46 ` jsm at polyomino dot org dot uk
2003-08-21 15:45 ` Castalia at idaeim dot com
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).