8355077: Compiler error at splashscreen_gif.c due to unterminated string initialization#24770
8355077: Compiler error at splashscreen_gif.c due to unterminated string initialization#24770YaSuenag wants to merge 1 commit intoopenjdk:masterfrom
Conversation
…ing initialization
|
👋 Welcome back ysuenaga! A progress list of the required criteria for merging this PR into |
|
@YaSuenag This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 126 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
|
Isn't gcc wrong to complain ? ====== char s[] = "abc", t[3] = "abc"; defines ‘‘plain’’ char array objects s and t whose elements are initialized with character string literals. ===== |
|
I think this behavior is not a bug in GCC.
As an option, we can set diff --git a/src/java.desktop/share/native/libsplashscreen/splashscreen_gif.c b/src/java.desktop/share/native/libsplashscreen/splashscreen_gif.c
index 3654c677493..047f08835ad 100644
--- a/src/java.desktop/share/native/libsplashscreen/splashscreen_gif.c
+++ b/src/java.desktop/share/native/libsplashscreen/splashscreen_gif.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -48,7 +48,7 @@
// restore the area overwritten by the graphic with
// what was there prior to rendering the graphic.
-static const char szNetscape20ext[11] = "NETSCAPE2.0";
+static const char szNetscape20ext[11] __attribute__((nonstring)) = "NETSCAPE2.0";
#define NSEXT_LOOP 0x01 // Loop Count field code
|
|
hmm. yes, it looks like it is enabled by -Wextra Ok. let's make the change as the easiest thing to do. |
|
/integrate |
|
Going to push as commit 898d479.
Your commit was automatically rebased without conflicts. |
I tried to build OpenJDK with GCC 15.0.1 on Fedora 42 x86_64, however I saw following error.
This constant seems to be used to detect Netscape 2.0 extension in GIF image. It should be used to compare with extension block without NUL char, but we should tweak initialization to avoid this error for safety code.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24770/head:pull/24770$ git checkout pull/24770Update a local copy of the PR:
$ git checkout pull/24770$ git pull https://git.openjdk.org/jdk.git pull/24770/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 24770View PR using the GUI difftool:
$ git pr show -t 24770Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24770.diff
Using Webrev
Link to Webrev Comment