From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2295 invoked by alias); 23 May 2002 14:56:07 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 2225 invoked by uid 71); 23 May 2002 14:56:02 -0000 Date: Thu, 23 May 2002 07:56:00 -0000 Message-ID: <20020523145602.2223.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: "Brian Ceccarelli" Subject: RE: c++/6774: printf("%lld") prints bad values Reply-To: "Brian Ceccarelli" X-SW-Source: 2002-05/txt/msg00734.txt.bz2 List-Id: The following reply was made to PR c++/6774; it has been noted by GNATS. From: "Brian Ceccarelli" To: , , , , , Cc: Subject: RE: c++/6774: printf("%lld") prints bad values Date: Thu, 23 May 2002 10:58:12 -0400 I think I now discovered the real problem. pthread_t id; status = pthread_create(&id, ...) The first call to pthread_create returns a valid thread ID 'id' argument. Subsequent pthread_create calls return 0 for id. 'status' is 0 in each case indicating successful thread creation. (My multithreaded program works fine with the exception of that thread id.) I use a C++ object for each thread. I was setting my object's ID attribute to the 'id' argument returned by pthread_create. This works for the first thread I create, but not for subsequent threads. When I was printing out the thread_id, (which I later cast to long long), I was using "%lld". So I thought %lld was the problem. Since that wasn't the problem, I think the problem is with pthread_create. pthread_self() always returns the correct ID. I now use this function everytime I need the thread-id. Do you want me to file a separate bug report on this? Or am I going nuts again? :) I am on Red Hat Linux on an Intel platform. Same thing happens on Mandrake Linux on Intel. Brian brian@talusmusic.com -----Original Message----- From: rth@gcc.gnu.org [mailto:rth@gcc.gnu.org] Sent: Thursday, May 23, 2002 2:42 AM To: brian@talusmusic.com; gcc-bugs@gcc.gnu.org; gcc-prs@gcc.gnu.org; nobody@gcc.gnu.org Subject: Re: c++/6774: printf("%lld") prints bad values Synopsis: printf("%lld") prints bad values State-Changed-From-To: open->closed State-Changed-By: rth State-Changed-When: Wed May 22 23:42:06 2002 State-Changed-Why: Buggy test case. You have a typo in your printf format. Should be "1 << %lld = %lld". Using -Wall would have pointed this out: z.c: In function `main': z.c:11: warning: int format, different type arg (arg 2) http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p r=6774