🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #182

gcc-Optimize

#182
From: Thomas Kaiser
Date: Wed, 22 Jul 1992 17:41
138 lines
3295 bytes
Dear Sirs:

i discovered an bug, when gcc -g -O removed (optimized) a statement. It
removes count-- from the example.

With regards

Thomas Kaiser
Leibniz Supercomputing Centre
Muenchen
Germany

--
-------------------------------------------------------------------------
Thomas Kaiser         Internet:	kaiser@sunmanager.lrz-muenchen.de
LRZ-Muenchen          X400:	C=DE;A=DBP;P=LRZ-MUENCHEN;OU=LRZ;S=Kaiser
-------------------------------------------------------------------------


------------------------------------------------------------------
int make_snmp_query(ip_address, variable, the_community, count)

char *ip_address;
char *variable;
char *the_community;
int  count;

{
  int i;

  alarm(10);
  if (setjmp(env)) {
    printf("xifload: receive timed out from %s\n", ip_address);
    close(s);
    for (i=0; i<num_malloc; i++)
      free(malloc_table[i]);
    num_malloc = 0;
    if (count <= 1)
      return -1;
    else {
      count--;        <------------------ will be removed
      alarm(10);
    }
  }
  make_the_query(ip_address, variable, the_community);
  alarm(0);
  for (i=0; i<num_malloc; i++)
    free(malloc_table[i]);
  num_malloc = 0;
  return 0;
}
--------------------------------------------------
	.align 8
LC3:
	.ascii "xifload: receive timed out from %s\12\0"
	.align 4
	.global _make_snmp_query
	.proc	04
_make_snmp_query:
	!#PROLOGUE# 0
	save %sp,-144,%sp
	!#PROLOGUE# 1
	st %i0,[%fp-20]
	st %i1,[%fp-28]
	st %i2,[%fp-36]
	st %i3,[%fp-44]
	call _alarm,0
	mov 10,%o0
	sethi %hi(_env),%o0
	call _setjmp,0
	or %o0,%lo(_env),%o0
	cmp %o0,0
	be L16
	sethi %hi(LC3),%o0
	or %o0,%lo(LC3),%o0
	call _printf,0
	ld [%fp-20],%o1
	sethi %hi(_s),%o0
	call _close,0
	ld [%o0+%lo(_s)],%o0
	mov 0,%i0
	sethi %hi(_num_malloc),%o0
	ld [%o0+%lo(_num_malloc)],%o0
	cmp %i0,%o0
	bge L28
	sethi %hi(_num_malloc),%o0
	sethi %hi(_malloc_table),%o0
	or %o0,%lo(_malloc_table),%i2
	sethi %hi(_num_malloc),%i1
	sll %i0,2,%o0
L29:
	call _free,0
	ld [%o0+%i2],%o0
	add %i0,1,%i0
	ld [%i1+%lo(_num_malloc)],%o0
	cmp %i0,%o0
	bl L29
	sll %i0,2,%o0
	sethi %hi(_num_malloc),%o0
L28:
	st %g0,[%o0+%lo(_num_malloc)]
	ld [%fp-44],%o3
	cmp %o3,1
	ble L27
	mov -1,%i0          <----------- count-- is missing
	call _alarm,0
	mov 10,%o0
L16:
	ld [%fp-20],%o0
	ld [%fp-28],%o1
	call _make_the_query,0
	ld [%fp-36],%o2
	call _alarm,0
	mov 0,%o0
	mov 0,%i0
	sethi %hi(_num_malloc),%o0
	ld [%o0+%lo(_num_malloc)],%o0
	cmp %i0,%o0
	bge L24
	sethi %hi(_malloc_table),%o0
	or %o0,%lo(_malloc_table),%i2
	sethi %hi(_num_malloc),%i1
	sll %i0,2,%o0
L30:
	call _free,0
	ld [%o0+%i2],%o0
	add %i0,1,%i0
	ld [%i1+%lo(_num_malloc)],%o0
	cmp %i0,%o0
	bl L30
	sll %i0,2,%o0
L24:
	sethi %hi(_num_malloc),%o0
	st %g0,[%o0+%lo(_num_malloc)]
	mov 0,%i0
L27:
	ret
	restore
Technical Details
Message-ID: <9207221341.AA22022@sunmanager.lrz-muenchen.de>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!sunmanager.lrz-muenchen.de!a2824ak

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!sunmanager.lrz-muenchen.de!a2824ak
From: a2824ak@sunmanager.lrz-muenchen.de (Thomas Kaiser)
Subject: gcc-Optimize
Message-ID: <9207221341.AA22022@sunmanager.lrz-muenchen.de>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 22 Jul 1992 17:41:16 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 140