g++ doing strange things

g++ doing strange things

Post by Anthony W. Becke » Tue, 01 Oct 1996 04:00:00



Hey all,

I recently upgraded to kernel 2.0.20 from 1.2.13 (Caldera).  I did it by
the book, I think - new libs, many new packages to take advantage of
and/or not break under the new kernel.  Libc is 5.2.18, libg++ is
27.1.4.

Well, lo and behold, now when I compile this program that in g++ (gcc
2.7.2-2 rpm from redhat) I get strange output.  It's supposed to read an
int and two doubles, then compute the sum: here's what it gives me
instead.

-----
Please enter an int: 44
You entered the integer 44.  Thanks.
Please enter a double: 55.66
You entered the double 55.6600.  Thanks.
Please enter another double: -123.5
You entered a second double, -1.67067e-3523.  Thanks.

The sum of these three numbers is -1.87951e-3508.  Have a nice day.
-----

Judging from the gibberishiness of the last two numbers, I'd say
something isn't working right with a pointer, or something isn't getting
stored in the right place, or the linker is just plain screwed up.
Maybe some kind of data type error.  But I'm darned if I can figure out
what's causing this.

Oh, and it's not the code.  I've compiled the exact same program using
gcc 2.7.2.1 on an HP workstation and it gives the correct answer.  I
can't believe that such a simple program would break on essentially the
same compiler on a different platform.  If anybody has had this same
problem or recognizes what it is, I'd appreciate any help you might
offer.

-Tony

--
Anthony W Becker        CAS '98 Political Science
1707 Ridge Ave #204      Northwestern University

(847) 491-6079             Wearer of many hats.

 
 
 

g++ doing strange things

Post by B.A.McCau.. » Fri, 04 Oct 1996 04:00:00



Quote:>Oh, and it's not the code.  I've compiled the exact same program using
>gcc 2.7.2.1 on an HP workstation and it gives the correct answer.

That doesn't proove it's right!  It may be right or it may do
something with an undefined outcome.  Incidently the GCC manual warns
very strongly about the futility of reporting a bug and witholding your
specimen code.

Quote:>I
>can't believe that such a simple program would break on essentially the
>same compiler on a different platform.  If anybody has had this same
>problem or recognizes what it is, I'd appreciate any help you might
>offer.

I recognise the problem (it was posted a few weeks back) but without
being able to compile your source locallly and reproduce the problem I
am unable to recall the cause.

--

 .  _\\__[oo       from       | Phones: +44 121 471 3789 (home)

.  l___\\    /~~) /~~[  /   [ | PGP-fp: D7 03 2A 4B D8 3A 05 37...
 # ll  l\\  ~~~~ ~   ~ ~    ~ | http://wcl-l.bham.ac.uk/~bam/


 
 
 

1. wget doing strange things...

Having noticed a recent thread here about wget I thought I would try it.

Can anyone see a reason why it would not download a jpg.

the command I used was,

wget http://www.mcartledge.freeserve.co.uk/index/gp24.jpg

Any idea why this does not work?  I've tried many times with all the options
I can from the man page and nothing will work.
Using lynx this URL can be found and the image downloaded, but with wget
this is the output,


http://www.mcartledge.freeserve.co.uk/index/gp24.>
--19:25:09--  http://www.mcartledge.freeserve.co.uk:80/index/gp24.jpg
           => `gp24.jpg'
Connecting to www.mcartledge.freeserve.co.uk:80... connected!
HTTP request sent, awaiting response... 404 Not Found
19:25:10 ERROR 404: Not Found.

I'm not sure what's going on.

Thanks.

Ian.

2. problems mounting Zip drive

3. eql doing strange things..I think?

4. 2.4.19-pre4 IDE-problem

5. kppp doing strange things to resolv.conf

6. Examples or docs for newt library?

7. Strange thing. Really.

8. Win95, I2O, Linux etc...

9. a Strange thing!

10. Strange things happen when reading from CD-ROM

11. Some strange things about /proc/isapnp.

12. hosts.equiv - strange things

13. Really strange thing with Linux & WinNT 4.0 - Help...