[LLVMbugs] [Bug 3330] New: ImplicitCastExpr with NULL pointer to subexpression.
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Thu Jan 15 06:30:26 PST 2009
http://llvm.org/bugs/show_bug.cgi?id=3330
Summary: ImplicitCastExpr with NULL pointer to subexpression.
Product: clang
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: AST
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: bolzoni at cs.unipr.it
CC: llvmbugs at cs.uiuc.edu, bagnara at cs.unipr.it
Test case:
--->
enum E {
A,
B = A + (((-2UL << 20) - (-10UL << 20)) >> 12) - 1,
C
};
---<
to see the bug you need to modify the function
void DeclContextPrinter::PrintDeclContext(const DeclContext*, unsigned)
in the file Driver/ASTConsumer.cpp.
seek for `case Decl::EnumConstant:', add
--->
const Expr* e = ECD-> getInitExpr();
if (e) {
e-> dumpAll();
}
---<
just before the break statement.
Recompile.
The output of clang -print-decl-contexts will be:
--->
(ImplicitCastExpr 0x1e84af0 'int'
(BinaryOperator 0x1e849f0 'unsigned long' '-'
(BinaryOperator 0x1e84930 'unsigned long' '+'
(ImplicitCastExpr 0x1e848f0 'unsigned long'
(DeclRefExpr 0x1e844f0 'int' EnumConstant='A' 0x1e84490))
(ParenExpr 0x1e848b0 'unsigned long'
(BinaryOperator 0x1e84870 'unsigned long' '>>'
(ParenExpr 0x1e847f0 'unsigned long'
(BinaryOperator 0x1e847b0 'unsigned long' '-'
(ParenExpr 0x1e84630 'unsigned long'
(BinaryOperator 0x1e845f0 'unsigned long' '<<'
(UnaryOperator 0x1e84570 'unsigned long' prefix '-'
(IntegerLiteral 0x1e84530 'unsigned long' 2))
(IntegerLiteral 0x1e845b0 'int' 20)))
(ParenExpr 0x1e84770 'unsigned long'
(BinaryOperator 0x1e84730 'unsigned long' '<<'
(UnaryOperator 0x1e846b0 'unsigned long' prefix '-'
(IntegerLiteral 0x1e84670 'unsigned long' 10))
(IntegerLiteral 0x1e846f0 'int' 20)))))
(IntegerLiteral 0x1e84830 'int' 12))))
(ImplicitCastExpr 0x1e849b0 'unsigned long'
(IntegerLiteral 0x1e84970 'int' 1))))
(ImplicitCastExpr 0x1e84b30 'int'
<<<NULL>>>)
[translation unit] 0x1e6dfa0
[struct] __va_list_tag
<field> [omitted]
<typedef> __builtin_va_list
[enum] E
<enum constant> A
<enum constant> B
<enum constant> C
---<
The last ImplicitCastExpr has NULL as sub-expression.
--
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