Bug 145524 - assignments in assert statements - avoid ?
Summary: assignments in assert statements - avoid ?
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc   
(Show other bugs)
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-01-19 11:46 UTC by David Binderman
Modified: 2007-11-30 22:10 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-01-19 21:36:24 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)

Description David Binderman 2005-01-19 11:46:06 UTC
Description of problem:

I just had a look at the source code for glibc-2.3.4-3

I found the following assignment statements nested into assert statement.

../BUILD/glibc-20041219T2331/iconv/strtab.c:  assert (endp = retval +
st->total
+ 1);
../BUILD/glibc-20041219T2331/stdio-common/tst-ungetc.c:  assert ((c =
getc (fp)) == 'a');
../BUILD/glibc-20041219T2331/hurd/sigunwind.c:      assert
(link->thread.prevp = &ss->active_resources);

I'm not saying this code is wrong - just deeply suspicous. 
The code will do different things, depending on wether the assert
statements are switched in or out.

Suggest code rework to avoid such assignment statements in assert
statements.


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


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Jakub Jelinek 2005-01-19 21:36:24 UTC
Thanks.  strtab.c and sigunwind.c fixed in CVS, tst-ungetc.c doesn't use the
normal assert, but defines its own assert macro, so there is no bug there.


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