Package: gcc-4.5 Version: 4.5.1-9 Severity: wishlist The attached file (not preprocessed because of the macros) uses two macros F and G. F and G are completely equivalent[0]. As a result, r1 and r2 are guaranteed to be exactly equal always. I would like gcc, at level -O3, to basically optimize the code to "return 0;". At the very least, I would like G to be optimized to use one fewer instruction, like F.
I realize that this may be difficult, and that's why I filed it as wishlist. [0] MD5 specifies G as a component function, but most implementers use F instead because it uses one fewer instruction. -- System Information: Debian Release: squeeze/sid APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 2.6.36-rc6-amd64 (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages gcc-4.5 depends on: ii binutils 2.20.51.20100617-1 The GNU assembler, linker and bina ii cpp-4.5 4.5.1-9 The GNU C preprocessor ii gcc-4.5-base 4.5.1-9 The GNU Compiler Collection (base ii libc6 2.11.2-7 Embedded GNU C Library: Shared lib ii libcloog-ppl0 0.15.9-2 the Chunky Loop Generator (runtime ii libelfg0 0.8.13-1 an ELF object file access library ii libgcc1 1:4.5.1-9 GCC support library ii libgmp3c2 2:4.3.2+dfsg-1 Multiprecision arithmetic library ii libgmpxx4ldbl 2:4.3.2+dfsg-1 Multiprecision arithmetic library ii libgomp1 4.5.1-9 GCC OpenMP (GOMP) support library ii libmpc2 0.8.2-1+b1 multiple precision complex floatin ii libmpfr4 3.0.0-2 multiple precision floating-point ii libppl-c2 0.10.2-9 Parma Polyhedra Library (C interfa ii libppl7 0.10.2-9 Parma Polyhedra Library (runtime l ii zlib1g 1:1.2.3.4.dfsg-3 compression library - runtime Versions of packages gcc-4.5 recommends: ii libc6-dev 2.11.2-7 Embedded GNU C Library: Developmen Versions of packages gcc-4.5 suggests: pn binutils-gold <none> (no description available) pn gcc-4.5-doc <none> (no description available) pn gcc-4.5-locales <none> (no description available) ii gcc-4.5-multilib 4.5.1-9 The GNU C compiler (multilib files pn libgcc1-dbg <none> (no description available) pn libgomp1-dbg <none> (no description available) ii libmudflap0-4.5-dev 4.5.1-9 GCC mudflap support libraries (dev pn libmudflap0-dbg <none> (no description available) -- no debconf information -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
#include <stdio.h> #include <stdlib.h> #include <time.h> #define F(x, y, z) ((z)^((x)&((y)^(z)))) #define G(x, y, z) (((x)&(y))|((~(x))&(z))) int main(void) { unsigned x, y, z, r1, r2; srand(time(NULL)); x = rand(); y = rand(); z = rand(); r1 = F(x, y, z); r2 = G(x, y, z); if (r1 != r2) abort(); return 0; }
signature.asc
Description: Digital signature