bugGNU gperf perfect hash fn generator - 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: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Invalid
Privacy: PublicAssigned to: Bruno Haible <haible>
Open/Closed: Closed

Add a New Comment (Rich MarkupRich 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.

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

The documentation of the option -P in
http://www.gnu.org/software/gperf/manual/html_node/Output-Details.html
says:
"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 File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

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

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 08 Jan 2013 12:28:57 AM UTChaibleStatusNone=>Invalid
      Assigned toNone=>haible
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup