This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 258143 - Printf and double + int
Summary: Printf and double + int
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 8.2
Hardware: PC Solaris
: P2 normal (vote)
Assignee: petrk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-25 10:08 UTC by soldatov
Modified: 2016-04-20 09:31 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description soldatov 2016-02-25 10:08:28 UTC
I see regression in trunk tests:

#include <typeinfo>
#include <stdio.h>
 
int main() {

    int i = 1;
    double d = 1.1f;
    printf("%s <--> ", typeid(i + d).name());
    printf("%f\n", i + d);

    printf("%s <--> ", typeid(d + i).name());
    printf("%f\n", d + i); // highlighted %f

    return 0;
}

My code works in Oracle Solaris Studio, GCC and CLang, but IDE speaks "Replace %f with %d".  If I will replace code I will see:

====================================================================
d <--> 2.100000
d <--> -805306368

RUN FINISHED; exit value 0; real time: 0ms; user: 0ms; system: 0ms
====================================================================
or
====================================================================
clang++    -c -g -MMD -MP -MF "build/Debug/CLang-Linux/newfile.o.d" -o build/Debug/CLang-Linux/newfile.o newfile.cpp
newfile.cpp:13:20: warning: format specifies type 'int' but the argument has type 'double' [-Wformat]
    printf("%d\n", d + i); // highlighted %f
            ~~     ^~~~~
            %f
1 warning generated.
====================================================================
Comment 1 petrk 2016-03-21 15:55:47 UTC
Fixed in http://hg.netbeans.org/cnd-main/rev/1497f15a6083
Comment 2 Quality Engineering 2016-03-22 02:45:53 UTC
Integrated into 'main-silver', will be available in build *201603220001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/1497f15a6083
User: Petr Kudryavtsev <petrk@netbeans.org>
Log: Fixed #258143 - Printf and double + int
Comment 3 Quality Engineering 2016-03-31 01:42:49 UTC
Integrated into 'main-silver', will be available in build *201603310001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/3e5d6bd1ef93
User: Petr Kudryavtsev <petrk@netbeans.org>
Log: Additional fix  for #258143 - Printf and double + int
-- fixed diamond operator in CsmCompletionQuery
Comment 4 Vladimir Kvashin 2016-04-15 16:59:53 UTC
verified in builds on enum server
Comment 5 soldatov 2016-04-20 09:31:07 UTC
Verified in NetBeans 8.1 with latest updates.