Re: How to Install GCC

2007-03-31 Thread Denis Vlasenko
On Sunday 11 March 2007 16:01, Thomas Schwinge wrote: On Sun, Mar 11, 2007 at 10:45:53AM -0400, Sadri SARRAY wrote: Please, Would you like to send me a procedure to install the GCC compiler on a Linux-Ubuntu OS ? With a power screwdriver. Granted, poster was totally new to Linux and asked

gcc 4.1.1: char *p = str puts str into rodata

2007-01-28 Thread Denis Vlasenko
char p; int main() { p = ; return 0; } Don't you think that should end up in rw data? /* .file t.c .section.rodata.str1.1,aMS,@progbits,1 .LC0: .string .text .globl main .type main, @function main: pushl %ebp

Re: GCC4 makes off by ones more exploitable again, misuse of padding?

2007-01-25 Thread Denis Vlasenko
On Thursday 25 January 2007 01:43, In Cognito wrote: 0x080483a7 func+3:sub$0x208,%esp 0x080483ad func+9:mov0x8(%ebp),%eax 0x080483b0 func+12: mov%eax,0x4(%esp) 0x080483b4 func+16: lea0xfe00(%ebp),%eax 0x080483ba func+22: mov%eax,(%esp)

Re: GCC4 makes off by ones more exploitable again, misuse of padding?

2007-01-24 Thread Denis Vlasenko
On Thursday 25 January 2007 01:22, In Cognito wrote: Hello, It's nice to see a more security-minded release of gcc with v4. Variables are moved around to reduce chances for exploitation, -fstack-protector, etc. Great! Why are local variables once-again adjacent to the saved frame pointer

Re: GCC optimizes integer overflow: bug or feature?

2006-12-23 Thread Denis Vlasenko
On Saturday 23 December 2006 10:06, Rask Ingemann Lambertsen wrote: No, because you'd read past the end of the array: #include stdlib.h int main (int argc, char *argv[]) { char *a; if ((a == malloc (sizeof (char { int r; a[0] = 1; r = f (a);

Re: GCC optimizes integer overflow: bug or feature?

2006-12-22 Thread Denis Vlasenko
On Friday 22 December 2006 03:03, Paul Brook wrote: On Friday 22 December 2006 00:58, Denis Vlasenko wrote: On Tuesday 19 December 2006 23:39, Denis Vlasenko wrote: There are a lot of 100.00% safe optimizations which gcc can do. Value range propagation for bitwise operations, for one

Re: GCC optimizes integer overflow: bug or feature?

