public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/1056] New: Wrong count return from fprintf(strderr,...), printf() is ok...
@ 2005-07-08 13:34 thomas dot welsch at hauk-sasko dot de
  2005-07-08 13:40 ` [Bug libc/1056] " jakub at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: thomas dot welsch at hauk-sasko dot de @ 2005-07-08 13:34 UTC (permalink / raw)
  To: glibc-bugs

After updating my gentoo systems i'v got different returns from 
fprintf(stdout,...) and printf(). 
When there are nor characters after the format fprintf() returns 
1 instead the number of characters written...: 
Example: 
------------------------------------------------------- 
#include <stdio.h> 
#include <string.h> 
 
int main(int argc,char *argv[]) 
 
{ 
char  *s = "123"; 
int   return_of_printf; 
int   return_of_fprintf; 
int   return_of_fprintf_fixed; 
 
 
    return_of_printf        = printf("%s",s); 
    printf("\n"); 
    return_of_fprintf       = fprintf(stdout,"%s",s); 
    printf("\n"); 
    return_of_fprintf_fixed = fprintf(stdout,"%s ",s);      // One char after 
%s.... 
    printf("\n"); 
 
    if (return_of_printf != return_of_fprintf || 
        return_of_printf != (int) strlen(s)) { 
 
        printf("BAD !\n"); 
        printf("strlen()                = %d\n",(int) strlen(s)); 
        printf("return_of_printf        = %d\n",return_of_printf); 
        printf("return_of_fprintf       = %d\n",return_of_fprintf); 
        printf("return_of_fprintf_fixed = %d\n",return_of_fprintf_fixed); 
    } 
    else { 
        printf("Good\n"); 
    } 
 
    return 0 ; 
} 
------------------------------------------------------- 
Output: 
------------------------------------------------------- 
123 
123 
123  
BAD ! 
strlen()                = 3 
return_of_printf        = 3 
return_of_fprintf       = 1 
return_of_fprintf_fixed = 4 
------------------------------------------------------- 
 
The 1 is wrong (I think...)

-- 
           Summary: Wrong count return from fprintf(strderr,...), printf()
                    is ok...
           Product: glibc
           Version: 2.3.5
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: gotom at debian dot or dot jp
        ReportedBy: thomas dot welsch at hauk-sasko dot de
                CC: glibc-bugs at sources dot redhat dot com
  GCC host triplet: i686-pc-linux-gnu


http://sources.redhat.com/bugzilla/show_bug.cgi?id=1056

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug libc/1056] Wrong count return from fprintf(strderr,...), printf() is ok...
  2005-07-08 13:34 [Bug libc/1056] New: Wrong count return from fprintf(strderr,...), printf() is ok thomas dot welsch at hauk-sasko dot de
@ 2005-07-08 13:40 ` jakub at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: jakub at redhat dot com @ 2005-07-08 13:40 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From jakub at redhat dot com  2005-07-08 13:40 -------
Then you should report that to gentoo, not here.
I have just tested it on i686, x86-64, ppc32 and ppc64 and it works just fine
with current glibc.
It sounds more like a broken GCC optimization in whatever customized compiler
gentoo is using.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME


http://sources.redhat.com/bugzilla/show_bug.cgi?id=1056

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-07-08 13:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-08 13:34 [Bug libc/1056] New: Wrong count return from fprintf(strderr,...), printf() is ok thomas dot welsch at hauk-sasko dot de
2005-07-08 13:40 ` [Bug libc/1056] " jakub at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).