You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by jean-frederic clere <jf...@gmail.com> on 2021/05/04 06:59:57 UTC

htcacheclean.c error when compiling with apr-1.6.x and apr-1.7.x

Hi,

I have the following:
+++
/home/jfclere/APR-1.7.x/build-1/libtool --silent --mode=compile gcc  -g 
-O2 -pthread -std=c89 -Werror -Wall -Wstrict-prototypes 
-Wmissing-prototypes -Wmissing-declarations 
-Wdeclaration-after-statement -Wpointer-arith -Wformat -Wformat-security 
-Wunused     -DLINUX -D_REENTRANT -D_GNU_SOURCE -DAP_DEBUG    -I. 
-I/home/jfclere/httpd-trunk/os/unix -I/home/jfclere/httpd-trunk/include 
-I/home/jfclere/APR-1.7.x/include/apr-1 
-I/home/jfclere/APU-1.6.x/include/apr-1 
-I/home/jfclere/httpd-trunk/modules/aaa 
-I/home/jfclere/httpd-trunk/modules/cache 
-I/home/jfclere/httpd-trunk/modules/core 
-I/home/jfclere/httpd-trunk/modules/database 
-I/home/jfclere/httpd-trunk/modules/filters 
-I/home/jfclere/httpd-trunk/modules/ldap 
-I/home/jfclere/httpd-trunk/modules/loggers 
-I/home/jfclere/httpd-trunk/modules/lua 
-I/home/jfclere/httpd-trunk/modules/proxy 
-I/home/jfclere/httpd-trunk/modules/http2 
-I/home/jfclere/httpd-trunk/modules/session 
-I/home/jfclere/httpd-trunk/modules/ssl 
-I/home/jfclere/httpd-trunk/modules/test 
-I/home/jfclere/httpd-trunk/server 
-I/home/jfclere/httpd-trunk/modules/md 
-I/home/jfclere/httpd-trunk/modules/arch/unix 
-I/home/jfclere/httpd-trunk/modules/dav/main 
-I/home/jfclere/httpd-trunk/modules/generators 
-I/home/jfclere/httpd-trunk/modules/mappers  -prefer-non-pic -static -c 
htcacheclean.c -o htcacheclean.lo
In file included from htcacheclean.c:36:
htcacheclean.c: In function ‘process_dir’:
/home/jfclere/APR-1.7.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.7.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);        \
       |
+++

Before looking more closely to the problem I have a question, trunk 
should be building with apr 1.7.x and apr-util 1.6.x correct?

I used to build with apr 1.6.x and apr-util 1.6.x but something looks 
broken now.

-- 
Cheers

Jean-Frederic

Re: htcacheclean.c error when compiling with apr-1.6.x and apr-1.7.x

Posted by Christophe JAILLET <ch...@wanadoo.fr>.
Le 04/05/2021 à 08:59, jean-frederic clere a écrit :
> Hi,
> 
> I have the following:
> +++
> /home/jfclere/APR-1.7.x/build-1/libtool --silent --mode=compile gcc  -g 
> -O2 -pthread -std=c89 -Werror -Wall -Wstrict-prototypes 
> -Wmissing-prototypes -Wmissing-declarations 
> -Wdeclaration-after-statement -Wpointer-arith -Wformat -Wformat-security 
> -Wunused     -DLINUX -D_REENTRANT -D_GNU_SOURCE -DAP_DEBUG    -I. 
> -I/home/jfclere/httpd-trunk/os/unix -I/home/jfclere/httpd-trunk/include 
> -I/home/jfclere/APR-1.7.x/include/apr-1 
> -I/home/jfclere/APU-1.6.x/include/apr-1 
> -I/home/jfclere/httpd-trunk/modules/aaa 
> -I/home/jfclere/httpd-trunk/modules/cache 
> -I/home/jfclere/httpd-trunk/modules/core 
> -I/home/jfclere/httpd-trunk/modules/database 
> -I/home/jfclere/httpd-trunk/modules/filters 
> -I/home/jfclere/httpd-trunk/modules/ldap 
> -I/home/jfclere/httpd-trunk/modules/loggers 
> -I/home/jfclere/httpd-trunk/modules/lua 
> -I/home/jfclere/httpd-trunk/modules/proxy 
> -I/home/jfclere/httpd-trunk/modules/http2 
> -I/home/jfclere/httpd-trunk/modules/session 
> -I/home/jfclere/httpd-trunk/modules/ssl 
> -I/home/jfclere/httpd-trunk/modules/test 
> -I/home/jfclere/httpd-trunk/server 
> -I/home/jfclere/httpd-trunk/modules/md 
> -I/home/jfclere/httpd-trunk/modules/arch/unix 
> -I/home/jfclere/httpd-trunk/modules/dav/main 
> -I/home/jfclere/httpd-trunk/modules/generators 
> -I/home/jfclere/httpd-trunk/modules/mappers  -prefer-non-pic -static -c 
> htcacheclean.c -o htcacheclean.lo
> In file included from htcacheclean.c:36:
> htcacheclean.c: In function ‘process_dir’:
> /home/jfclere/APR-1.7.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.7.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);        \
>       |
> +++
> 
> Before looking more closely to the problem I have a question, trunk 
> should be building with apr 1.7.x and apr-util 1.6.x correct?
> 

