unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* isinf and type-pun warning/error on OSF guile 1.8.7
@ 2010-06-09 15:43 Jay K
  2010-06-09 22:28 ` Andy Wingo
  2010-09-07 22:52 ` Ludovic Courtès
  0 siblings, 2 replies; 6+ messages in thread
From: Jay K @ 2010-06-09 15:43 UTC (permalink / raw)
  To: bug-guile


libtool: compile:  gcc -DHAVE_CONFIG_H -I.. -I/home/jayk/src/guile-1.8.7 -I.. -mieee -mieee -D_REENTRANT -pthread -g -O2 -Wall -Wmissing-prototypes -Werror -MT libguile_la-numbers.lo -MD -MP -MF .deps/libguile_la-numbers.Tpo -c /home/jayk/src/guile-1.8.7/libguile/numbers.c  -DPIC -o .libs/libguile_la-numbers.o
cc1: warnings being treated as errors
/home/jayk/src/guile-1.8.7/libguile/numbers.c: In function 'xisinf':
/home/jayk/src/guile-1.8.7/libguile/numbers.c:144: error: implicit declaration of function 'isinf'
/home/jayk/src/guile-1.8.7/libguile/numbers.c: In function 'guile_ieee_init':
/home/jayk/src/guile-1.8.7/libguile/numbers.c:623: error: dereferencing type-punned pointer will break strict-aliasing rules
/home/jayk/src/guile-1.8.7/libguile/numbers.c:654: error: dereferencing type-punned pointer will break strict-aliasing rules
make[3]: *** [libguile_la-numbers.lo] Error 1
make[3]: Leaving directory `/home/jayk/obj/guile/libguile'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/jayk/obj/guile/libguile'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/jayk/obj/guile'
make: *** [all] Error 2
bash-4.1$ 


I hacked these bogusly to fix.
Put "0 &&" on the first #if and removed -Werror from libguile/Makefile for the second.
I couldn't find isinf in any header. 
  Oops, I guess I should have just removed -Wmissing-prototypes. I'll try that.


I recall seeing the same problem on Irix, where autoconf does a link check
and compiles without -Wmissing-prototype so it passes, because the function
does exist somewhere. Autoconf checks need to more closely resemble
how later compilation will occur.


It is *possible* I changed gcc from 4.5.0 to 4.3.5 while this was compiling, but I don't think so.


Same thing in make check:


/home/jayk/src/guile-1.8.7/test-suite/standalone/test-conversion.c:859: error: dereferencing type-punned pointer will break strict-aliasing rules
make[4]: *** [test_conversion-test-conversion.o] Error 1


I will try ftp://alpha.gnu.org/gnu/guile/guile-1.9.11.tar.gz.


 - Jay
 		 	   		  


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: isinf and type-pun warning/error on OSF guile 1.8.7
  2010-06-09 15:43 isinf and type-pun warning/error on OSF guile 1.8.7 Jay K
@ 2010-06-09 22:28 ` Andy Wingo
  2010-06-09 23:16   ` Jay K
  2010-06-10  9:27   ` Jay K
  2010-09-07 22:52 ` Ludovic Courtès
  1 sibling, 2 replies; 6+ messages in thread
From: Andy Wingo @ 2010-06-09 22:28 UTC (permalink / raw)
  To: Jay K; +Cc: bug-guile

Hi Jay,

On Wed 09 Jun 2010 17:43, Jay K <jay.krell@cornell.edu> writes:

> libtool: compile:  gcc -DHAVE_CONFIG_H -I.. -I/home/jayk/src/guile-1.8.7 -I.. -mieee -mieee -D_REENTRANT -pthread -g -O2 -Wall -Wmissing-prototypes -Werror -MT libguile_la-numbers.lo -MD -MP -MF .deps/libguile_la-numbers.Tpo -c /home/jayk/src/guile-1.8.7/libguile/numbers.c  -DPIC -o .libs/libguile_la-numbers.o
> cc1: warnings being treated as errors
> /home/jayk/src/guile-1.8.7/libguile/numbers.c: In function 'xisinf':
> /home/jayk/src/guile-1.8.7/libguile/numbers.c:144: error: implicit
> declaration of function 'isinf'

> I couldn't find isinf in any header. 

This call only occurs if configure detected support `isinf', so surely
it is there? Can you check again? Barring that can you send a
config.log, please.

> /home/jayk/src/guile-1.8.7/libguile/numbers.c: In function 'guile_ieee_init':
> /home/jayk/src/guile-1.8.7/libguile/numbers.c:623: error: dereferencing type-punned pointer will break strict-aliasing rules
> /home/jayk/src/guile-1.8.7/libguile/numbers.c:654: error: dereferencing type-punned pointer will break strict-aliasing rules

