[LLVMbugs] [Bug 18558] New: illegal hardware instruction emitted

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jan 20 04:39:43 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=18558

            Bug ID: 18558
           Summary: illegal hardware instruction emitted
           Product: clang
           Version: 3.3
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: devel at fresse.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Following input:

-8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<-
#include <stdlib.h>
#include <string.h>
#include <stdio.h>

int
main(int argc, char *argv[])
{
    char buf[] = "133-g77ef88fe\n";
    char *bp;

    /* read distance */
    (void)strtoul(buf, &bp, 10);

    if (*bp == '-') {
        /* offending code */
        bp = (char*)0U + (bp - (char*)0U);
    }
    if (*bp == '-' || *bp == 'g') {
        bp++;
    }
    puts("OK");
    return 0;
}
-8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<-

Compiled with:
$ clang -std=c99 -O2 -Wall broken-01.c

Results in:
$ ./a.out                                                   
[2]    17909 illegal hardware instruction (core dumped)  ./a.out


Same problem when compiled as C++.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140120/e5669a90/attachment.html>


More information about the llvm-bugs mailing list