delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/03/14/18:33:01

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
From: "Craig H. Miller" <kidmosey AT musitu DOT org>
Organization: MUSITU International
To: cygwin AT sourceware DOT cygnus DOT com
Date: Wed, 14 Mar 2001 17:29:24 -0600
MIME-Version: 1.0
Subject: Possible bug in g++
Reply-to: kidmosey AT musitu DOT org
Message-ID: <3AAFAA74.23657.4190696@localhost>
X-mailer: Pegasus Mail for Win32 (v3.12c)

I compiled the following two sections of code using gcc and g++, 
respectively, using the -S switch to create asm source.  They both 
created almost exactly the same code, with one exception...

"test.c"
int main(void)
{
  int i = 0;
  for (; i < 100; i++)
    i = i * 30 + 4;

  return 0;
}

"test.cpp"
int main(void)
{
  for (int i = 0; i < 100; i++)
    i = i * 30 + 4;

  return 0;
}

"test.c.s"
...
L4:
	xorl %eax,%eax
	jmp L2
	.align 4
...

"test.cpp.s"
...
L4:
	xorl %eax,%eax
	jmp L2
	xorl %eax,%eax
	jmp L2
	.align 4
...


Is the compiler supposed to duplicate those two instructions?  
Admittedly, I don't know much about ASM programming, but this 
just seemed peculiar to me.

Thanks,
	Craig



=====================
Lost on the web?  Looking to design your own webpage?
Need information and examples about programming of any
kind from C/C++ to perl and php?
Check out http://www.musitu.org/
-
Don't know all the words to that one song by what's-his-name?
Try http://lyrics.musitu.org/
-
Have a fresh cup of coffee and no newspaper to read?
Browse my stories at http://voices.musitu.org/
=====================

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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