------- Comment #2 from ghazi at gcc dot gnu dot org  2005-11-29 21:46 -------
Hmm this is convoluted, but I think I know what's going on:

We're running the builtin fprintf check.  I recently added a small sanity check
to ensure that fprintf_unlocked also works.  Now we're getting an unresolved
symbol calling fputs_unlocked.

But to ensure that these _unlocked style calls don't result in unresolved
symbols I had only added cases that should have been completely optimized away.
 E.g. fprintf_unlocked(stream, "") which should become nothing.

Now hpux defines DONT_HAVE_FPUTC_UNLOCKED, notice that's fputC_unlocked not
fputS_unlocked which is the unresolved symbol we get.  But we have this code at
the top of fold_builtin_fputs:

  /* If the return value is used, or the replacement _DECL isn't
     initialized, don't do the transformation.  */
  if (!ignore || !fn_fputc || !fn_fwrite)
    return 0;

So the solution is to split these checks and move the !fn_fputc || !fn_fwrite
check later on where we actually attempt to use them.  That way the path which
eliminates zero-length strings will still be executed.

I'll put together a patch.


-- 

ghazi at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |ghazi at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-11-29 21:46:13
               date|                            |


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

Reply via email to