lkml.org 
[lkml]   [2004]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [2.6 patch] kill IN_STRING_C
Date
On Monday 08 of November 2004 17:31, you wrote:
> On Mon, Nov 08, 2004 at 05:19:35PM +0100, Andi Kleen wrote:
> > > Rethinking it, I don't even understand the sprintf example in your
> > > changelog entry - shouldn't an inclusion of kernel.h always get it
> > > right?
> >
> > Newer gcc rewrites sprintf(buf,"%s",str) to strcpy(buf,str)
> > transparently.
>
> Which gcc is "Newer"?
>
> My gcc 3.4.2 didn't show this problem.

#include <stdio.h>
#include <string.h>
char buf[128];
void test(char *str)
{
sprintf(buf, "%s", str);
}

gcc -Wall sp.c -S -O2 -fomit-frame-pointer -mregparm=3

.file "sp.c"
.text
.p2align 4,,15
.globl test
.type test, @function

test:
movl %eax, %edx
movl $buf, %eax
jmp strcpy

.size test, .-test
.comm buf,128,32
.section .note.GNU-stack,"",@progbits
.ident "GCC: (GNU) 3.4.3 (PLD Linux)"

--
/* Copyright (C) 2003, SCO, Inc. This is valuable Intellectual Property. */

#define say(x) lie(x)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:07    [W:0.129 / U:1.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site