https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105919

            Bug ID: 105919
           Summary: Internal compiler error when using -fanalyzer on
                    php-src
           Product: gcc
           Version: 11.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: girgias at php dot net
  Target Milestone: ---

Created attachment 53116
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53116&action=edit
Preprocessed source stored

I tried to compile php-src with CFLAGS="-fanalyzer" and I got an internal
compiler segfault:

/bin/sh /home/girgias/dev/php-src/libtool --silent --preserve-dup-deps --tag CC
--mode=compile cc -Iext/date/ -I/home/girgias/dev/php-src/ext/date/
-I/home/girgias/dev/php-src/include -I/home/girgias/dev/php-src/main
-I/home/girgias/dev/php-src -I/home/girgias/dev/php-src/ext/date/lib
-I/home/girgias/dev/php-src/TSRM -I/home/girgias/dev/php-src/Zend 
-D_GNU_SOURCE  -fno-common -Wformat-truncation -Wlogical-op -Wduplicated-cond
-Wno-clobbered -Wall -Wextra -Wno-strict-aliasing -Wno-unused-parameter
-Wno-sign-compare -DPROFITABILITY_CHECKS=0 -DZEND_RC_DEBUG=1
-DZEND_VERIFY_FUNC_INFO=1 -fanalyzer -fvisibility=hidden -O0
-Wimplicit-fallthrough=1 -g -DZEND_SIGNALS -fsanitize=address
-DZEND_TRACK_ARENA_ALLOC -fsanitize=undefined -fno-sanitize-recover=undefined
-fno-sanitize=object-size -fno-omit-frame-pointer   -Wno-implicit-fallthrough
-Iext/date/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1 -c
/home/girgias/dev/php-src/ext/date/php_date.c -o ext/date/php_date.lo  -MMD -MF
ext/date/php_date.dep -MT ext/date/php_date.lo
during IPA pass: analyzer
/home/girgias/dev/php-src/ext/opcache/zend_accelerator_blacklist.c:305:67:
internal compiler error: Segmentation fault
  305 |                 blacklist->entries[blacklist->pos].path = (char
*)malloc(path_length + 1);
      |                                                                  
^~~~~~~~~~~~~~~~~~~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/cc6yHzr0.out file, please attach this to
your bugreport.

GCC Version:
gcc (GCC) 11.3.1 20220421 (Red Hat 11.3.1-2)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

OS: Fedora 35
CPU: AMD® Ryzen 7 4700u with radeon graphics × 8

Build instructions:
Clone the PHP engine: https://github.com/php/php-src
./buildconf
./configure -C CFLAGS="-DPROFITABILITY_CHECKS=0 -DZEND_RC_DEBUG=1
-DZEND_VERIFY_FUNC_INFO=1 -fanalyzer" --disable-all --enable-debug
--enable-opcache --enable-zend-test --enable-address-sanitizer
--enable-undefined-sanitizer
make

I would imagine that not all of the configure flags will produce the error but
that's the build I've run

The file in question is:
https://github.com/php/php-src/blob/master/ext/opcache/zend_accelerator_blacklist.c#L305

Please let me know if you need any more details

Reply via email to