Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang prints garbage in compile warning #23886

Closed
llvmbot opened this issue May 13, 2015 · 7 comments
Closed

Clang prints garbage in compile warning #23886

llvmbot opened this issue May 13, 2015 · 7 comments
Labels
bugzilla Issues migrated from bugzilla clang Clang issues not falling into any other category

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented May 13, 2015

Bugzilla Link 23512
Resolution MOVED
Resolved on May 14, 2015 15:25
Version 3.5
OS FreeBSD
Reporter LLVM Bugzilla Contributor
CC @DimitryAndric,@emaste

Extended Description

Hi,

Clang prints garbage in one of its warnings:

clang35 -v
clang version 3.5.1 (tags/RELEASE_351/final)
Target: x86_64-portbld-freebsd9.3
Thread model: posix

bmake -m $PWD/share/mk CC=/usr/local/bin/clang35 LD=/usr/local/bin/ld buildkernel -DNO_CLEAN -DNO_KERNELDEPEND WERROR=""

/usr/img/freebsd/sys/modules/sppp/../../net/if_spppsubr.c:5372:15: warning: format specifies type 'unsigned char *' but the argument has
���������������`������������0������P����������

--HPS

@llvmbot
Copy link
Collaborator Author

llvmbot commented May 13, 2015

Can you please provide a minimal repro?

1 similar comment
@llvmbot
Copy link
Collaborator Author

llvmbot commented May 13, 2015

Can you please provide a minimal repro?

@llvmbot
Copy link
Collaborator Author

llvmbot commented May 14, 2015

  1. Checkout FreeBSD 11-current sources:

commit 5cfb29320af7efe68fe6aa83e89cc3650167c5f0
Author: ganbold ganbold@FreeBSD.org
Date: Wed May 13 05:46:04 2015 +0000

Delete cpu_do_powersave which is set but never used/tested
serving no useful purpose.
  1. Install clang35 from pkg under FreeBSD 9-stable.

  2. In /etc/make.conf:

CC=/usr/local/bin/clang35
LD=/usr/local/bin/ld
COMPILER_TYPE=clang
COMPILER_VERSION=30500

  1. cd /usr/img/freebsd/sys/modules/sppp
  2. bmake -m /usr/img/freebsd/share/mk

Should reproduce.

@DimitryAndric
Copy link
Collaborator

"Minimal" in this context means a preprocessed .c or .cpp file, without any external dependencies. Also, the exact command line flags used to invoke clang are almost always needed.

@llvmbot
Copy link
Collaborator Author

llvmbot commented May 14, 2015

Command line:

/usr/local/bin/clang35 -O2 -pipe -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc -fno-common -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error-tautological-compare -Wno-error-empty-body -Wno-error-parentheses-equality -Wno-error-unused-function -Wno-error-pointer-sign -mno-aes -mno-avx -std=iso9899:1999 -c if_spppsubr.c

See attached if_spppsubr.c

Thank you!

--HPS

@llvmbot
Copy link
Collaborator Author

llvmbot commented May 14, 2015

Preprocessed file

@DimitryAndric
Copy link
Collaborator

Right, this is a bug in the FreeBSD-specific -fformat-extensions support, added in the lang/clang35 port. This flag isn't supported by upstream clang, and has been replaced by the format(freebsd_kprintf, x, y) attribute in trunk.

For reference, a minimal example is:

void foo(int, const char *, ...) attribute((format(printf, 2, 3)));

void bar(const unsigned char *p, unsigned short len)
{
foo(-1, " %*D", len, p, "-");
}

Let's move this bug over to the FreeBSD bug tracker:

https://bugs.freebsd.org/200193

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang Clang issues not falling into any other category
Projects
None yet
Development

No branches or pull requests

2 participants