This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

warning: C4017W: __x__1 may be used before being set

1. In my code whenever I set optimization level 3 with time, i got warning:

"warning: C4017W: __x__1 may be used before being set"

2. In the file in which this error, I have included "math.h"

3. When I remove "math.h", warning gets removed.

4. Tool Version Numbers:

Toolchain: MDK-Lite Version: 4.72.1.0
Toolchain Path: C:\Keil\ARM\ARMCC\bin\
C Compiler: Armcc.Exe V5.03.0.76 [Evaluation]
Assembler: Armasm.Exe V5.03.0.76 [Evaluation]
Linker/Locator: ArmLink.Exe V5.03.0.76 [Evaluation]
Librarian: ArmAr.Exe V5.03.0.76 [Evaluation]
Hex Converter: FromElf.Exe V5.03.0.76 [Evaluation]
CPU DLL: SARMCM3.DLL V4.72.1.0
Dialog DLL: DCM.DLL V1.10.0.0
Target DLL: UL2CM3.DLL V1.150.11.0
Dialog DLL: TCM.DLL V1.14.1.0

  • Is that all the compiler reports?

    Why not give us the actual line of code that the warning relates to?

    When you remove the math.h, do you get any other warnings or errors? If not, then why do you include it anyway?

  • I had the same problem

    typedef struct POINT_XY { /* "POINT_XY" structure type */ INT16 x; /* X coordinate */ INT16 y; /* Y coordinate */
    }POINT_XY ;

    void On_CliquerUnAngle( POINT_XY pt )
    { POINT_XY ptHere ; INT16 MemoXOrigin_LAlpha_Here , MemoYOrigin_LAlpha_Here ;

    MemoXOrigin_LAlpha_Here = GetOriginX ();

    MemoYOrigin_LAlpha_Here = GetOriginY ();

    SetOrigin(MemoXOrigin_LAlpha, MemoYOrigin_LAlpha);

    ptHere.x = XScreenToImage(pt.x); ptHere.y = YScreenToImage(pt.y); if (CliquerUnAngle( ptHere , ListSauvePosAngle_L_Alpha )) { SetOrigin(MemoXOrigin_LAlpha_Here, MemoYOrigin_LAlpha_Here); CallAfficheLaPieceCall(); } else { SetOrigin(MemoXOrigin_LAlpha_Here, MemoYOrigin_LAlpha_Here); }
    }

    ..\..\..\General\MAIN\Dessin2D\Pli_2D\Xp2dP2dP.cpp(4206): warning: C4017W: ptHere may be used before being set

    >> I did

    ptHere.x = XScreenToImage(pt.x); ptHere.y = YScreenToImage(pt.y);

    thank

  • This would be a lot clearer if you followed the simple posting tips with regards to placing source code in a post, and you identified which line the error falls, as we're missing 4200+ of them.