Yes and it is tested on travis:
Latest build: https://travis-ci.com/github/apache/httpd/builds/224657764

(search for 1.7.0 or 1.7.x)

CJ

> I used to build with apr 1.6.x and apr-util 1.6.x but something looks 
> broken now.
> 


Re: htcacheclean.c error when compiling with apr-1.6.x and apr-1.7.x

Posted by Joe Orton <jo...@redhat.com>.
On Fri, May 07, 2021 at 10:12:44AM +0100, Joe Orton wrote:
> It seems to be new with GCC 11, these are warnings which become errors 
> you since are using --enable-maintainer-mode.
> 
> The extensive use of APR_RING* is warning-free in all the APR bucket 
> brigade code even with GCC 11, it is the different way the ring API is 
> used in both htcacheclean and event/simple which which is triggering 
> warnings here.
> 
> In both case we have an APR_RING_ENTRY declared outside of the structure 
> which they are embedded in.  Perhaps this is one of the implications 
> warned about in apr_ring.h:
> 
> https://svn.apache.org/viewvc/apr/apr/trunk/include/apr_ring.h?revision=1074876&view=markup#l65
> 
> It seems trivial to fix the warning by using the link as embedded in the 
> structure (attached), though I haven't tested this.

PR here to test: https://github.com/apache/httpd/pull/186

(I couldn't find an easy way to set up Travis to build with GCC 11 on 
Ubuntu.  Should revive efforts to do testing in containers with 
alternative operating systems ;)

Regards, Joe


Re: htcacheclean.c error when compiling with apr-1.6.x and apr-1.7.x

Posted by jean-frederic clere <jf...@gmail.com>.
On 07/05/2021 11:12, Joe Orton wrote:
> On Tue, May 04, 2021 at 09:12:04AM +0200, jean-frederic clere wrote:
>> On 04/05/2021 08:59, jean-frederic clere wrote:
> ...
>>> In file included from htcacheclean.c:36:
>>> htcacheclean.c: In function ‘process_dir’:
>>> /home/jfclere/APR-1.7.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.7.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);        \
>>>         |
>>> +++
>>>
>>> Before looking more closely to the problem I have a question, trunk
>>> should be building with apr 1.7.x and apr-util 1.6.x correct?
>>>
>>> I used to build with apr 1.6.x and apr-util 1.6.x but something looks
>>> broken now.
>>
>> Or is that a regression in gcc on fedora34? :-(
> 
> It seems to be new with GCC 11, these are warnings which become errors
> you since are using --enable-maintainer-mode.

Correct that is the problem: Fedora34 updated gcc.

I have reported a bz:
https://bugzilla.redhat.com/show_bug.cgi?id=1957353

I will close it with a link to the fix once you commit the fix ;-)


> 
> The extensive use of APR_RING* is warning-free in all the APR bucket
> brigade code even with GCC 11, it is the different way the ring API is
> used in both htcacheclean and event/simple which which is triggering
> warnings here.
> 
> In both case we have an APR_RING_ENTRY declared outside of the structure
> which they are embedded in.  Perhaps this is one of the implications
> warned about in apr_ring.h:
> 
> https://svn.apache.org/viewvc/apr/apr/trunk/include/apr_ring.h?revision=1074876&view=markup#l65
> 
> It seems trivial to fix the warning by using the link as embedded in the
> structure (attached), though I haven't tested this.

Tested. +1 to merge it ;-)

> 
> Regards, Joe
> 
> 


-- 
Cheers

