This is the mail archive of the gcc-patches@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] |
Tested on x86-linux, committed on mainline. The fact that a variable is aliased or renamed causes the value of the variable to be available through several entities. Thus, in the case of aliased or renamed values, no warning is emitted. However, the fact that a variable has an access type, or a private type whose full view is an access type, does not in itself introduce potential multiple access paths to its value, and therefore must not cause suppression of this warning. Test case zq.adb: gcc -c -gnatwa zq.adb must accept source with no error and the following three warnings: zq.adb:4:04: warning: variable "X1" is assigned but never read zq.adb:5:04: warning: variable "X2" is assigned but never read zq.adb:6:04: warning: variable "X3" is assigned but never read -- package ZP is type T1 is private; type T2 is private; type T3 is access Integer; private type T1 is access Integer; type T2 is null record; end ZP; with ZP; procedure ZQ is X1, Y1 : ZP.T1; X2, Y2 : ZP.T2; X3, Y3 : ZP.T3; begin Y3 := null; -- Kill no-assignment warning X1 := Y1; X2 := Y2; X3 := Y3; end ZQ; 2004-12-07 Thomas Quinot <quinot@adacore.com> Ed Schonberg <schonberg@adacore.com> * exp_ch4.adb (Expand_N_Indexed_Component): For an indexed component with an implicit dereference as its prefix, use Insert_Explicit_Dereference instead of merely rewriting the prefix into an explicit dereference. This ensures that a reference to the original prefix is generated, if appropriate. * sem_util.adb (Insert_Explicit_Dereference): When an implicit dereference is rewritten to an explicit one, generate a reference to the entity denoted by its prefix using the original prefix node, so the dereference can be properly recorded as a read of the denoted access value, if appropriate. * sem_warn.adb (Output_Unreferenced_Messages): Do not abstain from emitting 'assigned but never read' warning on a variable on the basis that it has an access type. (Check_References): Emit unreferenced warning when the scope is a subprogram body.
Attachment:
difs.9
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |