Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Silence spurious -Wnontrivial-memcall warnings in C mode #137429

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

Merged
merged 2 commits into from
Apr 30, 2025

Conversation

ahatanak
Copy link
Collaborator

clang currently issues a warning when memset is used on a struct that contains an address-discriminated pointer field, even though this is entirely valid behavior.

For example:

struct S {
  int * __ptrauth(1, 1, 100) p;
} s;

memset(&s, 0, sizeof(struct S));

Only allow the warning to be emitted in C++ mode to silence the warning.

rdar://142495870

clang currently issues a warning when memset is used on a struct that
contains an address-discriminated pointer field, even though this is
entirely valid behavior.

For example:

```
struct S {
  int * __ptrauth(1, 1, 100) p;
} s;

memset(&s, 0, sizeof(struct S));
```

Only allow the warning to be emitted in C++ mode to silence the warning.

rdar://142495870
@ahatanak ahatanak marked this pull request as ready for review April 26, 2025 01:54
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Apr 26, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 26, 2025

@llvm/pr-subscribers-clang

Author: Akira Hatanaka (ahatanak)

Changes

clang currently issues a warning when memset is used on a struct that contains an address-discriminated pointer field, even though this is entirely valid behavior.

For example:

struct S {
  int * __ptrauth(1, 1, 100) p;
} s;

memset(&s, 0, sizeof(struct S));

Only allow the warning to be emitted in C++ mode to silence the warning.

rdar://142495870


Full diff: https://github.com/llvm/llvm-project/pull/137429.diff

