Bug 136907 - pine-4.63-9: undefined C code
Summary: pine-4.63-9: undefined C code
Status: RESOLVED FIXED
Alias: None
Product: SUSE LINUX 10.0
Classification: openSUSE
Component: Basesystem (show other bugs)
Version: Final
Hardware: All SuSE Linux 10.0
: P5 - None : Minor
Target Milestone: ---
Assignee: Bernhard Kaindl
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-05 14:26 UTC by David Binderman
Modified: 2007-01-31 18:01 UTC (History)
0 users

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2005-12-05 14:26:45 UTC
I just tried to compile package pine-4.63-9 with a prerelease of the
GNU C compiler version 4.1. It said

help.c:1882: warning: operation on `i' may be undefined

The source code is

    sprintf(tmp_20k_buf, "%s (ID %c%c%d%c%c)", key,
            ((i = (int)(random() % 36L)) < 10) ? '0' + i : 'A' + (i - 10),
            ((i = (int)(random() % 36L)) < 10) ? '0' + i : 'A' + (i - 10),
            (int)(random() % 10L),
            ((i = (int)(random() % 36L)) < 10) ? '0' + i : 'A' + (i - 10),
            ((i = (int)(random() % 36L)) < 10) ? '0' + i : 'A' + (i - 10));

I agree with the compiler - this code seems to be undefined.

Suggest code rework.
Comment 1 Gary Ekker 2005-12-07 20:06:54 UTC
We are using 4.1 in our build system, as well as a newer version of pine-4.64. This warning still exists. 

We don't rework code just for the fun of it, this type of bug should really be reported upstream. If you do have a reasonable patch, I'd be happy to take it.
Comment 2 David Binderman 2005-12-07 22:27:53 UTC
>This warning still exists. 

Oh dear.

>this type of bug should really be reported upstream.

The fact that Novell got it does mean that I couldn't figure out
who to send it to upstream.

>If you do have a reasonable patch, I'd be happy to take it.

I would have thought that a reasonable patch would have been
trivial: Merely declare four new local variables, compute the
four intermediate sums into the new four local variables,
and then use the four new local variables in the call to
sprintf.
 
Comment 3 Gary Ekker 2006-02-27 20:36:40 UTC
Bernard, do you want to ad this fix the next time you touch pine?
Comment 4 Bernhard Kaindl 2007-01-31 18:01:53 UTC
It's fixed in our pine for 10.3.

I guess that at some point (bug 228344 is finally fixed),
I'll be doing a package for alpine (the next version of pine)
and check if it's still there and report upstream as it's
one of the patches which is on the pocket there.