This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/14411] New: Request for setjmp/longjmp attributes


While working on a project that uses a function with setjmp-like semantics, it 
became necessary to supply the optimizer with such information. Otherwise, the 
following code: 
 
void *ptr = NULL; 
if (mysetjmp()) { 
	if (ptr) free(ptr); 
} 
else { 
	/* ... */ 
	ptr = malloc(...); 
	/* ... */ 
} 
 
does not do the call to free() when compiled with -O2 (the optimizer believes 
the ptr still is NULL and eliminates the call to free() completely).

-- 
           Summary: Request for setjmp/longjmp attributes
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: avn at any dot ru
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]