🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #393

Labels as values in gcc-2.1

#393
From: Tony Hosking
Date: Tue, 14 Apr 1992 07:58
30 lines
1167 bytes
GCC version 2.1 on a DECStation 3100 running Ultrix-4.1 compiles the following
program wrongly when the -O flag is used:

#include <stdio.h>

int main (void) {
  __label__ lab;

  void *try (void) {
    return &&lab;
  }

  goto *try();
  return;
 lab:
  printf ("Hello world!\n");
}

gcc inadvertently eliminates the code at the label "lab" since it believes it
to be dead.  Surely taking the address of a label using && should indicate to
the optimizer that the code is indeed reachable!

Thanks,

		Tony Hosking
Papernet:	Dept. of Computer Science
		University of Massachusetts			 _--_|\
		Amherst, MA 01003				/      \
Voicenet:	(413) 545-0256					\_.--._/    )
Internet:	hosking@cs.umass.edu				      v    /
Technical Details
Message-ID: <9204141558.AA06006@ibis.cs.umass.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.umass.edu!hosking%ibis

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.umass.edu!hosking%ibis
From: hosking%ibis@cs.umass.edu (Tony Hosking)
Subject: Labels as values in gcc-2.1
Message-ID: <9204141558.AA06006@ibis.cs.umass.edu>
Sender: gnulists@ai.mit.edu
Reply-To: hosking@cs.umass.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 14 Apr 1992 07:58:26 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 31