diff --git a/base/run/printf.run b/base/run/printf.run new file mode 100644 index 0000000000..b015bc494d --- /dev/null +++ b/base/run/printf.run @@ -0,0 +1,32 @@ +build "core init test/printf" + +create_boot_directory + +install_config { + + + + + + + + + + + + + + + + + + +} + +build_boot_image "core init test-printf" + +append qemu_args "-nographic -m 64" + +run_genode_until {-1 = -1 = -1} 10 + +puts "Test succeeded" diff --git a/base/src/base/console/console.cc b/base/src/base/console/console.cc index cd9313fb1f..9f050961d3 100644 --- a/base/src/base/console/console.cc +++ b/base/src/base/console/console.cc @@ -276,7 +276,7 @@ void Console::vprintf(const char *format, va_list list) case Format_command::LONG: numeric_arg = (cmd.type == Format_command::UINT) ? - va_arg(list, unsigned long) : va_arg(list, long); + (long long)va_arg(list, unsigned long) : va_arg(list, long); break; case Format_command::SIZE_T: @@ -287,7 +287,7 @@ void Console::vprintf(const char *format, va_list list) case Format_command::DEFAULT: numeric_arg = (cmd.type == Format_command::UINT) ? - va_arg(list, unsigned int) : va_arg(list, int); + (long long)va_arg(list, unsigned int) : va_arg(list, int); break; } } diff --git a/base/src/test/printf/main.cc b/base/src/test/printf/main.cc new file mode 100644 index 0000000000..e0eb1e0201 --- /dev/null +++ b/base/src/test/printf/main.cc @@ -0,0 +1,22 @@ +/* + * \brief Testing 'printf()' with negative integer + * \author Christian Prochaska + * \date 2012-04-20 + * + */ + +/* + * Copyright (C) 2012 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#include + +int main(int argc, char **argv) +{ + Genode::printf("-1 = %d = %ld\n", -1, -1L); + + return 0; +} diff --git a/base/src/test/printf/target.mk b/base/src/test/printf/target.mk new file mode 100644 index 0000000000..3bcfb4eb36 --- /dev/null +++ b/base/src/test/printf/target.mk @@ -0,0 +1,3 @@ +TARGET = test-printf +SRC_CC = main.cc +LIBS = env