bugGNU nano - Bugs: bug #53333, undefined pointer comparison

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #53333: undefined pointer comparison

Submitted by:  None
Submitted on:  Mon 12 Mar 2018 09:04:16 PM UTC  
 
Severity:  2 - Minor Status:  Fixed
Assigned to:  Benno Schulenberg <bens> Open/Closed:  Closed

Sun 18 Mar 2018 01:04:45 PM UTC, comment #4: 

Fixed in git, commit 95989e7d.

Thanks for reporting.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Thu 15 Mar 2018 05:06:42 PM UTC, comment #3: 

s/place/placed/

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Thu 15 Mar 2018 05:05:21 PM UTC, comment #2: 

One example in my current binary where the order differs from the source code: do_toggle_void() is not place right after do_toggle() but far before it.

Another example: to_first_file() and to_last_file() are place far before do_browser() instead of far after it.

So yes, this needs fixing: an ugly comparison with all the relevant movement functions.  :|

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Thu 15 Mar 2018 04:54:11 PM UTC, comment #1: 

You are probably right in that there is no guarantee about the order of the functions in the binary.  A year or two ago I wanted to see how the binary code changed for some tiny change in the source code.  It was hard to compare the two binaries because one of the functions moved to a wholly different place, changing all of the addresses.

But when I disassemble nano's binary on my system, the functions in move.c appear to be perfectly ordered.  So for now it will work.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Mon 12 Mar 2018 09:04:16 PM UTC, original submission:  

Building nano 2.9.4 with clang 5 shows these warnings:

nano.c:1773:26: warning: ordered comparison of function pointers ('void (*)(void)' and 'void (*)(void)')
                                                                        (shortcut->func >= to_first_line &&
                                                                         ~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~
nano.c:1774:25: warning: ordered comparison of function pointers ('void (*)(void)' and 'void (*)(void)')
                                                                        shortcut->func <= do_right))) {
                                                                        ~~~~~~~~~~~~~~ ^  ~~~~~~~~

As best as I can guess, this comparison tries to check whether shortcut->func points to a function contained in move.c.  I don't think this check is well-defined in C.  I don't expect that there is any guarantee in what order functions are emitted in a compilation unit.

Anonymous

 

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 bens (Posted a comment)
  •  

    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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-03-30 bens Severity3 - Normal => 2 - Minor
        Open/ClosedOpen => Closed
    2018-03-18 bens StatusNone => Fixed
    2018-03-15 bens Assigned toNone => bens
        SummaryUndefined pointer comparison => undefined pointer comparison

    Back to the top


    Powered by Savane 3.5