Re: Problem compiling teTeX on IA-64

2001-07-18 Thread Alan Shutko


Olaf Weber <[EMAIL PROTECTED]> writes:

> That's odd: the C standard took a lot of care to ensure that implicit
> declarations would, in fact, continue to work.  So this sounds like
> there is a possible conformance issue with the compiler and/or
> standard library lurking here.

Not quite.

The C standard took a lot of care that a programmer could use implicit
declarations for her own functions, but I'm not entirely sure that it
guarantees that library functions will work without the headers.  A
bit of research turns up Section 7.1.7 of ISO 9899-1990:

Provided that a library function can be declared without reference
to any type defined in a header, it is also permissible to declare
the function, either explicitly or implicitly, and use it without
including its associated header.

It does seem through a cursory look at the functions that all their
arguments are of types which you'd get through normal promotion (in
the case of implicit declarations)

Maybe this helps someone, but I'm still unsure.

-- 
Alan Shutko <[EMAIL PROTECTED]> - In a variety of flavors!
Everybody wants to go to heaven, but nobody wants to die.



Re: Problem compiling teTeX on IA-64

2001-07-18 Thread Olaf Weber


Adrian Bunk writes:

> Bdale Garbee <[EMAIL PROTECTED]> reported the following problem with
> the 20001218 beta of teTeX:

> <--  snip  ->

> The configure script in the texk/kpathsea directory seg faults when
> running the test program that checks whether putenv uses malloc.
> The problem is that the test program doesn't include enough headers,
> and implicit declarations on IA-64 almost always don't do what you
> want.

That's odd: the C standard took a lot of care to ensure that implicit
declarations would, in fact, continue to work.  So this sounds like
there is a possible conformance issue with the compiler and/or
standard library lurking here.

> The fix is easy, that test program needs to

> #include 
> #include 

> so that there aren't any implicitly declared library functions.  The
> package builds cleanly once this change is made.

The catch is that this piece of code dates from the good old days of
pre-ANSI C systems where you might not have these headers at all. It
seems a reasonable change to make these days.  But perhaps there are
some people with "old" systems and an opinion on the matter?

-- 
Olaf Weber

Do not meddle in the affairs of sysadmins,
for they are quick to anger and have no need for subtlety.



Problem compiling teTeX on IA-64

2001-07-18 Thread Adrian Bunk


Hi,

Bdale Garbee <[EMAIL PROTECTED]> reported the following problem with
the 20001218 beta of teTeX:

<--  snip  ->

The configure script in the texk/kpathsea directory seg faults when running
the test program that checks whether putenv uses malloc.  The problem is that
the test program doesn't include enough headers, and implicit declarations on
IA-64 almost always don't do what you want.

The fix is easy, that test program needs to

#include 
#include 

so that there aren't any implicitly declared library functions.  The package
builds cleanly once this change is made.
...
The problem is that on ia64, some library functions and/or their arguments
have types different than what the compiler picks as a default type if you
don't bother to provide prototypes in your source code.  At run time, the
conversions that have to happen don't always behave the way the programmer
expected, which can lead to seg faults.

On 32 bit machines, and 64 bit machines that try hard to be like 32 bit
machines in some ways, you can get away with the sloppy coding practice of
letting the compiler's default typing take the place of providing prototypes.
It is never a good idea to do so, though.  You should *always* include the
proper header files to pick up the actual definitions of the functions you
are calling from system libraries.

<--  snip  -->

cu
Adrian

-- 

Get my GPG key: finger [EMAIL PROTECTED] | gpg --import

Fingerprint: B29C E71E FE19 6755 5C8A  84D4 99FC EA98 4F12 B400