Jean-Frederic

Re: htcacheclean.c error when compiling with apr-1.6.x and apr-1.7.x

Posted by Joe Orton <jo...@redhat.com>.
On Tue, May 04, 2021 at 09:12:04AM +0200, jean-frederic clere wrote:
> On 04/05/2021 08:59, jean-frederic clere wrote:
...
> > In file included from htcacheclean.c:36:
> > htcacheclean.c: In function ‘process_dir’:
> > /home/jfclere/APR-1.7.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.7.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);        \
> >        |
> > +++
> > 
> > Before looking more closely to the problem I have a question, trunk
> > should be building with apr 1.7.x and apr-util 1.6.x correct?
> > 
> > I used to build with apr 1.6.x and apr-util 1.6.x but something looks
> > broken now.
> 
> Or is that a regression in gcc on fedora34? :-(

It seems to be new with GCC 11, these are warnings which become errors 
you since are using --enable-maintainer-mode.

The extensive use of APR_RING* is warning-free in all the APR bucket 
brigade code even with GCC 11, it is the different way the ring API is 
used in both htcacheclean and event/simple which which is triggering 
warnings here.

In both case we have an APR_RING_ENTRY declared outside of the structure 
which they are embedded in.  Perhaps this is one of the implications 
warned about in apr_ring.h:

https://svn.apache.org/viewvc/apr/apr/trunk/include/apr_ring.h?revision=1074876&view=markup#l65

It seems trivial to fix the warning by using the link as embedded in the 
structure (attached), though I haven't tested this.

Regards, Joe



Re: htcacheclean.c error when compiling with apr-1.6.x and apr-1.7.x

Posted by jean-frederic clere <jf...@gmail.com>.
On 04/05/2021 08:59, jean-frederic clere wrote:
> Hi,
> 
> I have the following:
> +++
> /home/jfclere/APR-1.7.x/build-1/libtool --silent --mode=compile gcc  -g 
> -O2 -pthread -std=c89 -Werror -Wall -Wstrict-prototypes 
> -Wmissing-prototypes -Wmissing-declarations 
> -Wdeclaration-after-statement -Wpointer-arith -Wformat -Wformat-security 
> -Wunused     -DLINUX -D_REENTRANT -D_GNU_SOURCE -DAP_DEBUG    -I. 
> -I/home/jfclere/httpd-trunk/os/unix -I/home/jfclere/httpd-trunk/include 
> -I/home/jfclere/APR-1.7.x/include/apr-1 
> -I/home/jfclere/APU-1.6.x/include/apr-1 
> -I/home/jfclere/httpd-trunk/modules/aaa 
> -I/home/jfclere/httpd-trunk/modules/cache 
> -I/home/jfclere/httpd-trunk/modules/core 
> -I/home/jfclere/httpd-trunk/modules/database 
> -I/home/jfclere/httpd-trunk/modules/filters 
> -I/home/jfclere/httpd-trunk/modules/ldap 
> -I/home/jfclere/httpd-trunk/modules/loggers 
> -I/home/jfclere/httpd-trunk/modules/lua 
> -I/home/jfclere/httpd-trunk/modules/proxy 
> -I/home/jfclere/httpd-trunk/modules/http2 
> -I/home/jfclere/httpd-trunk/modules/session 
> -I/home/jfclere/httpd-trunk/modules/ssl 
> -I/home/jfclere/httpd-trunk/modules/test 
> -I/home/jfclere/httpd-trunk/server 
> -I/home/jfclere/httpd-trunk/modules/md 
> -I/home/jfclere/httpd-trunk/modules/arch/unix 
> -I/home/jfclere/httpd-trunk/modules/dav/main 
> -I/home/jfclere/httpd-trunk/modules/generators 
> -I/home/jfclere/httpd-trunk/modules/mappers  -prefer-non-pic -static -c 
> htcacheclean.c -o htcacheclean.lo
> In file included from htcacheclean.c:36:
> htcacheclean.c: In function ‘process_dir’:
> /home/jfclere/APR-1.7.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.7.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);        \
>        |
> +++
> 
> Before looking more closely to the problem I have a question, trunk 
> should be building with apr 1.7.x and apr-util 1.6.x correct?
> 
> I used to build with apr 1.6.x and apr-util 1.6.x but something looks 
> broken now.
> 

Or is that a regression in gcc on fedora34? :-(

-- 
Cheers

Jean-Frederic