bugGNU Astronomy Utilities - Bugs: bug #46377, Compilation warnings in mesh.c...

 
 

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

bug #46377: Compilation warnings in mesh.c subtractsky.c and label.c

Submitted by:  Mosè Giordano <giordano>
Submitted on:  Wed 04 Nov 2015 04:18:44 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: Source codeStatus: Fixed
Privacy: PublicAssigned to: Mohammad Akhlaghi <makhlaghi>
Open/Closed: Closed

Thu 05 Nov 2015 03:40:17 AM UTC, comment #4:

Sorry, I forgot to mention that the change has been pushed to master.

Mohammad Akhlaghi <makhlaghi>
Project AdministratorIn charge of this item.
Thu 05 Nov 2015 03:38:24 AM UTC, comment #3:

All the issues are now fixed. The first two were only necessary in certain conditions and so I initialized them to NULL. In this way, even if they are mistakenly called in other situations, the program will give a segmentation falt for reading from the NULL pointer.

The last case was also an interesting bug that had slipped through my fingers! Thanks checking it with Clang and reporting it ;-). It is corrected now.

Mohammad Akhlaghi <makhlaghi>
Project AdministratorIn charge of this item.
Thu 05 Nov 2015 03:17:19 AM UTC, comment #2:

Thanks for pointing these out, I am using GCC 5.2 and it hadn't complained about them. I will fix them.

It is best to submit each set of compilation warnings that are found (in different programs/libraries) as a separate bug, so once it is fixed, it can easily be closed.

Mohammad Akhlaghi <makhlaghi>
Project AdministratorIn charge of this item.
Wed 04 Nov 2015 04:33:35 PM UTC, comment #1:

In addition Clang 3.5.2 emits this warning:

The problem is that this else is after two if's. Please note also that indentation of that "else" doesn't match Emacs default indentation, so probably that else doesn't do what was thought to do (but I didn't study the code to actually understand what should do). That else should be executed when the first (as suggest your indentation) or the second if condition (as it is usually interpreted in C, see https://en.wikipedia.org/wiki/Dangling_else#C) is false?

The fix is to put explicit braces after if's in order to avoid ambiguities.

Mosè Giordano <giordano>
Project Member
Wed 04 Nov 2015 04:18:44 PM UTC, original submission:

With GCC 5.2.1 I get the following warnings during compilation:

In both cases the variables are initialized inside a if that hasn't an else clause.

Mosè Giordano <giordano>
Project Member

 

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 makhlaghi (Posted a comment)
  • -unavailable- added by giordano (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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 05 Nov 2015 03:38:24 AM UTCmakhlaghiStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Thu 05 Nov 2015 03:17:19 AM UTCmakhlaghiAssigned toNone=>makhlaghi
      SummaryCompilation warnings=>Compilation warnings in mesh.c subtractsky.c and label.c

    Back to the top


    Powered by Savane 3.1-cleanup1