[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FYI: gcc 2.7.2.1 problem on PPC, does it apply to *BSD ?



Matthieu,

It appears that the GNU 'gcc 2.7.2.1' we are using for PowerPC
with OpenBSD, not targeting embedded... behaves identically
to your example.
------------------------------------------------------------------------
Here is the case while running your program from OpenBSD..on the PowerPC
p604e
implementation (not officially released though OpenBSD...yet..so don't
ask
them for support.)

power4e# ls -l
total 52
-rwxr-xr-x  1 root  wheel  51254 Dec 18 08:18 tva_test
-rw-r--r--  1 root  wheel    880 Dec 18 08:18 tva_test.c
power4e# ./tva_test
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
28 29 30
 31 32 33 34 0
1.000000 2.000000 3.000000 4.000000 5.000000 6.000000 7.000000 8.000000
12.00000
0 13.000000 14.000000 15.000000 16.000000 17.000000 18.000000 19.000000
20.00000
0 21.000000 22.000000 23.000000 24.000000 25.000000 26.000000 27.000000
28.00000
0 29.000000 30.000000 31.000000 32.000000 33.000000 34.000000 0.000000
power4e# 
-------------------------------

As you can see, the results do NOT differ from yours in the VxWorks
environment.

I have also tested your example on the OpenBSD v2.1 for i386, SPARC,
mvme68k 
and found that it behaves correctly on those architectures ... no
surprise there.

So, have you discussed this with anyone from, say, Cygnus...or in the
GNU 'gcc'
newsgroups?  It seems that you have found an easily reproduced bug
(feature :-) in the
compiler toolchain...

Randy
-----------

Matthieu Herrb wrote:
> 
> Hi,
> 
> doing work totally unrelated to OpenBSD, I found the following problem
> with the GNU toolchain used by VxWorks on PowerPC. I checked that the
> GNU gcc 2.7.2.1 configured for target=ppc-eabi also have the
> problem. egcs 1.0 doesn't.
> 
> Does this also exist on OpenBSD (or any other free OS on PowerPC
> machines using gcc ?) or is it only the Embedded ABI which shows the
> problem ?
> 
>  | From: Matthieu Herrb <matthieu@laas.fr>
>  | Newsgroups: comp.os.vxworks
>  | Subject: stdarg problems on 5.3.1/ppc with gnu toolchain
>  | Date: 12 Dec 1997 20:15:15 +0100
>  |
>  | Hi,
>  |
>  | I experimented some bugs with the GNU compiler bundled with VxWorks
>  | 5.3.1 on a PowerPC target. The code appended below illustrates it:
>  |
>  | ---Cut Here---
>  | #include <vxWorks.h>
>  | #include <stdio.h>
>  | #include <stdarg.h>
>  |
>  | void
>  | tva(int type, ...)
>  | {
>  |     va_list ap;
>  |     double d;
>  |     int i;
>  |
>  |     va_start(ap, type);
>  |
>  |     if (type == 0) {
>  |      do {
>  |          i = va_arg(ap, int);
>  |          printf("%d ", i);
>  |      } while (i != 0);
>  |     } else {
>  |      do {
>  |          d = va_arg(ap, double);
>  |          printf("%f ", d);
>  |      } while (d != 0);
>  |     }
>  |     va_end(ap);
>  | }
>  |
>  |
>  | void
>  | tva_main(void)
>  | {
>  |     tva(0, 1 ,2 ,3 ,4 ,5 ,6, 7, 8, 9, 10 ,11, 12, 13, 14, 15, 16,
>  |      17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
>  |      32, 33, 34, 0);
>  |     printf("\n");
>  |     tva(1, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0,
>  |      11.0, 12.0, 13.0, 14.0, 15.0, 16.0,
>  |      17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0,
>  |      26.0, 27.0, 28.0, 29.0, 30.0, 31.0,
>  |      32.0, 33.0,  34.0, 0.0);
>  |     printf("\n");
>  | }
>  | ---Cut Here---
>  |
>  | Here's a sample execution:
>  |
>  | -> tva_main
>  | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
>  | 27 28 29 30 31 32 33 34 0
>  | 1.000000 2.000000 3.000000 4.000000 5.000000 6.000000 7.000000
>  | 8.000000  12.000000 13.000000 14.000000 15.000000 16.000000 17.000000
>  | 18.000000 19.000000 20.000000 21.000000 22.000000 23.000000 24.000000
>  | 25.000000 26.000000 27.000000 28.000000 29.000000 30.000000 31.000000
>  | 32.000000 33.000000 34.000000 0.000000
>  | value = 1 = 0x1
>  |
>  | when the arguments are doubles, the 9th to 11th arguments are ignored.
>  |
>  | I traced this to incorrect code produced by gcc: the first 8 arguments
>  | are passed in registers, and then it places the other arguments at the
>  | wrong address on the stack.
>  |
>  | For information, EGCS 1.0 with GNU binutils 2.8.1, configured with
>  |  --target=ppc-eabi don't have the bug.
> 
>                                         Matthieu

-- 
..              .
                     ()        | Kenneth R. (Randy) Lewis
 _/_/         _/_/ _/_/        | email: krl@vicomp.com
  _/        _/      _/         | phone: +1 919 644 6306
   _/      _/       _/         |   fax: +1 919 644 6409
    _/    _/        _/         | smail: V.I Computer, Inc.
     _/  _/         _/         |        531 Encinitas Blvd
      _/_/          _/         |        Bldg 114
       _/         _/_/_/       |        Encinitas, CA 92024
.           .  computer corp.  | http://www.vmepower.com   .