BR 2827397: fix invalid C in outcoff AddExports()
commit7ad24562dccca867d9ba591ac7dd242456003c5b
authorH. Peter Anvin <hpa@zytor.com>
Sun, 26 Jul 2009 22:29:09 +0000 (26 15:29 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Sun, 26 Jul 2009 22:29:09 +0000 (26 15:29 -0700)
tree8103d37019b99d0ad9278b7dbff2981861a99268
parent54dd03bfe56d6f23e423ed65054b329e1830ece1
BR 2827397: fix invalid C in outcoff AddExports()

The construct:

         if (i == nsects)
             directive_sec =
                 sects[coff_make_section
                       (EXPORT_SECTION_NAME, EXPORT_SECTION_FLAGS)];

... where coff_make_section() can change the global variable "sects"
is undefined C, since there is no sequence point involved in the []
operator, and it is therefore fully permitted for the C compiler to
read the sects variable first.  Change this construct into two
statements to enforce defined behavior; this also ends up with the
code slightly simpler.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
output/outcoff.c