Package: binutils
Version: 2.19.1-1
Severity: minor

I recently discovered that the GNU Assembler interpreted the constant
'\0' as the ascii value for the digit, 0x30 and not, as in C, 0x0.
Maybe this isn't a bug at all, but rather some language feature. 
The following code will output "30: 0", where the wanted output would 
be "0: ". This is true both for the lenny version 
(2.18.1~cvs20080103-7) and the one in sid (2.19.1-1). 

#include <stdio.h>
        .data
F1:     .string "%x: %c\n"
        .text
        .globl  main

        /* why is '\0' interpreted as '0' (ascii: 0x30)? */
main:   pushl   $'\0'
        pushl   $'\0'
        pushl   $F1 
        call    printf
        pushl   $0  
        call    exit

Replacing $'\0' with $0 solved my problems, but I figured it merited
some explanation at least. TIA

-- 
Olof Johansson 
PGP: 0x7FC0FBBA

Attachment: signature.asc
Description: Digital signature

Reply via email to