Does replacing that DINIFINITY block with the following help?

  /* OSF */
  extern unsigned int DINFINITY[2];
  union
  {
    double d;
    int i[2];
  } alias;
  alias.i[0] = DINFINITY[0];
  alias.i[1] = DINFINITY[1];
  guile_Inf = alias.d;

Likewise for DQNAN:

  {
    /* OSF */
    extern unsigned int DQNAN[2];
    union
    {
      double d;
      int i[2];
    } alias;
    alias.i[0] = DQNAN[0];
    alias.i[1] = DQNAN[1];
    guile_NaN = alias.d;
  }

> I recall seeing the same problem on Irix, where autoconf does a link check
> and compiles without -Wmissing-prototype so it passes, because the function
> does exist somewhere. Autoconf checks need to more closely resemble
> how later compilation will occur.

How does that work though -- does isinf have no header/declaration?

> /home/jayk/src/guile-1.8.7/test-suite/standalone/test-conversion.c:859:
> error: dereferencing type-punned pointer will break strict-aliasing
> rules make[4]: *** [test_conversion-test-conversion.o] Error 1

We can copy the above solution if it works. Let us know!

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: isinf and type-pun warning/error on OSF guile 1.8.7
  2010-06-09 22:28 ` Andy Wingo
@ 2010-06-09 23:16   ` Jay K
  2010-06-10  9:27   ` Jay K
  1 sibling, 0 replies; 6+ messages in thread
From: Jay K @ 2010-06-09 23:16 UTC (permalink / raw)
  To: wingo; +Cc: bug-guile


Andy, I will try it later.
 
Often what autoconf does is:
 
echo "int main() {  isinf(0); }"> conftest.c
gcc conftest.c
 => if it links successfully, it is there.
 
 
and then later on the "real" code uses gcc -Wmissing-prototypes -Werror, boom.
That's what I saw months/year+ ago on Irix at least.
I think in the Irix case the protype was under an #if.
I'll look around more on Tru64. Might get the admin to install newer compiler/headers too.
 
 
 
You know, every so often I get up the gumption to try gcc/make check, which requires a whole bunch more stuff than just gcc/make ... bdwgc, guile, libunistring, autogen, tcl, dejagnu, expect, pkg-config, ffi....kind of annoying, oh well. It looks like I succeeded this time, phew..
 
 
Thanks, later,
 - Jay



----------------------------------------
> From: wingo@pobox.com
> To: jay.krell@cornell.edu
> CC: bug-guile@gnu.org
> Subject: Re: isinf and type-pun warning/error on OSF guile 1.8.7
> Date: Thu, 10 Jun 2010 00:28:00 +0200
>
> Hi Jay,
>
> On Wed 09 Jun 2010 17:43, Jay K writes:
>
>> libtool: compile: gcc -DHAVE_CONFIG_H -I.. -I/home/jayk/src/guile-1.8.7 -I.. -mieee -mieee -D_REENTRANT -pthread -g -O2 -Wall -Wmissing-prototypes -Werror -MT libguile_la-numbers.lo -MD -MP -MF .deps/libguile_la-numbers.Tpo -c /home/jayk/src/guile-1.8.7/libguile/numbers.c -DPIC -o .libs/libguile_la-numbers.o
>> cc1: warnings being treated as errors
>> /home/jayk/src/guile-1.8.7/libguile/numbers.c: In function 'xisinf':
>> /home/jayk/src/guile-1.8.7/libguile/numbers.c:144: error: implicit
>> declaration of function 'isinf'
>
>> I couldn't find isinf in any header.
>
> This call only occurs if configure detected support `isinf', so surely
> it is there? Can you check again? Barring that can you send a
> config.log, please.
>
>> /home/jayk/src/guile-1.8.7/libguile/numbers.c: In function 'guile_ieee_init':
>> /home/jayk/src/guile-1.8.7/libguile/numbers.c:623: error: dereferencing type-punned pointer will break strict-aliasing rules
>> /home/jayk/src/guile-1.8.7/libguile/numbers.c:654: error: dereferencing type-punned pointer will break strict-aliasing rules
>
> Does replacing that DINIFINITY block with the following help?
>
> /* OSF */
> extern unsigned int DINFINITY[2];
> union
> {
> double d;
> int i[2];
> } alias;
> alias.i[0] = DINFINITY[0];
> alias.i[1] = DINFINITY[1];
> guile_Inf = alias.d;
>
> Likewise for DQNAN:
>
> {
> /* OSF */
> extern unsigned int DQNAN[2];
> union
> {
> double d;
> int i[2];
> } alias;
> alias.i[0] = DQNAN[0];
> alias.i[1] = DQNAN[1];
> guile_NaN = alias.d;
> }
>
>> I recall seeing the same problem on Irix, where autoconf does a link check
>> and compiles without -Wmissing-prototype so it passes, because the function
>> does exist somewhere. Autoconf checks need to more closely resemble
>> how later compilation will occur.
>
> How does that work though -- does isinf have no header/declaration?
>
>> /home/jayk/src/guile-1.8.7/test-suite/standalone/test-conversion.c:859:
>> error: dereferencing type-punned pointer will break strict-aliasing
>> rules make[4]: *** [test_conversion-test-conversion.o] Error 1
>
> We can copy the above solution if it works. Let us know!
>
> Andy
> --
> http://wingolog.org/ 		 	   		  


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: isinf and type-pun warning/error on OSF guile 1.8.7
  2010-06-09 22:28 ` Andy Wingo
  2010-06-09 23:16   ` Jay K