2 Files Affected:

  • (modified) clang/lib/Sema/SemaChecking.cpp (+5-5)
  • (added) clang/test/Sema/warn-nontrivial-struct-memaccess-ptrauth.c (+42)
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 9c9372d9ee2b0..ee3b55c83699e 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -9724,9 +9724,9 @@ void Sema::CheckMemaccessArguments(const CallExpr *Call,
       // completed later. GCC does not diagnose such code, but we may want to
       // consider diagnosing it in the future, perhaps under a different, but
       // related, diagnostic group.
-      bool MayBeTriviallyCopyableCXXRecord =
-          RT->isIncompleteType() ||
-          RT->desugar().isTriviallyCopyableType(Context);
+      bool NonTriviallyCopyableCXXRecord =
+          getLangOpts().CPlusPlus && !RT->isIncompleteType() &&
+          !RT->desugar().isTriviallyCopyableType(Context);
 
       if ((BId == Builtin::BImemset || BId == Builtin::BIbzero) &&
           RT->getDecl()->isNonTrivialToPrimitiveDefaultInitialize()) {
@@ -9735,7 +9735,7 @@ void Sema::CheckMemaccessArguments(const CallExpr *Call,
                                 << ArgIdx << FnName << PointeeTy << 0);
         SearchNonTrivialToInitializeField::diag(PointeeTy, Dest, *this);
       } else if ((BId == Builtin::BImemset || BId == Builtin::BIbzero) &&
-                 !MayBeTriviallyCopyableCXXRecord && ArgIdx == 0) {
+                 NonTriviallyCopyableCXXRecord && ArgIdx == 0) {
         // FIXME: Limiting this warning to dest argument until we decide
         // whether it's valid for source argument too.
         DiagRuntimeBehavior(Dest->getExprLoc(), Dest,
@@ -9748,7 +9748,7 @@ void Sema::CheckMemaccessArguments(const CallExpr *Call,
                                 << ArgIdx << FnName << PointeeTy << 1);
         SearchNonTrivialToCopyField::diag(PointeeTy, Dest, *this);
       } else if ((BId == Builtin::BImemcpy || BId == Builtin::BImemmove) &&
-                 !MayBeTriviallyCopyableCXXRecord && ArgIdx == 0) {
+                 NonTriviallyCopyableCXXRecord && ArgIdx == 0) {
         // FIXME: Limiting this warning to dest argument until we decide
         // whether it's valid for source argument too.
         DiagRuntimeBehavior(Dest->getExprLoc(), Dest,
diff --git a/clang/test/Sema/warn-nontrivial-struct-memaccess-ptrauth.c b/clang/test/Sema/warn-nontrivial-struct-memaccess-ptrauth.c
new file mode 100644
index 0000000000000..d9cd712330c1b
--- /dev/null
+++ b/clang/test/Sema/warn-nontrivial-struct-memaccess-ptrauth.c
@@ -0,0 +1,42 @@
+// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -fptrauth-intrinsics -fsyntax-only -verify %s
+
+void *memset(void *, int, __SIZE_TYPE__);
+void bzero(void *, __SIZE_TYPE__);
+void *memcpy(void *, const void *, __SIZE_TYPE__);
+void *memmove(void *, const void *, __SIZE_TYPE__);
+
+#define AQ __ptrauth(1,1,50)
+#define IQ __ptrauth(1,0,50)
+
+struct PtrAuthTrivial {
+  int f0;
+  int * IQ f1;
+};
+
+struct PtrAuthNonTrivial0 {
+  int f0;
+  int * AQ f1; // expected-note 2 {{non-trivial to copy}}
+  int f2;
+};
+
+struct PtrAuthNonTrivial1 {
+  int * AQ f0; // expected-note 2 {{non-trivial to copy}}
+  int f1;
+  struct PtrAuthNonTrivial0 f2;
+};
+
+void testPtrAuthTrivial(struct PtrAuthTrivial *d, struct PtrAuthTrivial *s) {
+  memset(d, 0, sizeof(struct PtrAuthTrivial));
+  bzero(d, sizeof(struct PtrAuthTrivial));
+  memcpy(d, s, sizeof(struct PtrAuthTrivial));
+  memmove(d, s, sizeof(struct PtrAuthTrivial));
+}
+
+void testPtrAuthNonTrivial1(struct PtrAuthNonTrivial1 *d,
+                            struct PtrAuthNonTrivial1 *s) {
+  memset(d, 0, sizeof(struct PtrAuthNonTrivial1));
+  bzero(d, sizeof(struct PtrAuthNonTrivial1));
+  memcpy(d, s, sizeof(struct PtrAuthNonTrivial1)); // expected-warning {{that is not trivial to primitive-copy}} expected-note {{explicitly cast the pointer to silence}}
+  memmove(d, s, sizeof(struct PtrAuthNonTrivial1)); // expected-warning {{that is not trivial to primitive-copy}} expected-note {{explicitly cast the pointer to silence}}
+}

@ahatanak ahatanak requested review from ojhunt, asl and kovdan01 April 26, 2025 01:55
RT->desugar().isTriviallyCopyableType(Context);
bool NonTriviallyCopyableCXXRecord =
getLangOpts().CPlusPlus && !RT->isIncompleteType() &&
!RT->desugar().isTriviallyCopyableType(Context);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to have isTriviallyCopyableType do any required desugaring or canonicalization rather than requiring every call site do this work, it's a constant hazard.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have to desugar the type before calling isTriviallyCopyableType? It doesn't look like other call sites are doing so.

Why is the call to desugar` needed here?

Copy link
Collaborator

@shafik shafik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have a release note.

@AaronBallman
Copy link
Collaborator

This should have a release note.

The __ptrauth stuff is new to this release, so I don't think a release note is needed in this case.

// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -fsyntax-only -x c++ -verify=cxx,expected %s
// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -fptrauth-intrinsics -fsyntax-only -x c++ -verify=cxx,expected %s

#if defined __cplusplus
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahahah, I was literally thinking "add a -D argument to say it's C++" because I'm a muppet and forgot the builtin macro :D

@ahatanak ahatanak merged commit 6bb4ce0 into llvm:main Apr 30, 2025
11 checks passed
@ahatanak ahatanak deleted the nontrivial-memcall-ptrauth branch April 30, 2025 01:38
@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 30, 2025

LLVM Buildbot has detected a new failure on builder lldb-aarch64-ubuntu running on linaro-lldb-aarch64-ubuntu while building clang at step 6 "test".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/16905

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
PASS: lldb-unit :: ValueObject/./LLDBValueObjectTests/8/11 (2145 of 2154)
PASS: lldb-unit :: ValueObject/./LLDBValueObjectTests/9/11 (2146 of 2154)
PASS: lldb-unit :: tools/lldb-server/tests/./LLDBServerTests/0/2 (2147 of 2154)
PASS: lldb-unit :: tools/lldb-server/tests/./LLDBServerTests/1/2 (2148 of 2154)
PASS: lldb-unit :: Utility/./UtilityTests/4/9 (2149 of 2154)
PASS: lldb-unit :: Host/./HostTests/7/13 (2150 of 2154)
PASS: lldb-unit :: Target/./TargetTests/11/14 (2151 of 2154)
PASS: lldb-unit :: Host/./HostTests/12/13 (2152 of 2154)
PASS: lldb-unit :: Process/gdb-remote/./ProcessGdbRemoteTests/8/9 (2153 of 2154)
UNRESOLVED: lldb-api :: tools/lldb-server/TestLldbGdbServer.py (2154 of 2154)
******************** TEST 'lldb-api :: tools/lldb-server/TestLldbGdbServer.py' FAILED ********************
Script:
--
/usr/bin/python3.10 /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --arch aarch64 --build-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/lldb --compiler /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/clang --dsymutil /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --lldb-obj-root /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb --lldb-libs-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/tools/lldb-server -p TestLldbGdbServer.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision 6bb4ce0f6ff462b58bacc8dbc47719b7009f9b18)
  clang revision 6bb4ce0f6ff462b58bacc8dbc47719b7009f9b18
  llvm revision 6bb4ce0f6ff462b58bacc8dbc47719b7009f9b18
Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 'debugserver', 'objc']

--
Command Output (stderr):
--
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hc_then_Csignal_signals_correct_thread_launch_debugserver (TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any category of interest for this run) 
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hc_then_Csignal_signals_correct_thread_launch_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hg_fails_on_another_pid_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hg_fails_on_minus_one_pid_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hg_fails_on_zero_pid_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hg_switches_to_3_threads_launch_debugserver (TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any category of interest for this run) 
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hg_switches_to_3_threads_launch_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_P_and_p_thread_suffix_work_debugserver (TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any category of interest for this run) 
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_P_and_p_thread_suffix_work_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_P_writes_all_gpr_registers_debugserver (TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any category of interest for this run) 
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_P_writes_all_gpr_registers_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_attach_commandline_continue_app_exits_debugserver (TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any category of interest for this run) 
Program aborted due to an unhandled Error:
Operation not permitted
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/lldb-server gdbserver --attach=845619 --reverse-connect [127.0.0.1]:49477
 #0 0x0000aaaae93d6d34 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/lldb-server+0x4c6d34)
 #1 0x0000aaaae93d4d34 llvm::sys::RunSignalHandlers() (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/lldb-server+0x4c4d34)
 #2 0x0000aaaae93d743c SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x0000ffff987297dc (linux-vdso.so.1+0x7dc)
 #4 0x0000ffff97f2f1f0 __pthread_kill_implementation ./nptl/pthread_kill.c:44:76

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 30, 2025

LLVM Buildbot has detected a new failure on builder lldb-arm-ubuntu running on linaro-lldb-arm-ubuntu while building clang at step 6 "test".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/18/builds/15265

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: tools/lldb-dap/disconnect/TestDAP_disconnect.py (1177 of 3009)
PASS: lldb-api :: tools/lldb-dap/instruction-breakpoint/TestDAP_instruction_breakpoint.py (1178 of 3009)
PASS: lldb-api :: tools/lldb-dap/io/TestDAP_io.py (1179 of 3009)
PASS: lldb-api :: tools/lldb-dap/locations/TestDAP_locations.py (1180 of 3009)
PASS: lldb-api :: tools/lldb-dap/memory/TestDAP_memory.py (1181 of 3009)
PASS: lldb-api :: tools/lldb-dap/optimized/TestDAP_optimized.py (1182 of 3009)
PASS: lldb-api :: tools/lldb-dap/output/TestDAP_output.py (1183 of 3009)
PASS: lldb-api :: tools/lldb-dap/launch/TestDAP_launch.py (1184 of 3009)
PASS: lldb-api :: tools/lldb-dap/repl-mode/TestDAP_repl_mode_detection.py (1185 of 3009)
UNRESOLVED: lldb-api :: tools/lldb-dap/evaluate/TestDAP_evaluate.py (1186 of 3009)
******************** TEST 'lldb-api :: tools/lldb-dap/evaluate/TestDAP_evaluate.py' FAILED ********************
Script:
--
/usr/bin/python3.10 /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin --arch armv8l --build-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/lldb --compiler /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/clang --dsymutil /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin --lldb-obj-root /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/tools/lldb --lldb-libs-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./lib /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/tools/lldb-dap/evaluate -p TestDAP_evaluate.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision 6bb4ce0f6ff462b58bacc8dbc47719b7009f9b18)
  clang revision 6bb4ce0f6ff462b58bacc8dbc47719b7009f9b18
  llvm revision 6bb4ce0f6ff462b58bacc8dbc47719b7009f9b18
Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 'debugserver', 'objc']

--
Command Output (stderr):
--
========= DEBUG ADAPTER PROTOCOL LOGS =========
1745978185.242013454 --> (stdin/stdout) {"command":"initialize","type":"request","arguments":{"adapterID":"lldb-native","clientID":"vscode","columnsStartAt1":true,"linesStartAt1":true,"locale":"en-us","pathFormat":"path","supportsRunInTerminalRequest":true,"supportsVariablePaging":true,"supportsVariableType":true,"supportsStartDebuggingRequest":true,"supportsProgressReporting":true,"$__lldb_sourceInitFile":false},"seq":1}
1745978185.246627569 <-- (stdin/stdout) {"body":{"$__lldb_version":"lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision 6bb4ce0f6ff462b58bacc8dbc47719b7009f9b18)\n  clang revision 6bb4ce0f6ff462b58bacc8dbc47719b7009f9b18\n  llvm revision 6bb4ce0f6ff462b58bacc8dbc47719b7009f9b18","completionTriggerCharacters":["."," ","\t"],"exceptionBreakpointFilters":[{"default":false,"filter":"cpp_catch","label":"C++ Catch"},{"default":false,"filter":"cpp_throw","label":"C++ Throw"},{"default":false,"filter":"objc_catch","label":"Objective-C Catch"},{"default":false,"filter":"objc_throw","label":"Objective-C Throw"}],"supportTerminateDebuggee":true,"supportsBreakpointLocationsRequest":true,"supportsCancelRequest":true,"supportsCompletionsRequest":true,"supportsConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true,"supportsDataBreakpoints":true,"supportsDelayedStackTraceLoading":true,"supportsDisassembleRequest":true,"supportsEvaluateForHovers":true,"supportsExceptionInfoRequest":true,"supportsExceptionOptions":true,"supportsFunctionBreakpoints":true,"supportsHitConditionalBreakpoints":true,"supportsInstructionBreakpoints":true,"supportsLogPoints":true,"supportsModulesRequest":true,"supportsReadMemoryRequest":true,"supportsRestartRequest":true,"supportsSetVariable":true,"supportsStepInTargetsRequest":true,"supportsSteppingGranularity":true,"supportsValueFormattingOptions":true},"command":"initialize","request_seq":1,"seq":0,"success":true,"type":"response"}
1745978185.247334003 --> (stdin/stdout) {"command":"launch","type":"request","arguments":{"program":"/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/tools/lldb-dap/evaluate/TestDAP_evaluate.test_generic_evaluate_expressions/a.out","initCommands":["settings clear -all","settings set symbols.enable-external-lookup false","settings set target.inherit-tcc true","settings set target.disable-aslr false","settings set target.detach-on-error false","settings set target.auto-apply-fixits false","settings set plugin.process.gdb-remote.packet-timeout 60","settings set symbols.clang-modules-cache-path \"/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api\"","settings set use-color false","settings set show-statusline false"],"disableASLR":false,"enableAutoVariableSummaries":false,"enableSyntheticChildDebugging":false,"displayExtendedBacktrace":false},"seq":2}
1745978185.247837543 <-- (stdin/stdout) {"body":{"category":"console","output":"Running initCommands:\n"},"event":"output","seq":0,"type":"event"}
1745978185.247904301 <-- (stdin/stdout) {"body":{"category":"console","output":"(lldb) settings clear -all\n"},"event":"output","seq":0,"type":"event"}
1745978185.247918606 <-- (stdin/stdout) {"body":{"category":"console","output":"(lldb) settings set symbols.enable-external-lookup false\n"},"event":"output","seq":0,"type":"event"}
1745978185.247931242 <-- (stdin/stdout) {"body":{"category":"console","output":"(lldb) settings set target.inherit-tcc true\n"},"event":"output","seq":0,"type":"event"}
1745978185.247943163 <-- (stdin/stdout) {"body":{"category":"console","output":"(lldb) settings set target.disable-aslr false\n"},"event":"output","seq":0,"type":"event"}
1745978185.247954607 <-- (stdin/stdout) {"body":{"category":"console","output":"(lldb) settings set target.detach-on-error false\n"},"event":"output","seq":0,"type":"event"}
1745978185.247966051 <-- (stdin/stdout) {"body":{"category":"console","output":"(lldb) settings set target.auto-apply-fixits false\n"},"event":"output","seq":0,"type":"event"}
1745978185.247978210 <-- (stdin/stdout) {"body":{"category":"console","output":"(lldb) settings set plugin.process.gdb-remote.packet-timeout 60\n"},"event":"output","seq":0,"type":"event"}
1745978185.248043776 <-- (stdin/stdout) {"body":{"category":"console","output":"(lldb) settings set symbols.clang-modules-cache-path \"/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api\"\n"},"event":"output","seq":0,"type":"event"}
1745978185.248056650 <-- (stdin/stdout) {"body":{"category":"console","output":"(lldb) settings set use-color false\n"},"event":"output","seq":0,"type":"event"}
1745978185.248067856 <-- (stdin/stdout) {"body":{"category":"console","output":"(lldb) settings set show-statusline false\n"},"event":"output","seq":0,"type":"event"}
1745978185.397187471 <-- (stdin/stdout) {"command":"launch","request_seq":2,"seq":0,"success":true,"type":"response"}
1745978185.397283316 <-- (stdin/stdout) {"body":{"module":{"addressRange":"4157714432","debugInfoSize":"983.3KB","id":"0D794E6C-AF7E-D8CB-B9BA-E385B4F8753F-5A793D65","name":"ld-linux-armhf.so.3","path":"/usr/lib/arm-linux-gnueabihf/ld-linux-armhf.so.3","symbolFilePath":"/usr/lib/arm-linux-gnueabihf/ld-linux-armhf.so.3","symbolStatus":"Symbols loaded."},"reason":"new"},"event":"module","seq":0,"type":"event"}
1745978185.397383451 <-- (stdin/stdout) {"body":{"isLocalProcess":true,"name":"/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/tools/lldb-dap/evaluate/TestDAP_evaluate.test_generic_evaluate_expressions/a.out","startMethod":"launch","systemProcessId":719136},"event":"process","seq":0,"type":"event"}
1745978185.397450924 <-- (stdin/stdout) {"event":"initialized","seq":0,"type":"event"}
1745978185.397581816 <-- (stdin/stdout) {"body":{"module":{"addressRange":"4587520","debugInfoSize":"98.8KB","id":"3FB14923","name":"a.out","path":"/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/tools/lldb-dap/evaluate/TestDAP_evaluate.test_generic_evaluate_expressions/a.out","symbolFilePath":"/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/tools/lldb-dap/evaluate/TestDAP_evaluate.test_generic_evaluate_expressions/a.out","symbolStatus":"Symbols loaded."},"reason":"new"},"event":"module","seq":0,"type":"event"}
1745978185.398276806 --> (stdin/stdout) {"command":"setBreakpoints","type":"request","arguments":{"source":{"name":"main.cpp","path":"main.cpp"},"sourceModified":false,"lines":[25,29,12,37,42,46,47,50],"breakpoints":[{"line":25},{"line":29},{"line":12},{"line":37},{"line":42},{"line":46},{"line":47},{"line":50}]},"seq":3}
1745978185.413206100 <-- (stdin/stdout) {"body":{"breakpoints":[{"column":14,"id":1,"instructionReference":"0x471110","line":25,"source":{"name":"main.cpp","path":"main.cpp"},"verified":true},{"column":16,"id":2,"instructionReference":"0x47112C","line":29,"source":{"name":"main.cpp","path":"main.cpp"},"verified":true},{"column":10,"id":3,"instructionReference":"0x4710AC","line":12,"source":{"name":"main.cpp","path":"main.cpp"},"verified":true},{"column":20,"id":4,"instructionReference":"0x471180","line":37,"source":{"name":"main.cpp","path":"main.cpp"},"verified":true},{"column":10,"id":5,"instructionReference":"0x4711EC","line":42,"source":{"name":"main.cpp","path":"main.cpp"},"verified":true},{"column":15,"id":6,"instructionReference":"0x471234","line":46,"source":{"name":"main.cpp","path":"main.cpp"},"verified":true},{"column":15,"id":7,"instructionReference":"0x471244","line":47,"source":{"name":"main.cpp","path":"main.cpp"},"verified":true},{"column":3,"id":8,"instructionReference":"0x471284","line":50,"source":{"name":"main.cpp","path":"main.cpp"},"verified":true}]},"command":"setBreakpoints","request_seq":3,"seq":0,"success":true,"type":"response"}

IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
clang currently issues a warning when memset is used on a struct that
contains an address-discriminated pointer field, even though this is
entirely valid behavior.

For example:

```
struct S {
  int * __ptrauth(1, 1, 100) p;
} s;

memset(&s, 0, sizeof(struct S));
```

Only allow the warning to be emitted in C++ mode to silence the warning.

rdar://142495870
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
clang currently issues a warning when memset is used on a struct that
contains an address-discriminated pointer field, even though this is
entirely valid behavior.

For example:

```
struct S {
  int * __ptrauth(1, 1, 100) p;
} s;

memset(&s, 0, sizeof(struct S));
```

Only allow the warning to be emitted in C++ mode to silence the warning.

rdar://142495870
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
clang currently issues a warning when memset is used on a struct that
contains an address-discriminated pointer field, even though this is
entirely valid behavior.

For example:

```
struct S {
  int * __ptrauth(1, 1, 100) p;
} s;

memset(&s, 0, sizeof(struct S));
```

Only allow the warning to be emitted in C++ mode to silence the warning.

rdar://142495870
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this pull request May 7, 2025
clang currently issues a warning when memset is used on a struct that
contains an address-discriminated pointer field, even though this is
entirely valid behavior.

For example:

```
struct S {
  int * __ptrauth(1, 1, 100) p;
} s;

memset(&s, 0, sizeof(struct S));
```

Only allow the warning to be emitted in C++ mode to silence the warning.

rdar://142495870
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants