delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/02/28/11:06:35

From: eplmst AT lu DOT erisoft DOT se (Martin Stromberg)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: bug
Date: 28 Feb 2001 15:45:54 GMT
Organization: Ericsson Erisoft AB, Sweden
Lines: 57
Message-ID: <97j6fi$1st$1@antares.lu.erisoft.se>
References: <3A9CFB23 DOT 86C6D3EF AT sci DOT kun DOT nl>
NNTP-Posting-Host: lws256.lu.erisoft.se
X-Newsreader: TIN [version 1.2 PL2]
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Michiel de Bondt (michielb AT sci DOT kun DOT nl) wrote:
: This is a multi-part message in MIME format.
: --------------524796937C70976A6AFCB0C8
: Content-Type: text/plain; charset=us-ascii
: Content-Transfer-Encoding: 7bit

: Hello djgpp-ers,

: I think I found a bug in gcc. But first, I had to mail the bug to this
: newsgroup. gcc allocates an occupied register for a computation. I made
: the following small sample file of the problem. You should cancel
: optimization, otherwise the problem does not occur due to removal of
: code.

: Best regard, Michiel de Bondt




: --------------524796937C70976A6AFCB0C8
: Content-Type: text/plain; charset=us-ascii;
:  name="regs.cpp"
: Content-Transfer-Encoding: 7bit
: Content-Disposition: inline;
:  filename="regs.cpp"

: // do not use optimization

: union intel
: {
:   long e;
:   short x;
:   struct {
:     char l;
:     char h;
:   } b;
: };

: int main ()
: {
:   register union intel a __asm__ ("%eax");
:   register union intel b __asm__ ("%ebx");
:   register union intel c __asm__ ("%ecx");
:   register union intel d __asm__ ("%edx");
:   b.b.l++;
: }

: --------------524796937C70976A6AFCB0C8--

gcc 2.952 refuses to compile this (unless I turn on optimisations and
then the whole output is optimised away exactly as noted). What is the
problem?


Right,

						MartinS

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019