Bug 110743 - possibly broken source code
Summary: possibly broken source code
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: epic
Version: 1
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jeremy Katz
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-11-24 12:50 UTC by d.binderman
Modified: 2007-11-30 22:10 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2003-11-25 15:18:33 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description d.binderman 2003-11-24 12:50:04 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)

Description of problem:
I just tried to compile package epic-1_0_1-15 from Fedora.

The compiler said

functions.c(4205): warning #187: use of "=" where "==" may have been 
intended
functions.c(4205): warning #187: use of "=" where "==" may have been 
intended

The source code is

        while (((*word == 'r') && (variable = 1)) || ((*word == 'g') 
&& (global = 1)) || ((*word == 'i') && (func = stristr)))
                word++;

Better source code might be

        while (((*word == 'r') && (variable == 1)) 
		|| ((*word == 'g') && (global == 1)) 
		|| ((*word == 'i') && (func == stristr)))
		{
                word++;
		}


Version-Release number of selected component (if applicable):
epic-1_0_1-15 

How reproducible:
Always

Steps to Reproduce:
1. by inspection of source code
2.
3.
    

Additional info:

Comment 1 Jeremy Katz 2003-11-24 22:33:55 UTC
This is, although baroque and disgusting, exactly what's intended. 
When 'g' is the letter, it wants to set the context as global for any
function getting called.

Comment 2 d.binderman 2003-11-25 12:50:27 UTC
Would it be possible to rewrite code to be more clear,
so that other folks don't fall into the same trap I did ?

Something like

while (((*word == 'r') && ((variable = 1) != 0)) 
    || ((*word == 'g') && ((global = 1) != 0)) 
    || ((*word == 'i') && ((func = stristr) != 0)))
                word++;


Comment 3 Jeremy Katz 2003-11-25 15:18:33 UTC
Please make any such requests upstream.  Not being the upstream
maintainers of the software, making cosmetic changes to the code is
not viable.


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