Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Jan 1998 22:50:54 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        sef@kithrup.com (Sean Eric Fagan)
Cc:        current@FreeBSD.ORG
Subject:   Re: Nasty GCC bug?
Message-ID:  <199801202250.PAA04005@usr06.primenet.com>
In-Reply-To: <199801202206.OAA18817@kithrup.com> from "Sean Eric Fagan" at Jan 20, 98 02:06:21 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> >Is is an artifact of the calling convention, which is implementation
> >defined.
> 
> No, it is not.
> 
> Variardic functions ARE REQUIRED TO USE OLD-STYLE PROMOTION RULES.
> 
> REQUIRED.
> 
> As in MANDAATORY.
> 
> Further, printf then treats the argument as int; this is also required by the
> standard.
> 
> >It has *NOT* "always been the case"; on systems which do not use an
> >integer stack based calling convention, the value can be treated as
> >its type by the varradic function, instead of being treated as an int.
> >It is the promotion caused by the calling convention that is the
> >source of the breakage.
> 
> It *has* always been the case; not doing it this way is a bug.  yes, there
> have been buggy implementations, and some of those are even superior ot the
> correct, required implementation.
> 
> If I still had my copy of ANSI C, I could tell you the exact paragraph numbers
> that require this behaviour.  As it is, I quoted man pages at you, and other
> peopl ehave quoted man pages at you.
> 
> Terry, you are *WRONG*.  Admit it.

Wrong about what?

The subject line?  The body of my message made it clear that I used the
wrong subject line.

Being surprised when a program that worked on one system failed on
another?  How can I be wrong about being surprised?

Wrong about the type promotion resulting in what I was seeing?

Wrong about VMS not promoting the type in the VAX Calling Standard?

Wrong about "there should be a "%bx""?

Wrong for setting my mail up to filter lists into seperate mailboxes
so I couldn't read your previous responses before you lost patience
and posted to the thread?

Wrong about mandatory promotion in the face of a different calling
convention?

Wrong about the existance of the "h" conversion specifier's existance?


Well, you got me on the subject, which I typed before I wrote my little
test program and wrote the body of the message; and if I were trying to
play "ANSI C lawyer" (which I wouldn't; I'd lose -- you definitely know
the standard better than me), you got me on the mandatory promption
rules -- though I don't know if it'd cause the same results, if the
VCS "demoted" the thing back to a signed char after it was "promoted"
once it was in the function.  You also got me on the "h" conversion
specifier, though I blame the printf(1) man page for that one...

Other than that, I've stated facts that aren't relevent to your
argument one way or the other (the ones which led me to my conclusion
that the type promotion was what was biting me), and I've stated an
opinion about "doing something to the formatting code to let me do what
I want".

I don't really see anything to fly into a fury over...


PS: if anyone is still interested, I can send you the fixed program,
which is supposed to:

 * Scan a file for an arbitrary number of bytes matching entered
 * as hex values.   Print out the offsets where the pattern occurs
 * as hex values.

...useful for finding filesystems when you destroy your disklabel
by running against the device and specifying FS_MAGIC (011954) as
the pattern.  It doesn't use scanf() any more.



					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199801202250.PAA04005>