2006-12-21 Thread Denis Vlasenko
On Tuesday 19 December 2006 23:39, Denis Vlasenko wrote: There are a lot of 100.00% safe optimizations which gcc can do. Value range propagation for bitwise operations, for one Or this, absolutely typical C code. i386 arch can compare 16 bits at a time here (luckily, no alighment worries

Re: GCC optimizes integer overflow: bug or feature?

2006-12-19 Thread Denis Vlasenko
On Tuesday 19 December 2006 11:37, Paolo Bonzini wrote: By the way, as I've tried to describe here: http://cert.uni-stuttgart.de/advisories/c-integer-overflow.php variable range tracking can result in reintroduction of supposedly-fixed security vulnerabilities. 8-( Interesting read.

Re: GCC optimizes integer overflow: bug or feature?

2006-12-19 Thread Denis Vlasenko
On Tuesday 19 December 2006 20:05, Andrew Haley wrote: Denis Vlasenko writes: I wrote this just a few days ago: do { int32_t v1 = v 1; if (v 0) v1 ^= mask; v = v1; printf(%10u: %08x\n, c++, v

Re: GCC optimizes integer overflow: bug or feature?

2006-12-19 Thread Denis Vlasenko
On Tuesday 19 December 2006 22:46, Paul Brook wrote: Compiler can optimize it any way it wants, as long as result is the same as unoptimized one. We have an option for that. It's called -O0. Pretty much all optimization will change the behavior of your program. Even x*2 - x+x? Or

Re: distributing g++

2006-12-16 Thread Denis Vlasenko
On Friday 15 December 2006 22:30, Ferad Zyulkyarov wrote: Hi What are the standard practices with installing multiple versions of gcc on a system. I renamed this gcc to be gcc-4.1. However, it looks like it will still overwrite some files when I do 'make install'. Is this true? As far

Re: distributing g++

2006-12-16 Thread Denis Vlasenko
On Friday 15 December 2006 22:30, Ferad Zyulkyarov wrote: Hi What are the standard practices with installing multiple versions of gcc on a system. I renamed this gcc to be gcc-4.1. However, it looks like it will still overwrite some files when I do 'make install'. Is this true? As far

Re: g++ doesn't unroll a loop it should unroll

2006-12-13 Thread Denis Vlasenko
Disclaimer: I am not a compiler developer. On Wednesday 13 December 2006 12:44, BenoƮt Jacob wrote: I'm developing a Free C++ template library (1) in which it is very important that certain loops get unrolled, but at the same time I can't unroll them by hand, because they depend on template

Re: problem piping stdout

2006-10-01 Thread Denis Vlasenko
On Sunday 01 October 2006 15:34, Owen Lucas wrote: Im doing a program that reads in stuff from the serial port under linux. Once read in there is a bit of formatting and it then needs to get piped to something else. At the end is the cut down code. anyway the interesting part is in the

gcc-4.2-20060805: make bootstrap fails

2006-08-10 Thread Denis Vlasenko
Hello people, I tried to build and install gcc-4.2-20060805 snapshot. First, I needed to add some initializers. gcc seem to use -Werror at some stage and might be used uninitialized warnings were terminating the build. The patch is attached. Then make bootstrap failed in a different way: The

Re: if() and trailing ;

2006-08-02 Thread Denis Vlasenko
On Tuesday 01 August 2006 16:54, Gabriel Dos Reis wrote: Denis Vlasenko [EMAIL PROTECTED] writes: | if() | (void)0; /* do nothing */ | | will make you happy. No, I'm not. I find it Very Silly. Do you prefer buggy code like this? | After a couple hours debugging code, I figured

Re: [PATCH] improved algorithm for gcc/expmed.c::choose_multiplier()

2006-08-02 Thread Denis Vlasenko
On Wednesday 02 August 2006 08:30, Daniel Berlin wrote: Denis Vlasenko wrote: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28417 Right now Bugzilla internal problem prevents me from creating an attachement there. So it goes here. What problems? Please let me know. The only issue i

Re: [PATCH] improved algorithm for gcc/expmed.c::choose_multiplier()

2006-08-02 Thread Denis Vlasenko
On Tuesday 01 August 2006 00:34, Jim Wilson wrote: Denis Vlasenko wrote: I still cannot figure out what precision is, so I restricted new code to (n == HOST_BITS_PER_WIDE_INT precision == HOST_BITS_PER_WIDE_INT) case. Need help here. At the moment, there is probably no one who

Re: if() and trailing ;

2006-08-01 Thread Denis Vlasenko
On 7/30/06, Joe Buck [EMAIL PROTECTED] wrote: On Sat, Jul 29, 2006 at 07:33:03PM -0400, Simon Boulet wrote: After a couple hours debugging code, I figured our an if() somewhere had a trailing ; like this: if (memcmp(p, COMMUNITY, strlen(COMMUNITY)) != 0);

[PATCH] improved algorithm for gcc/expmed.c::choose_multiplier()

2006-07-30 Thread Denis Vlasenko
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28417 Right now Bugzilla internal problem prevents me from creating an attachement there. So it goes here. Not nice enough to go into release. I still cannot figure out what precision is, so I restricted new code to (n == HOST_BITS_PER_WIDE_INT

Re: sorry, unimplemented: 64-bit mode not compiled in - ?!

2006-07-28 Thread Denis Vlasenko
On Thursday 27 July 2006 15:44, Daniel Jacobowitz wrote: On Thu, Jul 27, 2006 at 12:56:14PM +0200, Denis Vlasenko wrote: does it mean I need a cross-compiler (to x86_64) to use -m64? It's strange because then -m64 is not useful at all - x86_64 cross compiler defaults to 64 bit anyway

sorry, unimplemented: 64-bit mode not compiled in - ?!

2006-07-27 Thread Denis Vlasenko
I imagine a lot of you gcc people will laugh at me now, but I finally bought amd64 machine and want to compile 64-bit Linux kernel. I am not able to do it. Tracked it down to a simple thing. My gcc cannot compile any .c file with -m64 flag: # gcc -m64 -c t.c t.c:1: sorry, unimplemented: 64-bit

building cross-compiler to x86_64. pthread.h: No such file

2006-07-27 Thread Denis Vlasenko
Hi, I am building gcc-4.1.1 like this: $SRC/configure \ --enable-languages=c,c++ \ --disable-nls \ --build=i386-pc-linux-gnu \ --host=i386-pc-linux-gnu\ --target=x86_64-pc-linux-gnu

Little help in understanding expmed.c::choose_multiplier()

2006-07-25 Thread Denis Vlasenko
I noticed that gcc's div-by-constant optimization is a bit suboptimal and want to improve it. I submitted it to bugzilla: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28417 but I think big guys have no time for such a low-impact thing. I want to do it myself. However, I need a little helt in

Re: Whirlpool oopses in 2.6.11 and 2.6.12-rc2

2005-04-21 Thread Denis Vlasenko
On Thursday 21 April 2005 06:16, James E Wilson wrote: Denis Vlasenko wrote: Yes. wp512_process_buffer() was using 3k of stack if compiled with -O2. The wp512.c I appended (sans table at top) is instrumented to show it. Use make crypto/wp512.s. See http://gcc.gnu.org/bugs.html

Re: Whirlpool oopses in 2.6.11 and 2.6.12-rc2

2005-04-20 Thread Denis Vlasenko
On Tuesday 19 April 2005 20:40, Chris Wright wrote: * Denis Vlasenko ([EMAIL PROTECTED]) wrote: On Tuesday 19 April 2005 08:42, Denis Vlasenko wrote: modprobe tcrypt hangs the box on both kernels. The last printks are: wp256 test runs ok testing wp384 NNnUnable to handle

Re: [BUG mm] fixed i386 memcpy inlining buggy

2005-04-06 Thread Denis Vlasenko
On Tuesday 05 April 2005 19:34, Christophe Saout wrote: Hi Denis, the new i386 memcpy macro is a ticking timebomb. I've been debugging a new mISDN crash, just to find out that a memcpy was not inlined correctly. Andrew, you should drop the fix-i386-memcpy.patch (or have it fixed).

Re: [BUG mm] fixed i386 memcpy inlining buggy

2005-04-06 Thread Denis Vlasenko
On Tuesday 05 April 2005 19:34, Christophe Saout wrote: the new i386 memcpy macro is a ticking timebomb. I've been debugging a new mISDN crash, just to find out that a memcpy was not inlined correctly. Andrew, you should drop the fix-i386-memcpy.patch (or have it fixed). Updated patch

Re: memcpy(a,b,CONST) is not inlined by gcc 3.4.1 in Linux kernel

2005-04-02 Thread Denis Vlasenko
childregs = ((struct pt_regs *) (THREAD_SIZE + (unsigned long) p-thread_info)) - 1; *childregs = *regs; ^^^ childregs-eax = 0; childregs-esp = esp; # make arch/i386/kernel/process.s copy_thread: pushl %ebp

Re: memcpy(a,b,CONST) is not inlined by gcc 3.4.1 in Linux kernel

2005-04-02 Thread Denis Vlasenko
On Saturday 02 April 2005 15:18, Denis Vlasenko wrote: -O2 compile does inline copying, however, suboptimally. Pushing/popping esi/edi on the stack is not needed. Also mov $1,ecx; rep; movsl is rather silly. I think I am wrong about push/pop. Sorry. However, other observation is still valid

[PATCH] fix i386 memcpy

2005-03-29 Thread Denis Vlasenko
This patch shortens non-constant memcpy() by two bytes and fixes spurious out-of-line constant memcpy(). Patch is run-tested (I run on patched kernel right now). Benchmark and code generation test program will be mailed as reply. # size vmlinux.org vmlinux textdata bss dec

Re: [PATCH] fix i386 memcpy

2005-03-29 Thread Denis Vlasenko
On Tuesday 29 March 2005 23:22, Denis Vlasenko wrote: This patch shortens non-constant memcpy() by two bytes and fixes spurious out-of-line constant memcpy(). Patch is run-tested (I run on patched kernel right now). Benchmark and code generation test program will be mailed as reply

Re: memcpy(a,b,CONST) is not inlined by gcc 3.4.1 in Linux kernel

2005-03-29 Thread Denis Vlasenko
On Wednesday 30 March 2005 05:27, Gerold Jury wrote: On Tue, Mar 29, 2005 at 05:37:06PM +0300, Denis Vlasenko wrote: /* * This looks horribly ugly, but the compiler can optimize it totally, * as the count is constant. */ static inline void * __constant_memcpy(void * to, const