Bug Summary

File:builtin_scanbuild_examples.c
Warning:line 11, column 13
Dereference of null pointer (loaded from variable 'pointer')

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -triple thumbv7em-none-unknown-eabi -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name builtin_scanbuild_examples.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model static -mthread-model posix -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -nostdsysteminc -target-cpu cortex-m4 -target-feature -crc -target-feature -sha2 -target-feature -aes -target-feature -dotprod -target-feature +dsp -target-feature -mve -target-feature -mve.fp -target-feature -ras -target-feature -sb -target-feature -lob -target-feature -hwdiv-arm -target-feature +hwdiv -target-feature -vfp2 -target-feature +vfp2sp -target-feature -vfp3 -target-feature -vfp3d16 -target-feature +vfp3d16sp -target-feature -vfp3sp -target-feature +fp16 -target-feature -vfp4 -target-feature -vfp4d16 -target-feature +vfp4d16sp -target-feature -vfp4sp -target-feature -fp-armv8 -target-feature -fp-armv8d16 -target-feature -fp-armv8d16sp -target-feature -fp-armv8sp -target-feature -fullfp16 -target-feature -fp64 -target-feature -d32 -target-feature -neon -target-feature -crypto -target-feature -fp16fml -target-feature +strict-align -target-abi aapcs -mfloat-abi hard -fallow-half-arguments-and-returns -dwarf-column-info -fno-split-dwarf-inlining -debugger-tuning=gdb -target-linker-version 556.5 -ffunction-sections -fdata-sections -resource-dir /clang+llvm-10.0.0-x86_64-apple-darwin/lib/clang/10.0.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I /interrupt/example/freertos-example-llvm/freertos_kernel/include -I /interrupt/example/freertos-example-llvm/include -I /interrupt/example/freertos-example-llvm/freertos_kernel/portable/GCC/ARM_CM4F -internal-isystem /clang+llvm-10.0.0-x86_64-apple-darwin/lib/clang/10.0.0/include -internal-isystem /arm_9_2019q4/bin/../arm-none-eabi/include -Oz -fdebug-compilation-dir /interrupt/example/freertos-example-llvm -ferror-limit 19 -fmessage-length 0 -fno-signed-char -fgnuc-version=4.2.1 -fobjc-runtime=gcc -fdiagnostics-show-option -vectorize-slp -analyzer-output=html -faddrsig -o /interrupt/example/freertos-example-llvm/scanbuild_analysis/2020-05-19-190156-30115-1 -x c /interrupt/example/freertos-example-llvm/src/builtin_scanbuild_examples.c
1#include "example_project/examples.h"
2
3#include <stddef.h>
4
5
6int example_operate_on_pointer(uint8_t *pointer) {
7 int result = 0;
8 if (pointer == NULL((void*)0)) {
1
Assuming 'pointer' is equal to NULL
2
Taking true branch
9 result = -1;
10 }
11 result += *pointer;
3
Dereference of null pointer (loaded from variable 'pointer')
12 return result;
13}
14
15int example_divide_by_zero(int denominator) {
16 int rv = 5;
17 if (denominator == 0) {
18 rv = 1 / denominator;
19 }
20 return rv;
21}