Description of problem: When compile httpd configure with --enable-maintainer-mode make fails with conpilation error. Version-Release number of selected component (if applicable): [jfclere@ovpn-113-163 httpd-trunk]$ gcc --version gcc (GCC) 11.1.1 20210428 (Red Hat 11.1.1-1) 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. How reproducible: Always Steps to Reproduce: 1. get httpd sources 2. configure with --enable-maintainer-mode 3. make Actual results: +++ htcacheclean.c: In function ‘process_dir’: /home/jfclere/APR-1.6.x/include/apr-1/apr_ring.h:183:37: error: array subscript ‘struct _direntry[0]’ is partly outside array bounds of ‘struct <anonymous>[1]’ [-Werror=array-bounds] 183 | #define APR_RING_PREV(ep, link) (ep)->link.prev | ^~ /home/jfclere/APR-1.6.x/include/apr-1/apr_ring.h:230:38: note: in expansion of macro ‘APR_RING_PREV’ 230 | APR_RING_PREV((ep1), link) = APR_RING_PREV((lep), link); \ | ^~~~~~~~~~~~~ /home/jfclere/APR-1.6.x/include/apr-1/apr_ring.h:300:9: note: in expansion of macro ‘APR_RING_SPLICE_BEFORE’ 300 | APR_RING_SPLICE_BEFORE(APR_RING_SENTINEL((hp), elem, link), \ | ^~~~~~~~~~~~~~~~~~~~~~ /home/jfclere/APR-1.6.x/include/apr-1/apr_ring.h:323:9: note: in expansion of macro ‘APR_RING_SPLICE_TAIL’ 323 | APR_RING_SPLICE_TAIL((hp), (nep), (nep), elem, link) | ^~~~~~~~~~~~~~~~~~~~ htcacheclean.c:630:9: note: in expansion of macro ‘APR_RING_INSERT_TAIL’ 630 | APR_RING_INSERT_TAIL(&anchor, d, _direntry, link); | ^~~~~~~~~~~~~~~~~~~~ htcacheclean.c:608:31: note: while referencing ‘anchor’ 608 | APR_RING_ENTRY(_direntry) anchor; | ^~~~~~ In file included from htcacheclean.c:36: /home/jfclere/APR-1.6.x/include/apr-1/apr_ring.h:183:37: error: array subscript ‘struct _direntry[0]’ is partly outside array bounds of ‘struct <anonymous>[1]’ [-Werror=array-bounds] 183 | #define APR_RING_PREV(ep, link) (ep)->link.prev ... +++ Expected results: compilation with problems. Additional info: looks like a regression fedora 33 was compiling without problems.
Note using CFLAGS=-std=gnu++14 gives: cc1: warning: command-line option ‘-std=gnu++14’ is valid for C++/ObjC++ but not for C and the error is changed to warning...
The message is a bit cryptic but it says that the code accesses an object (anchor) of some anonymous type as it was struct _direntry. That's invalid because objects can only be accessed by lvalues of compatible types (or char). The APR_RING_ENTRY macro is defined like so: #define APR_RING_ENTRY(elem) \ struct { \ struct elem * volatile next; \ struct elem * volatile prev; \ } so given the definition APR_RING_ENTRY(_direntry) anchor; anchor can only be accessed by lvalues of its (anonymous) type but the APR_RING_SENTINEL() macro defined like so: #define APR_RING_SENTINEL(hp, elem, link) \ (struct elem *)((char *)(&(hp)->next) - APR_OFFSETOF(struct elem, link)) casts the address of anchor's next member minus some constant to a pointer to struct _direntry and that pointer is then used to access the prev pointer. The anonymous struct and struct _direntry are unrelated and cannot be used each other's members even if the corresponding members have the same type and are at the same offset within the bounds of the object. Here's an example that shows the problem. The -Warray-bounds instances should both be -Wstrict-aliasing (see GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98503) but the change to make that happen unfortunately was rejected by the GCC maintainer reviewing the code for reasons no user cares about so the warning GCC does issue is rather obscure. $ cat z.c && gcc -O2 -S -Wall z.c struct A { int i; }; struct B { int i, j; }; struct A a; int f (void) { return ((struct B*)&a)->i; } int g (void) { struct B *p = (struct B*)&a; return p->i; } z.c: In function ‘f’: z.c:8:11: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] 8 | return ((struct B*)&a)->i; | ~^~~~~~~~~~~~~~ z.c:8:25: warning: array subscript ‘struct B[0]’ is partly outside array bounds of ‘struct A[1]’ [-Warray-bounds] 8 | return ((struct B*)&a)->i; | ^~ z.c:4:10: note: while referencing ‘a’ 4 | struct A a; | ^ z.c: In function ‘g’: z.c:8:25: warning: array subscript ‘struct B[0]’ is partly outside array bounds of ‘struct A[1]’ [-Warray-bounds] 8 | return ((struct B*)&a)->i; | ~~~~~~~~~~~~~~~^~~ z.c:4:10: note: while referencing ‘a’ 4 | struct A a; | ^
This message is a reminder that Fedora Linux 34 is nearing its end of life. Fedora will stop maintaining and issuing updates for Fedora Linux 34 on 2022-06-07. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a 'version' of '34'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, change the 'version' to a later Fedora Linux version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora Linux 34 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora Linux, you are encouraged to change the 'version' to a later version prior to this bug being closed.
Fedora Linux 34 entered end-of-life (EOL) status on 2022-06-07. Fedora Linux 34 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. Thank you for reporting this bug and we are sorry it could not be fixed.