[LLVMbugs] [Bug 9128] New: Assigning a pointer to _Bool should give a warning

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Feb 2 14:42:28 PST 2011


           Summary: Assigning a pointer to _Bool should give a warning
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: tss at iki.fi
                CC: llvmbugs at cs.uiuc.edu

I'd expect this to give two warnings, but none is given:

_Bool foo(void) {
  _Bool x = (void *)0;
  return (void *)0;

Not having this warning already caused a bug in my program, so this makes _Bool
type even worse to me than using "int" as the boolean type.

I guess this might be because C99 says:

"When any scalar value is converted to _Bool, the result is 0 if the value
compares equal to 0; otherwise, the result is 1."

If -Wall isn't good enough place for this, maybe a new -Wstrict-bool? (Actually
I'd prefer such warning to check for other things about booleans too, but
that's another thing.)

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list