This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c/5127: Should Get a Compile Error
- From: dhighley at highley-recommended dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 15 Dec 2001 20:56:25 -0000
- Subject: c/5127: Should Get a Compile Error
- Reply-to: dhighley at highley-recommended dot com
>Number: 5127
>Category: c
>Synopsis: Should Get a Compile Error
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Dec 15 13:06:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: David Highley
>Release: 3.0.2
>Organization:
>Environment:
Cygwin
>Description:
Should get a compiler error when a file open has the, "b", binary
option in the wrong place. I believe the ansi specification states
that this option need to be first in the option list, so:
freopen(*argv, "rb", stdin);
Should give a compiler diagnotic error. I lost 4 days trying
to figure out why the what utility would not function. Visual
Studio 6.0 and Borland 5.1 also miss giving a compiler diagnostic.
>How-To-Repeat:
In a Cygwin environment do the following:
- gcc -o what what.c
- gcc -o testc -ansi -pedantic -pedantic-erros -Wall testc.c
- ./what testc
Should not get a compiler diagnostic and you should not see the
string "VERSION STRING"
Change the freopen call at line 91 to:
if (!freopen(*argv, "br", stdin))
Recompile what and now you should see the version string.
>Fix:
If order of parameter matter, then the order should be checked.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/x-tar; name="what.tar"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="what.tar"
d2hhdC5jAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAxMDA2NDQAMDAwMTc1
MQAwMDAwMDEyADAwMDAwMDA3MDA3ADA3NDA2NzMxNDQ1ADAwMTMxNjMAMAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAA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