Bug 192930

Summary: libcups httpAddrGetList miscompiled at -O2
Product: [Fedora] Fedora Reporter: Tim Waugh <twaugh>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 5   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-05-24 16:12:07 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 192628    
Attachments:
Description Flags
http-addrlist.c none

Description Tim Waugh 2006-05-24 10:19:46 UTC
Description of problem:
The httpAddrGetList() function from libcups (cups-1.2.1/cups/http-addrlist.c) is
miscompiled at -O2.  The symptom is that
httpAddrGetList("localhost",AF_UNSPEC,"631") fails to return an address when
/etc/hosts looks like this:

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               primary
127.0.0.1               localhost.localdomain

There is code in httpAddrGetList() specifically to handle such a misconfigured
/etc/hosts, but it is not getting triggered because an automatic local variable
(addr) is not getting correctly initialized.

Version-Release number of selected component (if applicable):
gcc-4.1.0-3, also
gcc-4.1.0-17

How reproducible:
100%

Steps to Reproduce:

1. Back up /etc/hosts

2.

cat >/etc/hosts <<"EOF"
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               primary
127.0.0.1               localhost.localdomain
EOF 

gcc -g -O2 -o http-addrlist http-addrlist.c
./http-addrlist

Actual results:
failure

Expected results:
success

Additional info:
Original bug report is bug #192628.

Comment 1 Tim Waugh 2006-05-24 10:21:00 UTC
Created attachment 129909 [details]
http-addrlist.c

Comment 2 Tim Waugh 2006-05-24 13:24:07 UTC
Hmm, test case seems to always say 'failure'.  I will try to distill it again.

FWIW, compiling the original with '-O2 -fno-strict-aliasing' makes no difference.

Comment 3 Tim Waugh 2006-05-24 16:12:07 UTC
Oh, never mind, false alarm.  Sorry for the noise.