buggperf - Bugs: bug #37005, -P (PIC-friendly) code not correct...


bug #37005: -P (PIC-friendly) code not correct for structure table

Submitted by:  Chip Salzenberg <chip>
Submitted on:  Tue 31 Jul 2012 09:45:11 PM UTC  
Category:  Generated code Severity:  3 - Normal
Item Group:  None Status:  Invalid
Privacy:  Public Assigned to:  Bruno Haible <haible>
Open/Closed:  Closed

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Tue 08 Jan 2013 05:58:46 PM UTC, comment #3:

c'mon, it's documented sure, but the patch makes it better; code doesn't have to care whether it's pic or not.

Tue 08 Jan 2013 12:28:57 AM UTC, comment #2:

The documentation of the option -P in
"the first field of the user-defined struct must be of type ‘int’, not ‘char *’, because it will contain offsets into the string pool instead of actual strings."

Therefore your struct should be:

Bruno Haible <haible>
Project AdministratorIn charge of this item.
Tue 31 Jul 2012 09:46:33 PM UTC, comment #1:

Note, the comment on the second substitution is incorrect.

Chip Salzenberg <chip>
Tue 31 Jul 2012 09:45:11 PM UTC, original submission:

Given input that defines the table structure as e.g.

the generated code for gperf -P does not compile in C nor C++. First, it tries to put integer offsets into the name field, which is an error in C++, not just a warning. Second, it attempts to add two when verifying a correct match, which is an error in C or C++.

To work around this, I had to run these substitutions on the output:

Chip Salzenberg <chip>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by haible (Posted a comment)
  • -email is unavailable- added by chip (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-11-24 haible CategoryNone => Generated code
    2013-01-08 haible StatusNone => Invalid
        Assigned toNone => haible
        Open/ClosedOpen => Closed

    Back to the top

    Powered by Savane 3.3