Bug 59939 - gcc-2.96 incorrectly compiles some 'inline' functions
Summary: gcc-2.96 incorrectly compiles some 'inline' functions
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc   
(Show other bugs)
Version: 7.2
Hardware: i686 Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-02-15 10:16 UTC by Nicolas Aspert
Modified: 2007-04-18 16:40 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-12-15 19:24:12 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
testcase for bug (8.54 KB, application/octet-stream)
2002-02-19 20:48 UTC, Nicolas Aspert
no flags Details

Description Nicolas Aspert 2002-02-15 10:16:24 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.7) Gecko/20011226

Description of problem:
I have a program that 'extern __inline__' functions. When running the program,
it segfaults inside the inlined functions. The same code with gcc3 just runs
smoothly...

Version-Release number of selected component (if applicable):


How reproducible:
Couldn't Reproduce

Steps to Reproduce:
I tried to do a simple code that reproduces the problem but couldn't... Anyway
here is how it goes :
I have a function in a .h file : (vertex_t is just 3 float x,y,z)
extern __inline__ void add_prod_v(float m, const vertex_t *v1, const vertex_t
*v2, vertex_t *vout) {
    vout->x = m*v1->x + v2->x;
    vout->y = m*v1->y + v2->y;
    vout->z = m*v1->z + v2->z;
}


and it is called several times from a c file in the following way:

  for (j=0; j<n; j++) {
      add_prod_v(s[j],&(raw_model->vertices[ring.ord_vert[(v1+j)%n]]), &p, &p);

The program is compiled w. the usual options : -g -O2 -march=i686



Actual Results:  segfault when running (not related to bad allocation or
boundary crossing, since the same program compiled w. gcc3 runs fine, and
bounds-cheking gcc3 does not scream). I solved the problem by using two
functions instead of one (add_prod_v does : vout= m*v1+v2, and doing vout=m*v1
and then vout = vout+v2 works fine)

Additional info:

Comment 1 Nicolas Aspert 2002-02-18 07:04:01 UTC
Few updates : 
- as suggested by A. Podtelezhnikov, I tried the latest build of gcc (2.96-103),
which seem to have no influence on the problem (I was using gcc-2.96-85)
- Splitting the function 'add_prod_v' into two functions does not solve the
problem. It is still triggered, under different conditions, and apparently less
easily.
I will still try to make a simple test program where the problem is triggered...

Comment 2 Jakub Jelinek 2002-02-19 16:38:54 UTC
Without testcase I cannot do anything about it.

Comment 3 Nicolas Aspert 2002-02-19 20:48:49 UTC
Created attachment 46083 [details]
testcase for bug

Comment 4 Nicolas Aspert 2002-05-22 14:49:49 UTC
The problem persists on RedHat-7.3 ...

Comment 5 Alan Cox 2002-12-15 19:24:12 UTC
Verified ok with 8.0/gcc 3.2



Note You need to log in before you can comment on or make changes to this bug.