@ 2010-06-10  9:27   ` Jay K
  2010-06-10 12:26     ` Andy Wingo
  1 sibling, 1 reply; 6+ messages in thread
From: Jay K @ 2010-06-10  9:27 UTC (permalink / raw)
  To: wingo; +Cc: bug-guile


Andy, your fix quashed the warning for type punning.
memcpy does too.
Your way seems to be the recommended way.
 I lost the link that seems to recommend your way.


isinf is different than I though, it seems to be some gcc builtin.


% cat 4.c
int main(int argc, char** argv)
{
 return isinf((double)argc);
}

% cc 4.c
ld:
Unresolved:
isinf
% gcc 4.c
 => success

http://gcc.gnu.org/onlinedocs/gcc-4.5.0/gcc/Other-Builtins.html#Other-Builtins

% gcc -fno-builtin 4.c
isinf
collect2: ld returned 1 exit status


I don't know what to recommend here for portability and autoconfing.



% gcc -ansi 4.c
isinf
collect2: ld returned 1 exit status

Maybe configure for __builtin_isinf?

bash-4.1$ cat 4.c
int main(int argc, char** argv)
{
 return isinf((double)argc);
}

bash-4.1$ cat 5.c
int main(int argc, char** argv)
{
 return __builtin_isinf((double)argc);
}

bash-4.1$ gcc 4.c  -Wall
4.c: In function 'main':
4.c:3:2: warning: implicit declaration of function 'isinf'
bash-4.1$ gcc 5.c  -Wall
 => success

http://www.gnu.org/software/hello/manual/autoconf/Function-Portability.html

recommend wither gnulib or a little other workaround shown.


Here they just prototype it:
http://mail-index.netbsd.org/pkgsrc-bugs/2007/05/18/0000.html

I'm tempted to say it is a gcc bug.

Thanks,
 - Jay


----------------------------------------
> From: jay.krell@cornell.edu
> To: wingo@pobox.com
> CC: bug-guile@gnu.org
> Subject: RE: isinf and type-pun warning/error on OSF guile 1.8.7
> Date: Wed, 9 Jun 2010 23:16:28 +0000
>
>
> Andy, I will try it later.
>
> Often what autoconf does is:
>
> echo "int main() { isinf(0); }"> conftest.c
> gcc conftest.c
> => if it links successfully, it is there.
>
>
> and then later on the "real" code uses gcc -Wmissing-prototypes -Werror, boom.
> That's what I saw months/year+ ago on Irix at least.
> I think in the Irix case the protype was under an #if.
> I'll look around more on Tru64. Might get the admin to install newer compiler/headers too.
>
>
>
> You know, every so often I get up the gumption to try gcc/make check, which requires a whole bunch more stuff than just gcc/make ... bdwgc, guile, libunistring, autogen, tcl, dejagnu, expect, pkg-config, ffi....kind of annoying, oh well. It looks like I succeeded this time, phew..
>
>
> Thanks, later,
> - Jay
>
>
>
> ----------------------------------------
>> From: wingo@pobox.com
>> To: jay.krell@cornell.edu
>> CC: bug-guile@gnu.org
>> Subject: Re: isinf and type-pun warning/error on OSF guile 1.8.7
>> Date: Thu, 10 Jun 2010 00:28:00 +0200
>>
>> Hi Jay,
>>
>> On Wed 09 Jun 2010 17:43, Jay K writes:
>>
>>> libtool: compile: gcc -DHAVE_CONFIG_H -I.. -I/home/jayk/src/guile-1.8.7 -I.. -mieee -mieee -D_REENTRANT -pthread -g -O2 -Wall -Wmissing-prototypes -Werror -MT libguile_la-numbers.lo -MD -MP -MF .deps/libguile_la-numbers.Tpo -c /home/jayk/src/guile-1.8.7/libguile/numbers.c -DPIC -o .libs/libguile_la-numbers.o
>>> cc1: warnings being treated as errors
>>> /home/jayk/src/guile-1.8.7/libguile/numbers.c: In function 'xisinf':
>>> /home/jayk/src/guile-1.8.7/libguile/numbers.c:144: error: implicit
>>> declaration of function 'isinf'
>>
>>> I couldn't find isinf in any header.
>>
>> This call only occurs if configure detected support `isinf', so surely
>> it is there? Can you check again? Barring that can you send a
>> config.log, please.
>>
>>> /home/jayk/src/guile-1.8.7/libguile/numbers.c: In function 'guile_ieee_init':
>>> /home/jayk/src/guile-1.8.7/libguile/numbers.c:623: error: dereferencing type-punned pointer will break strict-aliasing rules
>>> /home/jayk/src/guile-1.8.7/libguile/numbers.c:654: error: dereferencing type-punned pointer will break strict-aliasing rules
>>
>> Does replacing that DINIFINITY block with the following help?
>>
>> /* OSF */
>> extern unsigned int DINFINITY[2];
>> union
>> {
>> double d;
>> int i[2];
>> } alias;
>> alias.i[0] = DINFINITY[0];
>> alias.i[1] = DINFINITY[1];
>> guile_Inf = alias.d;
>>
>> Likewise for DQNAN:
>>
>> {
>> /* OSF */
>> extern unsigned int DQNAN[2];
>> union
>> {
>> double d;
>> int i[2];
>> } alias;
>> alias.i[0] = DQNAN[0];
>> alias.i[1] = DQNAN[1];
>> guile_NaN = alias.d;
>> }
>>
>>> I recall seeing the same problem on Irix, where autoconf does a link check
>>> and compiles without -Wmissing-prototype so it passes, because the function
>>> does exist somewhere. Autoconf checks need to more closely resemble
>>> how later compilation will occur.
>>
>> How does that work though -- does isinf have no header/declaration?
>>
>>> /home/jayk/src/guile-1.8.7/test-suite/standalone/test-conversion.c:859:
>>> error: dereferencing type-punned pointer will break strict-aliasing
>>> rules make[4]: *** [test_conversion-test-conversion.o] Error 1
>>
>> We can copy the above solution if it works. Let us know!
>>
>> Andy
>> --
>> http://wingolog.org/
 		 	   		  


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: isinf and type-pun warning/error on OSF guile 1.8.7
  2010-06-10  9:27   ` Jay K
