Skip to content

Commit ec3bc56

Browse files
committed
8355979: ATTRIBUTE_NO_UBSAN needs to be extended to handle float divisions by zero on AIX
Backport-of: 088825ed889551e6067d46bf77fe4d30a3972da1
1 parent 0c697da commit ec3bc56

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
@@ -30,7 +30,10 @@
3030
* following function or method.
3131
*/
3232
#ifdef UNDEFINED_BEHAVIOR_SANITIZER
33-
#if defined(__clang__) || defined(__GNUC__)
33+
#if defined(__clang__)
34+
#define ATTRIBUTE_NO_UBSAN __attribute__((no_sanitize("undefined","float-divide-by-zero")))
35+
#endif
36+
#if defined(__GNUC__) && !defined(__clang__)
3437
#define ATTRIBUTE_NO_UBSAN __attribute__((no_sanitize("undefined")))
3538
#endif
3639
#endif

0 commit comments

Comments
 (0)