lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20061103190824.GJ13381@stusta.de>
Date:	Fri, 3 Nov 2006 20:08:24 +0100
From:	Adrian Bunk <bunk@...sta.de>
To:	Oleg Verych <olecom@...wer.upol.cz>
Cc:	Mikulas Patocka <mikulas@...ax.karlin.mff.cuni.cz>,
	Andrew Morton <akpm@...l.org>,
	Gabriel C <nix.or.die@...glemail.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: New filesystem for Linux

On Fri, Nov 03, 2006 at 06:36:09PM +0100, Oleg Verych wrote:
> On Fri, Nov 03, 2006 at 06:09:39PM +0100, Mikulas Patocka wrote:
> > >In gmane.linux.kernel, you wrote:
> > >[]
> > >>From: Andrew Morton <akpm@...l.org>
> > >>
> > >>As Mikulas points out, (1 << anything) won't be evaluating to zero.
> > >
> > >How about integer overflow ?
> > 
> > C standard defines that shifts by more bits than size of a type are 
> > undefined (in fact 1<<32 produces 1 on i386, because processor uses only 5 
> > bits of a count).
> ,--
> |#include <stdio.h>
> |int main(void) {
> |	unsigned int b = 1;
> |
> |	printf("%u\n", (1 << 33));
> |	printf("%u\n", (b << 33));
> |	return 0;
> |}
> |$ gcc bit.c && ./a.out
> `--
> 
> There *is* difference, isn't it?

It's undefined, and the results with your example depend on the gcc 
version and optimization level.

E.g. with gcc 4.1, there is *no* difference any more if you turn on 
optimization.

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