s3/loadparm: Fix severe HPUX compiler issue. (Explicitly initilise all elements in C99 structures)
Olaf Flebbe
O.Flebbe at science-computing.de
Wed Oct 14 01:18:26 MDT 2009
Hi,
>>
>> diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
>> index 7bac72e..fa0577b 100644
>> --- a/source3/param/loadparm.c
>> +++ b/source3/param/loadparm.c
>> @@ -3275,6 +3275,8 @@ static struct parm_struct parm_table[] = {
>> .type = P_LIST,
>> .p_class = P_GLOBAL,
>> .ptr = &Globals.szInitLogonDelayedHosts,
>> + .special = NULL,
>> + .enum_list = NULL,
>> .flags = FLAG_ADVANCED,
>> },
>
> I realise it's a small fix here, but if we follow this to it's natural
> conclusion, we will undo one of the main reasons we shifted to C99
> structure initilisation in the first place.
The latest HPUX Compiler (11.11.20) has issues omitting the .enum_list
initialization. The ".special" is not a problem here, but we added it to
be complete. Compiler Versions prior to 11.11.20 are crashing with this
code.
See attached bugreport we are about to submit to HP with detailled
information about the issue.
This may follow samba throughout the codebase, if HP does not fix it.
I can update you if HP does move.
Thanks to my collegue Harald König to pinpoint the problem and writing
this report.
Olaf
----------------------
Hi,
yahcb: yet another hpux cc bug -- from "loadparm.c" of samba-3.4.[12]:
here is a minimal example of the compiler bug being hit in
samba-3.4.1/3.4.1 in source3/param/loadparm.c:
if the struct element "enum_list" does not get initialized,
aCC generates *huge* amounts of initialisation data (see output
of "size" command). this will hit us because executables will be much to
large to handle.
the only two struct[] entries with missing .enum_list=... in loadparm.c
have these labels:
.label = "init logon delayed hosts",
.label = "init logon delay",
below is a minimal example how to create insane *.o file.
output of the testing commands:
hpux tmp > cc -AC99 -c struct-bug.c ; size struct-bug.o
16 + 24 + 0 = 40
hpux tmp > cc -AC99 -DBUG -c struct-bug.c ; size struct-bug.o
16 + 136920952 + 0 = 136920968
hpux tmp > cc -AC99 -DBUG -DBUGBUG -c struct-bug.c ; size struct-bug.o
16 + 273841916 + 0 = 273841932
et voila the sample code "struct-bug.c" :
-- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< --
/*
struct-bug.c
compile/test with:
cc -AC99 -c struct-bug.c ; size struct-bug.o
cc -AC99 -DBUG -c struct-bug.c ; size struct-bug.o
cc -AC99 -DBUG -DBUGBUG -c struct-bug.c ; size struct-bug.o
*/
struct enum_list {
int value;
const char *name;
};
struct parm_struct {
const char *label;
const struct enum_list *enum_list;
};
static struct parm_struct parm_table[] = {
{
.label = "label 1",
#ifndef BUG
.enum_list = 0L ,
#endif
},
{
.label = "label 2",
#ifndef BUGBUG
.enum_list = 0L ,
#endif
},
{ 0L, 0L}
};
-- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< --
--
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Roland Niemeier,
Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Michel Lepert
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196
-------------- next part --------------
A non-text attachment was scrubbed...
Name: O_Flebbe.vcf
Type: text/x-vcard
Size: 379 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20091014/a0fc516b/attachment.vcf>
More information about the samba-technical
mailing list