[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#372913: gcc-4.1: datatype limits / signedness differs with optimization levels



On Mon, Jun 12, 2006 at 03:01:39PM +0200, Erik Meusel wrote:
> Use this little example to see what's happening:
> 
> #include <stdio.h>
> 
> int main(void) {
>         char c = '\0';
> 
>         do {
>                 printf("%d\n", c);

%d is for int, not char: UB.

>                 c++;

char is neither signed nor unsigned. Only unsigned have defined overflow
behaviour.

>         } while (c != '\0');
> 
>         return 0;
> }

Bastian

-- 
Power is danger.
		-- The Centurion, "Balance of Terror", stardate 1709.2

Attachment: signature.asc
Description: Digital signature


Reply to: