FPE in npcm7xx_adc_convert
This was originally reported at: https://bugs.launchpad.net/qemu/+bug/1913669
Hello,
Reproducer
cat << EOF | ./qemu-system-aarch64 -M npcm750-evb \
-accel qtest -qtest stdio
write 0xf000c000 0x4 0x02400200
clock_step
EOF
Stack-Trace
../hw/adc/npcm7xx_adc.c:60:51: runtime error: division by zero
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../hw/adc/npcm7xx_adc.c:60:51 in
AddressSanitizer:DEADLYSIGNAL
=================================================================
==717962==ERROR: AddressSanitizer: FPE on unknown address 0x55901aa6e67a (pc 0x55901aa6e67a bp 0x7fff0ac087e0 sp 0x7fff0ac087a0 T0)
#0 0x55901aa6e67a in npcm7xx_adc_convert /hw/adc/npcm7xx_adc.c:60:51
#1 0x55901aa6e67a in npcm7xx_adc_convert_done /hw/adc/npcm7xx_adc.c:106:15
#2 0x55901ceb847e in timerlist_run_timers /util/qemu-timer.c:574:9
#3 0x55901c05d804 in qtest_clock_warp /softmmu/qtest.c:356:9
#4 0x55901c059781 in qtest_process_command /softmmu/qtest.c:752:9
#5 0x55901c051b97 in qtest_process_inbuf /softmmu/qtest.c:797:9
#6 0x55901c8a2286 in fd_chr_read /chardev/char-fd.c:68:9
#7 0x7fa5c43f1aae in g_main_context_dispatch (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x51aae)
#8 0x55901cefd363 in glib_pollfds_poll /util/main-loop.c:232:9
#9 0x55901cefd363 in os_host_main_loop_wait /util/main-loop.c:255:5
#10 0x55901cefd363 in main_loop_wait /util/main-loop.c:531:11
#11 0x55901bfb8599 in qemu_main_loop /softmmu/runstate.c:721:9
#12 0x55901a2451fd in main /softmmu/main.c:50:5
#13 0x7fa5c3e96cc9 in __libc_start_main csu/../csu/libc-start.c:308:16
#14 0x55901a198bc9 in _start (/home/alxndr/Development/qemu/build/qemu-system-aarch64+0x3350bc9)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: FPE /hw/adc/npcm7xx_adc.c:60:51 in npcm7xx_adc_convert
Thank you