Your message dated Fri, 06 Aug 2004 09:48:40 +0200
with message-id <[EMAIL PROTECTED]>
and subject line Bug#263854: gcc-3.3: Generates bad code
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 6 Aug 2004 00:44:56 +0000
>From [EMAIL PROTECTED] Thu Aug 05 17:44:56 2004
Return-path: <[EMAIL PROTECTED]>
Received: from postfix4-2.free.fr [213.228.0.176] 
        by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
        id 1Bssqu-0006Vu-00; Thu, 05 Aug 2004 17:44:56 -0700
Received: from [127.0.0.1] (lns-th2-4f-81-56-242-77.adsl.proxad.net 
[81.56.242.77])
        by postfix4-2.free.fr (Postfix) with ESMTP
        id 1E4861BD778; Fri,  6 Aug 2004 02:44:54 +0200 (CEST)
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: Sylvain COUTANT <[EMAIL PROTECTED]>
To: Debian Bug Tracking System <[EMAIL PROTECTED]>
Subject: gcc-3.3: Generates bad code
X-Mailer: reportbug 2.63
Date: Fri, 06 Aug 2004 02:44:43 +0200
Message-Id: <[EMAIL PROTECTED]>
Delivered-To: [EMAIL PROTECTED]
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_25 
        (1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-8.0 required=4.0 tests=BAYES_00,HAS_PACKAGE 
        autolearn=no version=2.60-bugs.debian.org_2004_03_25
X-Spam-Level: 

Package: gcc-3.3
Version: 1:3.3.4-3
Severity: normal



-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.4.24-bf2.4
Locale: LANG=C, LC_CTYPE=C

Versions of packages gcc-3.3 depends on:
ii  binutils                   2.14.90.0.7-8 The GNU assembler, linker and bina
ii  cpp-3.3                    1:3.3.4-3     The GNU C preprocessor
ii  gcc-3.3-base               1:3.3.4-3     The GNU Compiler Collection (base 
ii  libc6                      2.3.2.ds1-13  GNU C Library: Shared libraries an
ii  libgcc1                    1:3.3.4-3     GCC support library

-- no debconf information

The following code compiles badly for the my_strncpy_bug function : the
if( *tmp ) ++ tmp; is never generated.

The difference between both loops is the use of an inside loop temp
variable.

Execution :

[EMAIL PROTECTED]:/tmp$ gcc -O2 -o y y.c
[EMAIL PROTECTED]:/tmp$ ./y
t1:My First string for this test ... t2:
t1:My First string for this test ... t2:My First string for this test
....
t1:My First string for this test ... t2:
t1:My First string for this test ...
t2:MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMBefore
 buggy
[EMAIL PROTECTED]:/tmp$


--begining of source code for y.c


#include <stdio.h>

char *my_strncpy_bug( char *dst, const char *src, unsigned int n ) {
        char *work = dst;
        
        while( n ) {
                const char *tmp = src;

                *work = *tmp;
                ++ work;
                if( *tmp )
                        ++ tmp;
                -- n;
        }
        return dst;
}

char *my_strncpy( char *dst, const char *src, unsigned int n ) {
        char *work = dst;
        
        while( n ) {
                *work = *src;
                ++ work;
                if( *src )
                        ++ src;
                -- n;
        }
        return dst;
}


int main( int argc, char **argv ) {
        char tmp1[] = "My First string for this test ...";
        char tmp_bug3[] = "Before buggy";
        char tmp_bug2[256] = { 0 };
        char tmp_nobug3[] = "Before no bug";
        char tmp_nobug2[256] = { 0 };

        printf( "t1:%s t2:%s\n", tmp1, tmp_nobug2 );
        my_strncpy( tmp_nobug2, tmp1, 256 );
        printf( "t1:%s t2:%s\n", tmp1, tmp_nobug2 );

        printf( "t1:%s t2:%s\n", tmp1, tmp_bug2 );
        my_strncpy_bug( tmp_bug2, tmp1, 256 );
        printf( "t1:%s t2:%s\n", tmp1, tmp_bug2 );

        return 0;
}

--end of source code for y.c

---------------------------------------
Received: (at 263854-done) by bugs.debian.org; 6 Aug 2004 07:49:23 +0000
>From [EMAIL PROTECTED] Fri Aug 06 00:49:23 2004
Return-path: <[EMAIL PROTECTED]>
Received: from mx5.informatik.uni-tuebingen.de [134.2.12.32] 
        by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
        id 1BszTf-0001UG-00; Fri, 06 Aug 2004 00:49:23 -0700
Received: from localhost (loopback [127.0.0.1])
        by mx5.informatik.uni-tuebingen.de (Postfix) with ESMTP id 230C7112
        for <[EMAIL PROTECTED]>; Fri,  6 Aug 2004 09:48:52 +0200 (MST)
Received: from mx5.informatik.uni-tuebingen.de ([127.0.0.1])
 by localhost (mx5 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP
 id 30402-02 for <[EMAIL PROTECTED]>;
 Fri,  6 Aug 2004 09:48:50 +0200 (DFT)
Received: from juist (semeai.Informatik.Uni-Tuebingen.De [134.2.15.66])
        by mx5.informatik.uni-tuebingen.de (Postfix) with ESMTP id 75D5C10D
        for <[EMAIL PROTECTED]>; Fri,  6 Aug 2004 09:48:49 +0200 (MST)
Received: from falk by juist with local (Exim 4.34)
        id 1BszSz-0000I1-O4
        for [EMAIL PROTECTED]; Fri, 06 Aug 2004 09:48:41 +0200
To: [EMAIL PROTECTED]
Subject: Re: Bug#263854: gcc-3.3: Generates bad code
References: <[EMAIL PROTECTED]>
From: Falk Hueffner <[EMAIL PROTECTED]>
X-Face: "iUeUu$b*W_"w?tV83Y3*r:`rh&dRv}$YnZ3,LVeCZSYVuf[Gpo*5%_=/\_!gc_,SS}[~xZ
 wY77I-M)xHIx:2f56g%/`SOw"Dx%4Xq0&f\Tj~>|QR|vGlU}TBYhiG(K:2<T^
Date: Fri, 06 Aug 2004 09:48:40 +0200
In-Reply-To: <[EMAIL PROTECTED]> (Sylvain
 COUTANT's message of "Fri, 06 Aug 2004 02:44:43 +0200")
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.5 (cabbage, linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Sender: Falk Hueffner <[EMAIL PROTECTED]>
X-Virus-Scanned: by amavisd-new (McAfee AntiVirus) at 
informatik.uni-tuebingen.de
Delivered-To: [EMAIL PROTECTED]
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_25 
        (1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-6.0 required=4.0 tests=BAYES_00,HAS_BUG_NUMBER 
        autolearn=no version=2.60-bugs.debian.org_2004_03_25
X-Spam-Level: 

Sylvain COUTANT <[EMAIL PROTECTED]> writes:

> -- no debconf information
>
> The following code compiles badly for the my_strncpy_bug function : the
> if( *tmp ) ++ tmp; is never generated.

Well, why should it it; it has no effect. Closing.

-- 
        Falk


Reply via email to