Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Re: axp/gcc the double cast gets trashed on return ( really a GDB BUG )
       [not found] <343A30B1.CD60EA8F@voicenet.com>
@ 1997-10-07 12:33 ` Volker Barthelmann
  0 siblings, 0 replies; 2+ messages in thread
From: Volker Barthelmann @ 1997-10-07 12:33 UTC (permalink / raw)


On Tue, 7 Oct 1997, Uncle George wrote:

> > The code is basically broken. Reading another member of a union than the
> > one which was last written causes implementation defined behaviour (IMHO
> > it should even be undefined behaviour).
> 
> This is not a broken feature, but rather a porting implimentation problem. The
> long on alpha is 64 bit, the double on a alpha is 64 bit. a union would make the
> space ONE. in reality quite a few people do this for the exact same reasons, so
> long as u understand how things are getting stored ( including packed/unpacked
> structs!)

It is not enough to know the exact representation of the data-types. You
are depending on how some things work inside the compiler. There are
compilers which will break such code no matter how the data is stored.

gcc may not do this, but gcc is extremely conservative in handling
aliasing. Compilers with more aggressive optimizers or even a future
version of gcc might break such code.

Volker

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

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

* axp/gcc the double cast gets trashed on return ( really a GDB BUG )
@ 1997-10-07 12:53 Uncle George
  0 siblings, 0 replies; 2+ messages in thread
From: Uncle George @ 1997-10-07 12:53 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2465 bytes --]

--------------5882E66C177C4E5ED3A7EF8D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Volker Barthelmann wrote:

> On Mon, 6 Oct 1997, Uncle George wrote:
> The code is basically broken. Reading another member of a union than the
> one which was last written causes implementation defined behaviour (IMHO
> it should even be undefined behaviour).

This is not a broken feature, but rather a porting implimentation problem. The
long on alpha is 64 bit, the double on a alpha is 64 bit. a union would make the
space ONE. in reality quite a few people do this for the exact same reasons, so
long as u understand how things are getting stored ( including packed/unpacked
structs!)

BTW. i ran the pgm without gdb, and it prints out the right contents,
    I ran GDB without any breakpoints, and the printed values were correct.
                BUT
    running gdb, using  next stepping caused the values to be mixed up. SO I GUESS
its a gdb/ptrace bug! (fudge!!!)

> --
> To unsubscribe: send e-mail to axp-list-request@redhat.com with
> 'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

--------------5882E66C177C4E5ED3A7EF8D
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

 

Volker Barthelmann wrote:
On Mon, 6 Oct 1997, Uncle George wrote:

The code is basically broken. Reading another member of a union than
the

one which was last written causes implementation defined behaviour
(IMHO

it should even be undefined behaviour).
This is not a broken feature, but rather a porting implimentation problem.
The long on alpha is 64 bit, the double on a alpha is 64 bit. a union would
make the space ONE. in reality quite a few people do this for the
exact same reasons, so long as u understand how things are getting stored
( including packed/unpacked structs!)

BTW. i ran the pgm without gdb, and it prints out the right contents,

    I ran GDB without any breakpoints, and the printed
values were correct.

               
BUT

    running gdb, using  next stepping caused the
values to be mixed up. SO I GUESS its a gdb/ptrace bug! (fudge!!!)

--

To unsubscribe: send e-mail to axp-list-request@redhat.com with

'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com
 

--------------5882E66C177C4E5ED3A7EF8D--

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

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

end of thread, other threads:[~1997-10-07 12:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-10-07 12:53 axp/gcc the double cast gets trashed on return ( really a GDB BUG ) Uncle George
     [not found] <343A30B1.CD60EA8F@voicenet.com>
1997-10-07 12:33 ` Volker Barthelmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox