[LLVMbugs] [Bug 15306] New: Default int type displayed in diagnostics.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 19 17:25:32 PST 2013


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

            Bug ID: 15306
           Summary: Default int type displayed in diagnostics.
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: bigcheesegs at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

When clang detects an error declaring a type and cannot recover, it sets the
type to int and continues. In this case this is causing bad diagnostics which
print out int.

Reproduce:
clang -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free
-disable-llvm-verifier -main-file-name ELF.cpp -mrelocation-model pic
-pic-level 2 -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -momit-leaf-frame-pointer -v -g -D
_GNU_SOURCE -D _DEBUG -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D
__STDC_LIMIT_MACROS -O2 -Wcovered-switch-default -Wall -W -Wno-unused-parameter
-Wwrite-strings -Wmissing-field-initializers -Wno-long-long -pedantic
-std=c++11 -fconst-strings -fdeprecated-macro -fdebug-compilation-dir
/home/mspencer/llvm-project/build/all/aubsan -ferror-limit 19 -fmessage-length
186 -fvisibility-inlines-hidden
-fsanitize=address,alignment,bool,bounds,enum,float-cast-overflow,float-divide-by-zero,integer-divide-by-zero,null,object-size,return,shift,signed-integer-overflow,unreachable,vla-bound
-mstackrealign -fno-rtti -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -backend-option -vectorize-loops -fsyntax-only -x c++
intescape.ii

Output:
/mnt/host/llvm-project/llvm/tools/llvm-readobj/ELF.cpp:128:26: error: no type
named 'Elf_Dyn_Iterator' in
'llvm::object::ELFObjectFile<llvm::object::ELFType<1, 4, false> >'
  typedef typename ELFO::Elf_Dyn_Iterator EDI;
          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/mnt/host/llvm-project/llvm/tools/llvm-readobj/ELF.cpp:155:12: note: in
instantiation of function template specialization
'llvm::dumpDynamicTable<llvm::object::ELFType<1, 4, false> >'
      requested here
    return dumpDynamicTable(ELFObj, OS);
           ^
/mnt/host/llvm-project/llvm/tools/llvm-readobj/ELF.cpp:129:7: error: no viable
conversion from 'Elf_Dyn_iterator' (aka 'ELFEntityIterator<const Elf_Dyn>') to
'EDI' (aka 'int')
  EDI Start = O->begin_dynamic_table(),
      ^       ~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/host/llvm-project/llvm/tools/llvm-readobj/ELF.cpp:130:7: error: no viable
conversion from 'Elf_Dyn_iterator' (aka 'ELFEntityIterator<const Elf_Dyn>') to
'EDI' (aka 'int')
      End = O->end_dynamic_table();
      ^     ~~~~~~~~~~~~~~~~~~~~~~
/mnt/host/llvm-project/llvm/tools/llvm-readobj/ELF.cpp:128:26: error: no type
named 'Elf_Dyn_Iterator' in
'llvm::object::ELFObjectFile<llvm::object::ELFType<0, 4, false> >'
  typedef typename ELFO::Elf_Dyn_Iterator EDI;
          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/mnt/host/llvm-project/llvm/tools/llvm-readobj/ELF.cpp:160:12: note: in
instantiation of function template specialization
'llvm::dumpDynamicTable<llvm::object::ELFType<0, 4, false> >'
      requested here
    return dumpDynamicTable(ELFObj, OS);

Expected:
/mnt/host/llvm-project/llvm/tools/llvm-readobj/ELF.cpp:128:26: error: no type
named 'Elf_Dyn_Iterator' in
'llvm::object::ELFObjectFile<llvm::object::ELFType<1, 4, false> >'
  typedef typename ELFO::Elf_Dyn_Iterator EDI;
          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/mnt/host/llvm-project/llvm/tools/llvm-readobj/ELF.cpp:155:12: note: in
instantiation of function template specialization
'llvm::dumpDynamicTable<llvm::object::ELFType<1, 4, false> >'
      requested here
    return dumpDynamicTable(ELFObj, OS);
           ^



Also, clang should have been able to recover in this case. The problem was a
typo in:

typedef typename ELFO::Elf_Dyn_Iterator EDI;

It should have been:

typedef typename ELFO::Elf_Dyn_iterator EDI;

-- 
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/20130220/5283a2f1/attachment.html>


More information about the llvm-bugs mailing list