LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 44108 - Create a check that warns about using %p printf specifier
Summary: Create a check that warns about using %p printf specifier
Status: NEW
Alias: None
Product: clang-tools-extra
Classification: Unclassified
Component: clang-tidy (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P enhancement
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-21 15:44 PST by Richard
Modified: 2019-11-21 15:44 PST (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard 2019-11-21 15:44:48 PST
Recently I ran into some surprising behavior surrounding the use of %p in a printf call.  On Windows %p with a nullptr prints zeros, but on Linux %p with a nullptr prints "(nil)".  This is surprising, but conforming to the standard which states (roughly) that the result of %p is implementation dependent.

Create a check that warns about the potential non-portable output when using %p in a printf or scanf specifier.