egcs-problem 1.0.2

Jeffrey A Law law@cygnus.com
Sun Apr 5 21:29:00 GMT 1998


  In message < m0yLfGJ-00058xC@ocean.lucon.org >you write:
  > > On Wed, 25 Feb 1998, Jeffrey A Law wrote:
  > > 
  > > > I think the best way to proceed is for someone to give me a hunk of
  > > > code that I can feed the compiler that will show a case where a
  > > > clobber is being used for input addressing.  That way I can debug
  > > > the compiler and see what's really happening.
  > > 
  > > I can't keep up with the weekly updates, so my GCC currently is:
  > >  gcc version egcs-2.91.06 980122 (gcc-2.8.0 release)
  > > 
  > > The following code breaks when compiled with -fno-strength-reduce, but
  > > independantly of -O2/-O3, -fomit-frame-pointer, and -m[345]86:
  > > 
  > > =========================================================================
  > ======
  > > #include <linux/string.h>
  > 
  > 
  > Please don't use anything from <linux/> or <asm/> directly in
  > the user codes unless it it is absolutely necessary.
  > 
  > > 
  > > int count_substring_matches(char **haystacks, char **needles)
  > > {
  > > 	int hits=0, i, j;
  > > 	for(i=0; haystacks[i]; i++) {
  > > 		for(j=0; needles[j]; j++) {
  > > 		  	if (strstr(haystacks[i], needles[j])) hits++;
  > > 		}
  > > 	}
  > > 	return hits;
  > > }
This is the "linux asm" problem that I haven't been able to look at
for the last month or so due to personal and company commitments.

Basically there's a couple problems:

  * The linux x86 asm for strstr is totally bogus.

  * GCC does not issue a warning/error when it encouters the bogus
  asm and instead generates incorrect code.

jeff



More information about the Gcc mailing list