This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: inlining failed


On Saturday 06 September 2003 13:45, you wrote:
> Gunther Piez wrote:
> >test.c: In function `main':
> >test.c:1: warning: inlining failed in call to `f'
> >test.c:12: warning: called from here
>
> Any chance to try a snapshot of current mainline (would be 3.4)?
>
> Interestingly, the problem is *not* present there!

It's still there, but you need different code to trigger it.
I've tried it with gcc 3.4 20030903.
Unforunatly I'm not able to simplify the offending code to more than that (and 
I have tried hard):

static inline void f(const int *z) {
    int wmin[10], bmin[10];
    int wcnt[10], bcnt[10];
    int wmax[10], bmax[10];
    int struc = 0;
    int blastpp = 99;

    for (int i = 1; i < 9; i++) {

        if (wcnt[i]) {
            struc += 1;
            if (wmin[i - 1] > wmin[i] && wmin[i + 1] > wmin[i]) 
                struc += 1;
        }

        if (bcnt[i]) {
            struc -= 1;
            if (bmin[i - 1] < bmin[i] && bmin[i + 1] < bmin[i]) {
                struc -= 1;
                if (!wcnt[i])
                    struc -= 1;
            }

            if (wmin[i - 1] >= bmax[i] && wmin[i] > bmax[i]  && wmin[i + 1] >= 
bmax[i]) {

                int bdist;
                for (bdist = 1; z[bdist] != -5; bdist++)
                    ;

                if (blastpp == i - 1)
                    struc -= 1;
                if (z[0] - i <=0 && z[1] <= bdist)
                    struc -= 1;
               blastpp = i;

            } else if (wmin[i] > bmax[i])
                if (((wmin[i-1] < bmax[i]) + (wmin[i+1] < bmax[i])) <
                        ((bmin[i-1] > wmin[i-1]-1) + (bmin[i+1] > 
wmin[i+1]-1)))
                    struc -= 1;
        }
    }
}

int main() {
    int a; 
    f(&a);
}

I didn't replace the variable names with a...h, the remaining code fragment is 
incomprehensible anyway :-)
If you leave out a condition in one of the if clauses, or one loop, the code 
is inlined again.

Gunther


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]