[Bug tree-optimization/19917] New: [4.0 regression] Weak const function mishandled inside loop

schwab at suse dot de gcc-bugzilla@gcc.gnu.org
Sat Feb 12 15:35:00 GMT 2005


$ cat weak.c
extern void *__pthread_internal_tsd_address (void) __attribute__ ((__const__));
#pragma weak __pthread_internal_tsd_address
void f (void)
{
  for (;;)
    if (__pthread_internal_tsd_address ? __pthread_internal_tsd_address () : 0)
      return;
}
$ gcc/xgcc -Bgcc -O2 -S weak.c
$ grep __pthread weak.s
	br.call.sptk.many b0 = __pthread_internal_tsd_address#
	addl r14 = @ltoff(@fptr(__pthread_internal_tsd_address#)), gp
	.weak	__pthread_internal_tsd_address#

__pthread_internal_tsd_address is called before being checked for NULL.

Broken by this change:

2004-07-09  Zdenek Dvorak  <rakdver@atrey.karlin.mff.cuni.cz>

	* tree-ssa-loop-im.c: New file.
	...

-- 
           Summary: [4.0 regression] Weak const function mishandled inside
                    loop
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: critical
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: schwab at suse dot de
                CC: gcc-bugs at gcc dot gnu dot org,rakdver at atrey dot
                    karlin dot mff dot cuni dot cz
GCC target triplet: ia64-*-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19917



More information about the Gcc-bugs mailing list