Skip to content

Commit 088825e

Browse files
committed
8355979: ATTRIBUTE_NO_UBSAN needs to be extended to handle float divisions by zero on AIX
Reviewed-by: jkern, lucy
1 parent bfdafb7 commit 088825e

File tree

2 files changed

+12
-6
lines changed
  • src
    • hotspot/share/sanitizers
    • java.base/share/native/libjava

2 files changed

+12
-6
lines changed

src/hotspot/share/sanitizers/ub.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2024 SAP SE. All rights reserved.
2+
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2024, 2025 SAP SE. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
66
* This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,10 @@
3333
// Useful if the function or method is known to do something special or even 'dangerous', for
3434
// example causing desired signals/crashes.
3535
#ifdef UNDEFINED_BEHAVIOR_SANITIZER
36-
#if defined(__clang__) || defined(__GNUC__)
36+
#if defined(__clang__)
37+
#define ATTRIBUTE_NO_UBSAN __attribute__((no_sanitize("undefined","float-divide-by-zero")))
38+
#endif
39+
#if defined(__GNUC__) && !defined(__clang__)
3740
#define ATTRIBUTE_NO_UBSAN __attribute__((no_sanitize("undefined")))
3841
#endif
3942
#endif

src/java.base/share/native/libjava/ub.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2024 SAP SE. All rights reserved.
2+
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2024, 2025 SAP SE. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
66
* This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,10 @@
3232
* following function or method.
3333
*/
3434
#ifdef UNDEFINED_BEHAVIOR_SANITIZER
35-
#if defined(__clang__) || defined(__GNUC__)
35+
#if defined(__clang__)
36+
#define ATTRIBUTE_NO_UBSAN __attribute__((no_sanitize("undefined","float-divide-by-zero")))
37+
#endif
38+
#if defined(__GNUC__) && !defined(__clang__)
3639
#define ATTRIBUTE_NO_UBSAN __attribute__((no_sanitize("undefined")))
3740
#endif
3841
#endif

0 commit comments

Comments
 (0)