[llvm-bugs] [Bug 37268] New: scan-build always reports No bugs found

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 27 06:09:37 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=37268

            Bug ID: 37268
           Summary: scan-build always reports No bugs found
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: other
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: dcoughlin at apple.com
          Reporter: benny.kj at gadgeon.com
                CC: llvm-bugs at lists.llvm.org

I'm trying to get scan-build working with IAR C/C++ Compiler but scan-build
always reports No bugs found.

I have performed the below steps.

1. On Windows 10 64 bit, Downloaded and installed
http://releases.llvm.org/6.0.0/LLVM-6.0.0-win64.exe

2. Installed strawberry-perl-5.26.2.1-64bit.msi

3. Ran the below command

scan-build  -v -v -v -o .\test --keep-empty --use-analyzer
c:\LLVM\bin\clang.exe --use-cc "c:\Program Files (x86)\IAR Systems\Embedded
Workbench 8.0\avr\bin\iccavr.exe" -enable-checker alpha.core.PointerArithm
"c:\Program Files (x86)\IAR Systems\Embedded Workbench
8.0\common\bin\IarBuild.exe" "IAR Embedded
Workbench\avr\examples\IAR\STK500\ledchaser.ewp" -build Debug -log all

4. I've also tried without the -enable-checker alpha.core.PointerArithm and the
result is still No bugs found.

5. A directory by the name 2018-04-27-181923-2936-1 or similar name is getting
created every time but has no contents.

Kindly suggest how to debug further.



Please find the detailed log below:
=========================
Log
=========================

C:\Users\benny\Documents>scan-build  -v -v -v -o .\test --keep-empty
--use-analyzer c:\LLVM\bin\clang.exe --use-cc "c:\Program Files (x86)\IAR
Systems\Embedded Workbench 8.0\avr\bin\iccavr.exe" -enable-checker
alpha.core.PointerArithm "c:\Program Files (x86)\IAR Systems\Embedded Workbench
8.0\common\bin\IarBuild.exe" "IAR Embedded
Workbench\avr\examples\IAR\STK500\ledchaser.ewp" -build Debug -log all

C:\Users\benny\Documents>perl -S scan-build -V -v -v -v -o .\test --keep-empty
--use-analyzer c:\LLVM\bin\clang.exe --use-cc "c:\Program Files (x86)\IAR
Systems\Embedded Workbench 8.0\avr\bin\iccavr.exe" -enable-checker
alpha.core.PointerArithm "c:\Program Files (x86)\IAR Systems\Embedded Workbench
8.0\common\bin\IarBuild.exe" "IAR Embedded
Workbench\avr\examples\IAR\STK500\ledchaser.ewp" -build Debug -log all
scan-build: Using 'c:\LLVM\bin\clang.exe' for static analysis
scan-build: Emitting reports for this run to
'C:/Users/benny/Documents/test/2018-04-27-182051-7560-1'.

     IAR Command Line Build Utility V8.0.7.4869
     Copyright 2002-2017 IAR Systems AB.

Building configuration: ledchaser - Debug
Updating build tree...
C:\Users\benny\Documents\IAR Embedded
Workbench\avr\examples\IAR\STK500\Debug\Obj\ledchaser.r90
C:\Users\benny\Documents\IAR Embedded
Workbench\avr\examples\IAR\STK500\Debug\Exe\ledchaser.d90

2  file(s) deleted.
Updating build tree...

ledchaser.c
iccavr.exe C:\Users\benny\Documents\IAR Embedded
Workbench\avr\examples\IAR\STK500\ledchaser.c --cpu=m48 -ms -o
C:\Users\benny\Documents\IAR Embedded
Workbench\avr\examples\IAR\STK500\Debug\Obj --initializers_in_flash --no_cse
--no_inline --no_code_motion --no_cross_call --no_clustering --no_tbaa --debug
-e --eeprom_size 256 --dlib --dlib_config c:/Program Files (x86)\IAR
Systems\Embedded Workbench 8.0\avr\LIB\DLIB\dlAVR-1s-ec_mul-n.h -Ol

   IAR C/C++ Compiler V7.10.1.1197 for Atmel AVR
   Copyright 1996-2017 IAR Systems AB.
   Evaluation license - IAR Embedded Workbench for Atmel AVR, Evaluation
Version 7.10
C:\Users\benny\Documents\IAR Embedded
Workbench\avr\examples\IAR\STK500\ledchaser.c(52) : Warning[Pe550]: variable
"p" was set but never used

 52 bytes of CODE memory
  0 bytes of DATA memory (+ 2 bytes shared)

Errors: none
Warnings: 1

Linking
xlink.exe C:\Users\benny\Documents\IAR Embedded
Workbench\avr\examples\IAR\STK500\Debug\Obj\ledchaser.r90 -o
C:\Users\benny\Documents\IAR Embedded
Workbench\avr\examples\IAR\STK500\Debug\Exe\ledchaser.d90 -Ic:/Program Files
(x86)\IAR Systems\Embedded Workbench 8.0\avr\LIB\ -f c:/Program Files (x86)\IAR
Systems\Embedded Workbench 8.0\avr\src\template\cfgm48.xcl -D_..X_HEAP_SIZE=0
-D_..X_TINY_HEAP_SIZE=0 -D_..X_NEAR_HEAP_SIZE=20 -D_..X_FAR_HEAP_SIZE=0
-D_..X_HUGE_HEAP_SIZE=0 -D_..X_CSTACK_SIZE=20 -D_..X_RSTACK_SIZE=20
-D_..X_FLASH_CODE_END=_..X_FLASH_END -f c:/Program Files (x86)\IAR
Systems\Embedded Workbench 8.0\avr\src\template\cfg1soim.xcl
-D_..X_FLASH_BASE=_..X_INTVEC_SIZE -H1895 -h(CODE)0-(_..X_INTVEC_SIZE-1)
-D_..X_CSTACK_BASE=_..X_SRAM_BASE -D_..X_CSTACK_END=_..X_SRAM_END
-D_..X_RSTACK_BASE=_..X_SRAM_BASE -D_..X_RSTACK_END=_..X_SRAM_END -rt -s
__program_start c:/Program Files (x86)\IAR Systems\Embedded Workbench
8.0\avr\LIB\DLIB\dlAVR-1s-ec_mul-n.r90 -e_PrintfSmall=_Printf
-e_ScanfFull=_Scanf

     IAR Universal Linker V6.5.0.91
     Copyright 1987-2016 IAR Systems AB.

 108 bytes of CODE memory (+            50 range fill )
  64 bytes of DATA memory (+ 2 absolute )

Errors: none
Warnings: none


Total number of errors: 0
Total number of warnings: 1

scan-build: No bugs found.


=======================================================
Source File
=======================================================
void test1();
void test2();
int main( void ) 
{

    test1();
    test2();
    while(1)        /* Eternal loop */
    {
    }

}
void test1() {
  int x;
  int *p;
  p = &x + 1; // warn
}

void test2() {
  void (*foo)(void);
  foo = 0;
  foo(); // warn: function pointer is null
}

-- 
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/20180427/dab16bcc/attachment-0001.html>


More information about the llvm-bugs mailing list