Compliling Xen 4.5.0 Fails with error: ‘bufioreq_pfn’ may be used uninitialised in this function [-Werror=uninitialized]
Hi,
This was originally posted to the user list but it was suggested to me to post it here also. I am getting a failed compilation when I try to compile Xen 4.5.0 from the tarball and also from Git. I can compile RC4, although a bisect reveals that they pertinent difference is debug=y in Config.mk, which allows it to compile. That compiles without a problem and that is what I am running with. I have tried to build on two different servers with the same result, however both are running Ubuntu 12.04.5 and are similarly configured.
Steps I (would) use to build are simply...
./configure
make dist
make install
which results in...
...
gcc -O2 -fomit-frame-pointer -m64 -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -DNDEBUG -I/root/xen450/xen-4.5.0/xen/include -I/root/xen450/xen-4.5.0/xen/include/asm-x86/mach-generic -I/root/xen450/xen-4.5.0/xen/include/asm-x86/mach-default -msoft-float -fno-stack-protector -fno-exceptions -Wnested-externs -DHAVE_GAS_VMX -DHAVE_GAS_EPT -DHAVE_GAS_FSGSBASE -mno-red-zone -mno-sse -fpic -fno-asynchronous-unwind-tables -DGCC_HAS_VISIBILITY_ATTRIBUTE -fno-builtin -fno-common -Werror -Wredundant-decls -Wno-pointer-arith -pipe -g -D__XEN__ -include /root/xen450/xen-4.5.0/xen/include/xen/config.h -nostdinc -DHAS_ACPI -DHAS_GDBSX -DHAS_PASSTHROUGH -DHAS_MEM_ACCESS -DHAS_MEM_PAGING -DHAS_MEM_SHARING -DHAS_PCI -DHAS_IOPORTS -DHAS_PDX -MMD -MF .hvm.o.d -c hvm.c -o hvm.ohvm.c: In function ‘hvm_create_ioreq_server’:
hvm.c:487:18: error: ‘bufioreq_pfn’ may be used uninitialised in this function [-Werror=uninitialized]
hvm.c:718:30: note: ‘bufioreq_pfn’ was declared here
cc1: all warnings being treated as errors
make[5]: *** [hvm.o] Error 1
Any suggestions are welcome,
Thanks for reading,
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 54 lines
-----Original Message-----
From: [email protected] [mailto:xen-devel- [email protected]] On Behalf Of Ian Murray
Sent: 15 March 2015 22:59
To: [email protected]
Subject: [Xen-devel] Compliling Xen 4.5.0 Fails with error: ‘bufioreq_pfn’ may be used uninitialised in this function [-Werror=uninitialized]Hi,
This was originally posted to the user list but it was suggested to me to post it here also. I am getting a failed compilation when I try to compile Xen 4.5.0 from the tarball and also from Git. I can compile RC4, although a bisect reveals that they pertinent difference is debug=y in Config.mk, which allows it to compile. That compiles without a problem and that is what I am running with. I have tried to build on two different servers with the same result, however both are running Ubuntu 12.04.5 and are similarly configured.
Steps I (would) use to build are simply...
./configure
make dist
make installwhich results in...
...
gcc -O2 -fomit-frame-pointer -m64 -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set- variable(quoted diff) +0
-6-DNDEBUG -I/root/xen450/xen-4.5.0/xen/include -I/root/xen450/xen-4.5.0/xen/include/asm-x86/mach-generic -I/root/xen450/xen-4.5.0/xen/include/asm-x86/mach-default -msoft-float -fno-stack-protector -fno-exceptions -Wnested-externs -DHAVE_GAS_VMX -DHAVE_GAS_EPT -DHAVE_GAS_FSGSBASE -mno-red-zone -mno-sse -fpic -fno-asynchronous-unwind-tables -DGCC_HAS_VISIBILITY_ATTRIBUTE -fno-builtin
-fno-common -Werror -Wredundant-decls -Wno-pointer-arith -pipe -g -D__XEN__
-include/root/xen450/xen-4.5.0/xen/include/xen/config.h-nostdinc -DHAS_ACPI
-DHAS_GDBSX -DHAS_PASSTHROUGH -DHAS_MEM_ACCESS -DHAS_MEM_PAGING
-DHAS_MEM_SHARING -DHAS_PCI -DHAS_IOPORTS -DHAS_PDX -MMD -MF .hvm.o.d -chvm.c
-o hvm.ohvm.c: In function ‘hvm_create_ioreq_server’:
hvm.c:487:18: error: ‘bufioreq_pfn’ may be used uninitialised in this function [-Werror=uninitialized]
hvm.c:718:30: note: ‘bufioreq_pfn’ was declared here
cc1: all warnings being treated as errors
make[5]: *** [hvm.o] Error 1
Quoted 2 lines
Any suggestions are welcome,
Those line numbers don't work for me. I did a checkout of RELEASE-4.5.0 and, whilst bufioreq_pfn is indeed declared on line 718, I see no reference to it on line 487. Also, if I compile debug=n I see no problem. Is it possible you don't have a clean checkout of 4.5.0? What version of gcc are you using?
Paul
Quoted 8 lines
Thanks for reading,
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 5 lines · Paul Durrant
Those line numbers don't work for me. I did a checkout of RELEASE-4.5.0 and, whilst
bufioreq_pfnis indeed declared on line 718, I see no reference to it on line 487. Also, if I compile debug=n I see no problem. Is it possible you don't have a clean checkout of 4.5.0? What version of gcc are you using?
Doing
git show RELEASE-4.5.0:xen/arch/x86/hvm/hvm.c > x
gets me a file x where line 487 is the first line (defn of "i") of:
static void hvm_free_ioreq_gmfn(struct domain *d, unsigned long gmfn)
{
unsigned int i = gmfn - d->arch.hvm_domain.ioreq_gmfn.base;
clear_bit(i, &d->arch.hvm_domain.ioreq_gmfn.mask);
}My guess was that it was the call from the fial3 label in hvm_ioreq_server_map_pages(). I can see how gcc wouldn't always be able to reason about it always being initialised.
Ian.
----- Original Message -----
Quoted 69 lines
From: Paul Durrant <[email protected]>
To: Ian Murray <[email protected]>; "[email protected]" <[email protected]>
Cc:
Sent: Monday, 16 March 2015, 9:45
Subject: Re: [Xen-devel] Compliling Xen 4.5.0 Fails with error: ‘bufioreq_pfn’ may be used uninitialised in this function [-Werror=uninitialized]Quoted 6 lines
-----Original Message-----
From: [email protected] [mailto:xen-devel- [email protected]] On Behalf Of Ian Murray
Sent: 15 March 2015 22:59
To: [email protected]
Subject: [Xen-devel] Compliling Xen 4.5.0 Fails with error: ‘bufioreq_pfn’may
Quoted 5 lines
be used uninitialised in this function [-Werror=uninitialized]
Hi,
This was originally posted to the user list but it was suggested to me to
post it
Quoted 1 line
here also. I am getting a failed compilation when I try to compile Xen
4.5.0
Quoted 2 lines
from the tarball and also from Git. I can compile RC4, although a bisect reveals that they pertinent difference is debug=y in Config.mk, which
allows
Quoted 1 line
it to compile. That compiles without a problem and that is what I am
running
Quoted 26 lines
with. I have tried to build on two different servers with the same result, however both are running Ubuntu 12.04.5 and are similarly configured.
Steps I (would) use to build are simply...
./configure
make dist
make installwhich results in...
...
gcc -O2 -fomit-frame-pointer -m64 -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set- variable
-DNDEBUG -I/root/xen450/xen-4.5.0/xen/include -I/root/xen450/xen-4.5.0/xen/include/asm-x86/mach-generic -I/root/xen450/xen-4.5.0/xen/include/asm-x86/mach-default -msoft-float -fno-stack-protector -fno-exceptions -Wnested-externs -DHAVE_GAS_VMX -DHAVE_GAS_EPT -DHAVE_GAS_FSGSBASE -mno-red-zone -mno-sse -fpic -fno-asynchronous-unwind-tables -DGCC_HAS_VISIBILITY_ATTRIBUTE -fno- builtin
-fno-common -Werror -Wredundant-decls -Wno-pointer-arith -pipe -g -D__XEN__
-include/root/xen450/xen-4.5.0/xen/include/xen/config.h-nostdinc -Quoted 8 lines
DHAS_ACPI
-DHAS_GDBSX -DHAS_PASSTHROUGH -DHAS_MEM_ACCESS -DHAS_MEM_PAGING
-DHAS_MEM_SHARING -DHAS_PCI -DHAS_IOPORTS -DHAS_PDX -MMD -MF .hvm.o.d -chvm.c
-o hvm.o
hvm.c: In function ‘hvm_create_ioreq_server’:
hvm.c:487:18: error: ‘bufioreq_pfn’ may be used uninitialised in thisfunction
Quoted 7 lines
[-Werror=uninitialized]
hvm.c:718:30: note: ‘bufioreq_pfn’ was declared here
cc1: all warnings being treated as errors make[5]: *** [hvm.o] Error 1Any suggestions are welcome,
Quoted 7 lines
Those line numbers don't work for me. I did a checkout of RELEASE-4.5.0 and, whilst
bufioreq_pfnis indeed declared on line 718, I see no reference to it on line 487. Also, if I compile debug=n I see no problem. Is it possible you don't have a clean checkout of 4.5.0? What version of gcc are you using?Paul
Thanks for replying.
# gcc --version gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
This is both from a brand new clone of Git and also the release tarball. Ian C has commented elsewhere about what the compiler might be up to, although it's beyond my knowledge in terms of how "clever" the compiler is being. FWIW, I couldn't really understand the line numbering, so I looked at the files themselves and couldn't see a direct, either.... and surely the variable in question is well out of scope at that point. (obviously I am being naive about something here.)
Quoted 5 lines
Quoted 5 lines
Thanks for reading,
Ian.
Quoted 9 lines
Quoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 16 lines · Ian Murray
----- Original Message -----
Quoted 15 lines
From: Paul Durrant <[email protected]>
To: Ian Murray <[email protected]>; "[email protected]" <[email protected]>
Cc:
Sent: Monday, 16 March 2015, 9:45
Subject: Re: [Xen-devel] Compliling Xen 4.5.0 Fails with error: ‘bufioreq_pfn’ may be used uninitialised in this function [-Werror=uninitialized]Quoted 6 lines
-----Original Message-----
From: [email protected] [mailto:xen-devel- [email protected]] On Behalf Of Ian Murray
Sent: 15 March 2015 22:59
To: [email protected]
Subject: [Xen-devel] Compliling Xen 4.5.0 Fails with error: ‘bufioreq_pfn’may
Quoted 2 lines
be used uninitialised in this function [-Werror=uninitialized]
...
Quoted 17 lines
Quoted 11 lines
Quoted 3 lines
Any suggestions are welcome,
Those line numbers don't work for me. I did a checkout of RELEASE-4.5.0 and, whilst
bufioreq_pfnis indeed declared on line 718, I see no reference to it on line 487. Also, if I compile debug=n I see no problem. Is it possible you don't have a clean checkout of 4.5.0? What version of gcc are you using?Paul
Thanks for replying.
# gcc --version gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Quoted 11 lines
This is both from a brand new clone of Git and also the release tarball. Ian C has commented elsewhere about what the compiler might be up to, although it's beyond my knowledge in terms of how "clever" the compiler is being. FWIW, I couldn't really understand the line numbering, so I looked at the files themselves and couldn't see a direct, either.... and surely the variable in question is well out of scope at that point. (obviously I am being naive about something here.)
The gcc I am using: gcc (GCC) 4.7.2 20120921 (Red Hat 4.7.2-2) reported the same error (with adjusted line numbers) for code that I am working on. The reference is really:
fail3:
if ( !is_default && handle_bufioreq )
hvm_free_ioreq_gmfn(d, bufioreq_pfn);So I had assumed that I had uncovered a gcc bug, since the only path here to "hvm_free_ioreq_gmfn(d, bufioreq_pfn)" requires "handle_bufioreq" to be true and not the goto for fail2. It looks to me like bufioreq_pfn is always set if you get to fail3's call on "hvm_free_ioreq_gmfn". This report looks to same to me. I am not able to see your issue, but I am planning on including:
xen/arch/x86/hvm/hvm.c +0 -0
@@ -715,7 +715,7 @@ static int hvm_ioreq_server_map_pages(struct
hvm_ioreq_server *s,
bool_t is_default, bool_thandle_bufioreq)
{
struct domain *d = s->domain;- unsigned long ioreq_pfn, bufioreq_pfn;
+ unsigned long ioreq_pfn, bufioreq_pfn = 0;
int rc;
if ( is_default )
Which "fixed" it for me. It would be good for you to try this.
-Don Slutz
Quoted 18 lines
Quoted 8 lines
Quoted 8 lines
Thanks for reading,
Ian.
Quoted 9 lines
Quoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 5 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 76 lines · Donald Christopher
Quoted 16 lines · Ian Murray
----- Original Message -----
Quoted 15 lines
From: Paul Durrant <[email protected]>
To: Ian Murray <[email protected]>; "[email protected]" <[email protected]>
Cc:
Sent: Monday, 16 March 2015, 9:45
Subject: Re: [Xen-devel] Compliling Xen 4.5.0 Fails with error: ‘bufioreq_pfn’ may be used uninitialised in this function [-Werror=uninitialized]Quoted 6 lines
-----Original Message-----
From: [email protected] [mailto:xen-devel- [email protected]] On Behalf Of Ian Murray
Sent: 15 March 2015 22:59
To: [email protected]
Subject: [Xen-devel] Compliling Xen 4.5.0 Fails with error: ‘bufioreq_pfn’may
Quoted 2 lines
be used uninitialised in this function [-Werror=uninitialized]
...
Quoted 14 lines
Quoted 9 lines
Quoted 2 lines
Any suggestions are welcome,
Those line numbers don't work for me. I did a checkout of RELEASE-4.5.0 and, whilst
bufioreq_pfnis indeed declared on line 718, I see no reference to it on line 487. Also, if I compile debug=n I see no problem. Is it possible you don't have a clean checkout of 4.5.0? What version of gcc are you using?Paul
Thanks for replying.
# gcc --version gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3Quoted 11 lines
This is both from a brand new clone of Git and also the release tarball. Ian C has commented elsewhere about what the compiler might be up to, although it's beyond my knowledge in terms of how "clever" the compiler is being. FWIW, I couldn't really understand the line numbering, so I looked at the files themselves and couldn't see a direct, either.... and surely the variable in question is well out of scope at that point. (obviously I am being naive about something here.)
The gcc I am using: gcc (GCC) 4.7.2 20120921 (Red Hat 4.7.2-2) reported the same error (with adjusted line numbers) for code that I am working on. The reference is really:
fail3:
if ( !is_default && handle_bufioreq ) hvm_free_ioreq_gmfn(d, bufioreq_pfn);So I had assumed that I had uncovered a gcc bug, since the only path here to "
hvm_free_ioreq_gmfn(d, bufioreq_pfn)" requires "handle_bufioreq" to be true and not the goto for fail2. It looks to me likebufioreq_pfnis always set if you get to fail3's call on "hvm_free_ioreq_gmfn". This report looks to same to me. I am not able to see your issue, but I am planning on including:xen/arch/x86/hvm/hvm.c +1
-1@@ -715,7 +715,7 @@ static int hvm_ioreq_server_map_pages(structhvm_ioreq_server *s, bool_t is_default, bool_t handle_bufioreq) { struct domain *d = s->domain; -unsigned long ioreq_pfn, bufioreq_pfn; +unsigned long ioreq_pfn, bufioreq_pfn =0 ;int rc;
Quoted 6 lines
if (
is_default)Which "fixed" it for me. It would be good for you to try this.
-Don Slutz
Thanks for reply. Elsewhere Ian Campbell got to the same conclusion regarding the real "issue" being around fail3. I tried zeroing the variable earlier tonight... as much to test to see if there were further issues down the line as anything. Xen compiled without error. Thanks again.
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 10 lines
Thanks for reading,
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 4 lines
Quoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 10 lines · Donald Christopher
(quoted diff) +1
-1@@ -715,7 +715,7 @@ static int hvm_ioreq_server_map_pages(struct hvm_ioreq_server *s, bool_t is_default, bool_t handle_bufioreq) { struct domain *d = s->domain; - unsigned long ioreq_pfn, bufioreq_pfn; + unsigned long ioreq_pfn, bufioreq_pfn = 0; int rc;
Quoted 4 lines
if (
is_default)Which "fixed" it for me. It would be good for you to try this.
Are you going to send this as a proper patch? I think usually we would add a brief comment to explain the unnecessary seeming initialiser. e..g in radix-tree.c "/* uninitialised var warning */" or "/* gcc ... */" in various other places.
Quoted 14 lines · Ian Campbell
Quoted 13 lines · Donald Christopher
(quoted diff) +1
-1@@ -715,7 +715,7 @@ static int hvm_ioreq_server_map_pages(struct hvm_ioreq_server *s, bool_t is_default, bool_t handle_bufioreq) { struct domain *d = s->domain; - unsigned long ioreq_pfn, bufioreq_pfn; + unsigned long ioreq_pfn, bufioreq_pfn = 0; int rc;if (
is_default)
Quoted 8 lines
Quoted 1 line
Which "fixed" it for me. It would be good for you to try this.
Are you going to send this as a proper patch? I think usually we would add a brief comment to explain the unnecessary seeming initialiser. e..g in
radix-tree.c"/* uninitialised var warning */" or "/* gcc ... */" in various other places.
I do not yet have this as a separate patch. Will do so.
-Don Slutz