Hi,
     I am seeing crash when I run an application using %f in printf on X64 
platform. Please find the code and .inf file content below.

Can anyone help me in this regard?



-----------------------------------------------------------------------------------------------------------------------------------------

test.c
--------

#include  <stdio.h>
#include  <wchar.h>
#include  <stdlib.h>
#include  <Uefi.h>
#include  <Library/UefiLib.h>
#include  <Library/ShellCEntryLib.h>

int
main (
  IN int Argc,
  IN char **Argv
  )
{
  double temp = 0.0319;
  wchar_t *str;

  str = (wchar_t *) malloc(10);

  if (NULL != str) {

  printf("This is test\n");
  printf("temp (f) = %f, temp (e) = %e\n", temp, temp);
  printf("temp (d) = %d, temp (x) = 0x%x\n", (int)temp, (int)temp);

  swprintf(str, 5, L"%0.2f", temp);
  wprintf(L"str (ls) = %ls\n", (const wchar_t *)str);
  printf("str (ls) = %ls, str (s) = %s, size (f) = %f\n", str, (char *)str, 
temp);

  }
  else {
                printf("str malloc failed\n");
  }

  return(0);
}


-----------------------------------------------------------------------------------------------------------------------------------------

test.inf
---------

[Defines]
  INF_VERSION                    = 0x00010006
  BASE_NAME                      = Main
  FILE_GUID                      = a912f198-7f0e-4803-b908-b757b806ec83
  MODULE_TYPE                    = UEFI_APPLICATION
  VERSION_STRING                 = 0.1
  ENTRY_POINT                    = ShellCEntryLib

#
#  VALID_ARCHITECTURES           = IA32 X64 IPF
#

[Sources]
  test.c

[Packages]
  StdLib/StdLib.dec
  MdePkg/MdePkg.dec
  ShellPkg/ShellPkg.dec

[LibraryClasses]
  #LibC
  LibStdio
  DevShell
  UefiLib
  ShellCEntryLib

  [BuildOptions]
  MSFT:*_*_IA32_CC_FLAGS  = /Oi-


-----------------------------------------------------------------------------------------------------------------------------------------




Thanks,
Aniruddha. Herekar.

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to