Bug 59939 - gcc-2.96 incorrectly compiles some 'inline' functions
gcc-2.96 incorrectly compiles some 'inline' functions
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2002-02-15 05:16 EST by Nicolas Aspert
Modified: 2007-04-18 12:40 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-12-15 14:24:12 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
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 15:48 EST, Nicolas Aspert
no flags Details

  None (edit)
Description Nicolas Aspert 2002-02-15 05:16:24 EST
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

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 02:04:01 EST
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
I will still try to make a simple test program where the problem is triggered...
Comment 2 Jakub Jelinek 2002-02-19 11:38:54 EST
Without testcase I cannot do anything about it.
Comment 3 Nicolas Aspert 2002-02-19 15:48:49 EST
Created attachment 46083 [details]
testcase for bug
Comment 4 Nicolas Aspert 2002-05-22 10:49:49 EDT
The problem persists on RedHat-7.3 ...
Comment 5 Alan Cox 2002-12-15 14:24:12 EST
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.