Bug 188773
Summary: | inline optimization appears broken | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Steven Dake <sdake> | ||||||
Component: | gcc4 | Assignee: | 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-04-13 09:48:34 UTC | Type: | --- | ||||||
Regression: | --- | Mount Type: | --- | ||||||
Documentation: | --- | CRM: | |||||||
Verified Versions: | Category: | --- | |||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||
Embargoed: | |||||||||
Attachments: |
|
Description
Steven Dake
2006-04-13 01:13:36 UTC
Created attachment 127684 [details]
trunk tarball of openais source code
Created attachment 127685 [details]
patch to workaround the problem in the optimizer
patch that works around the problem also putting printfs in the lcr_comp_find
functions seems to fix it
The source is buggy, violates strict aliasing (and additionally by additional cast clearly just makes a GCC warning go away rather than fixing a bug in it). See info gcc, search for -fstrict-aliasing or better yet the ISO C99 standard. After fixing it the program no longer segfaults: --- lcr/lcr_ifact.c.jj 2006-03-24 09:28:12.000000000 +0100 +++ lcr/lcr_ifact.c 2006-04-13 11:51:00.000000000 +0200 @@ -88,7 +88,10 @@ static inline struct lcr_component_insta unsigned int version, int *iface_number) { - struct lcr_component_instance *instance; + union { + struct lcr_component_instance *instance; + void *ptr; + } u; unsigned int component_handle = 0; int i; @@ -97,14 +100,14 @@ static inline struct lcr_component_insta */ hdb_iterator_reset (&lcr_component_instance_database); while (hdb_iterator_next (&lcr_component_instance_database, - (void **)(void *)&instance, &component_handle) == 0) { + &u.ptr, &component_handle) == 0) { - for (i = 0; i < instance->iface_count; i++) { - if ((strcmp (instance->ifaces[i].name, iface_name) == 0) && - instance->ifaces[i].version == version) { + for (i = 0; i < u.instance->iface_count; i++) { + if ((strcmp (u.instance->ifaces[i].name, iface_name) == 0) && + u.instance->ifaces[i].version == version) { *iface_number = i; - return (instance); + return (u.instance); } } hdb_handle_put (&lcr_component_instance_database, component_handle); @@ -116,7 +119,10 @@ static inline struct lcr_component_insta static inline int lcr_lib_loaded ( char *library_name) { - struct lcr_component_instance *instance; + union { + struct lcr_component_instance *instance; + void *ptr; + } u; unsigned int component_handle = 0; /* @@ -124,9 +130,9 @@ static inline int lcr_lib_loaded ( */ hdb_iterator_reset (&lcr_component_instance_database); while (hdb_iterator_next (&lcr_component_instance_database, - (void **)(void *)&instance, &component_handle) == 0) { + &u.ptr, &component_handle) == 0) { - if (strcmp (instance->library_name, library_name) == 0) { + if (strcmp (u.instance->library_name, library_name) == 0) { return (1); } Thanks Jakub for the info about strict aliasing and the bugfix. Unfortunately I think we use this type of thing alot so there will be many more code changes. Thanks again for the pointer. Regards -steve |