@ 2010-06-10 12:26     ` Andy Wingo
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Wingo @ 2010-06-10 12:26 UTC (permalink / raw)
  To: Jay K; +Cc: bug-guile

On Thu 10 Jun 2010 11:27, Jay K <jay.krell@cornell.edu> writes:

> http://www.gnu.org/software/hello/manual/autoconf/Function-Portability.html
>
> recommend wither gnulib or a little other workaround shown.

Ah, we'll use gnulib then in master. For 1.8, I would recommend
compiling without -Werror, on your platform. (--disable-error-on-warning
argument to configure).

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: isinf and type-pun warning/error on OSF guile 1.8.7
  2010-06-09 15:43 isinf and type-pun warning/error on OSF guile 1.8.7 Jay K
  2010-06-09 22:28 ` Andy Wingo
@ 2010-09-07 22:52 ` Ludovic Courtès
  1 sibling, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2010-09-07 22:52 UTC (permalink / raw)
  To: Jay K; +Cc: bug-guile

Hi Jay,

Sorry for the late reply!

Jay K <jay.krell@cornell.edu> writes:

> libtool: compile:  gcc -DHAVE_CONFIG_H -I.. -I/home/jayk/src/guile-1.8.7 -I.. -mieee -mieee -D_REENTRANT -pthread -g -O2 -Wall -Wmissing-prototypes -Werror -MT libguile_la-numbers.lo -MD -MP -MF .deps/libguile_la-numbers.Tpo -c /home/jayk/src/guile-1.8.7/libguile/numbers.c  -DPIC -o .libs/libguile_la-numbers.o
> cc1: warnings being treated as errors
> /home/jayk/src/guile-1.8.7/libguile/numbers.c: In function 'xisinf':
> /home/jayk/src/guile-1.8.7/libguile/numbers.c:144: error: implicit declaration of function 'isinf'

[...]

> I couldn't find isinf in any header. 

Guile Git now uses Gnulib’s ‘isinf’ and ‘isnan’ modules.  However I’ve
just tested it on GNU/Linux and sparc-sun-solaris2.10 and I don’t have
access to a Tru64 box.

Could you try a tarball from
http://hydra.nixos.org/job/gnu/guile-master/tarball (pick one with
“Release Name” >= 1.9.12.5-gf328f86) and report back?

Thanks,
Ludo’.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-09-07 22:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-09 15:43 isinf and type-pun warning/error on OSF guile 1.8.7 Jay K
2010-06-09 22:28 ` Andy Wingo
2010-06-09 23:16   ` Jay K
2010-06-10  9:27   ` Jay K
2010-06-10 12:26     ` Andy Wingo
2010-09-07 22:52 ` Ludovic Courtès

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).