Closed
Bug 126485
Opened 23 years ago
Closed 13 years ago
Occurences of uninitialized variables being used before being set (in nsprpub)
Categories
(NSPR :: NSPR, defect, P1)
Tracking
(Not tracked)
RESOLVED
WORKSFORME
People
(Reporter: mozilla-bugs, Assigned: wtc)
References
Details
Attachments
(1 file)
(deleted),
patch
|
Details | Diff | Splinter Review |
This bug is just for the warnings in various source files in nsprpub directory.
Currently
(http://tinderbox.mozilla.org/SeaMonkey/warn1014136200.29882.html - Tue, 19 Feb
2002 11:30 EST) TBox shows the following warnings:
nsprpub/lib/libc/src/base64.c:316
`rv' might be used uninitialized in this function
nsprpub/pr/src/io/prscanf.c:229
`ch' might be used uninitialized in this function
nsprpub/pr/src/linking/prlink.c:544
`oserr' might be used uninitialized in this function
nsprpub/pr/src/misc/pralarm.c:137
`pause' might be used uninitialized in this function
nsprpub/pr/src/misc/prdtoa.c:1196
`bb' might be used uninitialized in this function
`bd' might be used uninitialized in this function
`bs' might be used uninitialized in this function
`delta' might be used uninitialized in this function
nsprpub/pr/src/misc/prdtoa.c:1898
`ilim' might be used uninitialized in this function
`ilim1' might be used uninitialized in this function
nsprpub/pr/src/misc/prdtoa.c:1900
`spec_case' might be used uninitialized in this function
nsprpub/pr/src/misc/prdtoa.c:1906
`mlo' might be used uninitialized in this function
nsprpub/pr/src/misc/prtpool.c:313
`pollfds' might be used uninitialized in this function
nsprpub/pr/src/misc/prtpool.c:314
`polljobs' might be used uninitialized in this function
nsprpub/pr/src/pthreads/ptio.c:3435
`start' might be used uninitialized in this function
nsprpub/pr/src/pthreads/ptio.c:4472
`start' might be used uninitialized in this function
Reporter | ||
Comment 1•23 years ago
|
||
Bug 59652 is the meta-bug tracking the fight against these (potentially very
nasty) warnings.
P.S. Trying to make sure that 1.0 has as little warnings as possible.
Blocks: 59652
Keywords: mozilla1.0
Assignee | ||
Updated•23 years ago
|
Status: NEW → ASSIGNED
Priority: -- → P1
Target Milestone: --- → 4.2
Assignee | ||
Comment 2•23 years ago
|
||
I reviewed the following warnings and verified that
they are benign, that is, we are not using those
variables uninitialized.
nsprpub/lib/libc/src/base64.c:316
`rv' might be used uninitialized in this function
nsprpub/pr/src/linking/prlink.c:544
`oserr' might be used uninitialized in this function
nsprpub/pr/src/misc/pralarm.c:137
`pause' might be used uninitialized in this function
nsprpub/pr/src/misc/prtpool.c:313
`pollfds' might be used uninitialized in this function
nsprpub/pr/src/misc/prtpool.c:314
`polljobs' might be used uninitialized in this function
nsprpub/pr/src/pthreads/ptio.c:3435
`start' might be used uninitialized in this function
nsprpub/pr/src/pthreads/ptio.c:4472
`start' might be used uninitialized in this function
I still need to review the warnings in
nsprpub/pr/src/io/prscanf.c and nsprpub/pr/src/misc/prdtoa.c.
I don't want to just blindly initialize those variables
to 0 or NULL. Although that would eliminate the compiler
warnings, that could also mask real problems. This is
why I want to review the code first. (Initializing
variables to 0 or NULL blindly does have one advantage:
we would crash or fail consistently.)
Assignee | ||
Comment 3•23 years ago
|
||
Notes for myself.
nsprpub/pr/src/io/prscanf.c is revision 3.9.
nsprpub/pr/src/misc/prdtoa.c is revision 3.7.
Updated•22 years ago
|
Summary: Occurances of uninitialized variables being used before being set (in nsprpub) → Occurences of uninitialized variables being used before being set (in nsprpub)
Reporter | ||
Comment 4•22 years ago
|
||
The number of warnings in nsprpub (as reported by brad TBox) just skyrocketed!
The current list is:
nsprpub/lib/libc/src/base64.c:316
`rv' might be used uninitialized in this function
nsprpub/pr/src/io/prscanf.c:229
`ch' might be used uninitialized in this function
nsprpub/pr/src/io/prscanf.c:339
`ch' might be used uninitialized in this function
nsprpub/pr/src/linking/prlink.c:623
`oserr' might be used uninitialized in this function
nsprpub/pr/src/misc/pralarm.c:137
`pause' might be used uninitialized in this function
nsprpub/pr/src/misc/prcountr.c:150
`qnp' might be used uninitialized in this function
nsprpub/pr/src/misc/prcountr.c:287
`rh' might be used uninitialized in this function
nsprpub/pr/src/misc/prdtoa.c:1235
`bb' might be used uninitialized in this function
`bd' might be used uninitialized in this function
`bs' might be used uninitialized in this function
`delta' might be used uninitialized in this function
nsprpub/pr/src/misc/prdtoa.c:1937
`ilim' might be used uninitialized in this function
`ilim1' might be used uninitialized in this function
nsprpub/pr/src/misc/prdtoa.c:1939
`spec_case' might be used uninitialized in this function
nsprpub/pr/src/misc/prdtoa.c:1945
`mlo' might be used uninitialized in this function
nsprpub/pr/src/misc/prtpool.c:313
`pollfds' might be used uninitialized in this function
nsprpub/pr/src/misc/prtpool.c:314
`polljobs' might be used uninitialized in this function
nsprpub/pr/src/misc/prtrace.c:232
`qnp' might be used uninitialized in this function
nsprpub/pr/src/misc/prtrace.c:572
`rh' might be used uninitialized in this function
nsprpub/pr/src/misc/prtrace.c:793
`buf' might be used uninitialized in this function
nsprpub/pr/src/pthreads/ptio.c:3694
`start' might be used uninitialized in this function
nsprpub/pr/src/pthreads/ptio.c:4739
`start' might be used uninitialized in this function
Updated•18 years ago
|
QA Contact: wtchang → nspr
Comment 5•18 years ago
|
||
The target milestone is already released. Resetting target milestone.
Target Milestone: 4.2 → ---
It looks as though these warnings may have been fixed:
nsprpub/pr/src/linking/prlink.c:623
`oserr' might be used uninitialized in this function
nsprpub/pr/src/misc/prdtoa.c:1939
`spec_case' might be used uninitialized in this function
I am not seeing warnings about them when I built source checked out on 20080406_180637 with Mac OS X 10.4.11, gcc = 4.0.1 (Apple Computer, Inc. build 5250).
It seems this patch is a bit of a no-brainer. The question is, can these fixes be put in with any confidence? If the tests of the component do their job, the answer should be yes. If they do not, there is a bigger problem. What change could be made, for any reason, if the right tests do not exist? If tests are not sufficient, will this not lead to the component becoming moribund?
If the current tests of NSPR do not allow this change to be made with any confidence, what tests need to be added that would allow this?
Attachment #314103 -
Flags: review?(wtc)
Comment 7•17 years ago
|
||
Comment on attachment 314103 [details] [diff] [review]
patch for variable initialization
Review comments:
1. NULL is appropriate for pointers, but assigning NULL to integer types
will create warnings on some supported NSPR platforms.
>> PRIntervalTime pause = NULL;
>> PRIntervalTime start = NULL, elapsed, remaining;
>> PRIntervalTime start = NULL, elapsed, remaining;
2. NSPR source wraps any lines that exceed 80 characters.
..12345678901234567890123456789012345678901234567890123456789012345678901234567890
>> Bigint *bb = NULL, *bb1 = NULL, *bd = NULL, *bd0 = NULL, *bs = NULL, *delta = NULL;
Comment 8•13 years ago
|
||
Currently, there is no warning in nsprpub/ and hence closing this bug.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•