>From eaf71f1fd97fcd31574be138ac4da842837d9c41 Mon Sep 17 00:00:00 2001
From: Robert Dubner <[email protected]>
Date: Thu, 12 Feb 2026 15:18:23 -0500
Subject: [PATCH] cobol: Eliminate strict-aliasing violations. [PR121499]
Code violating strict aliasing has been refactored.
libgcobol is now being built with
-fstrict-aliasing -Wstrict-aliasing -Wstrict-aliasing=3
Copyright boilerplate has been updated to the year 2026 throughout
gcc/cobol
and libgcobol.
gcc/cobol/ChangeLog:
* cbldiag.h: Copyright updated to 2026.
* cdf-copy.cc: Likewise.
* cdf.y: Likewise.
* cdfval.h: Likewise.
* cobol-system.h: Likewise.
* convert.cc: Likewise.
* copybook.h: Likewise.
* except.cc: Likewise.
* exceptg.h: Likewise.
* genapi.cc: Likewise.
* genapi.h: Likewise.
* gengen.cc: Likewise.
* gengen.h: Likewise.
* genmath.cc: Likewise.
* genmath.h: Likewise.
* genutil.cc: Likewise.
* genutil.h: Likewise.
* inspect.h: Likewise.
* lang-specs.h: Likewise.
* lexio.cc: Likewise.
* lexio.h: Likewise.
* messages.cc: Likewise.
* parse.y: Likewise.
* parse_ante.h: Likewise.
* parse_util.h: Likewise.
* scan.l: Likewise.
* scan_ante.h: Likewise.
* scan_post.h: Likewise.
* show_parse.h: Likewise.
* structs.cc: Likewise.
* structs.h: Likewise.
* symbols.cc: Likewise.
* symbols.h: Likewise.
* symfind.cc: Likewise.
* util.cc: Likewise.
* util.h: Likewise.
libgcobol/ChangeLog:
PR cobol/121499
* LICENSE: Copyright updated to 2026.
* Makefile.am: Compile with -fstrict-aliasing.
* Makefile.in: Autoreconf.
* acinclude.m4: Copyright updated to 2026.
* charmaps.cc: Likewise.
* charmaps.h: Likewise.
* common-defs.h: Likewise.
* configure.tgt: Likewise.
* constants.cc: Likewise.
* ec.h: Likewise.
* encodings.h: Likewise.
* exceptl.h: Likewise.
* gcobolio.h: Likewise.
* gfileio.cc: Likewise.
* gfileio.h: Likewise.
* gmath.cc (multiply_int256_by_int64): Eliminate aliasing.
(divide_int256_by_int64): Likewise.
(multiply_int128_by_int128): Likewise.
(divide_int128_by_int128): Likewise.
* gmath.h: Copyright updated to 2026.
* intrinsic.cc: Likewise.
* io.cc: Likewise.
* io.h: Likewise.
* libgcobol.cc: Likewise.
* libgcobol.h: Likewise.
* stringbin.cc: Likewise.
* stringbin.h: Likewise.
* valconv.cc: Likewise.
* valconv.h: Likewise.
* xmlparse.cc: Likewise.
---
gcc/cobol/cbldiag.h | 2 +-
gcc/cobol/cdf-copy.cc | 2 +-
gcc/cobol/cdf.y | 2 +-
gcc/cobol/cdfval.h | 2 +-
gcc/cobol/cobol-system.h | 2 +-
gcc/cobol/convert.cc | 2 +-
gcc/cobol/copybook.h | 2 +-
gcc/cobol/except.cc | 2 +-
gcc/cobol/exceptg.h | 2 +-
gcc/cobol/genapi.cc | 2 +-
gcc/cobol/genapi.h | 2 +-
gcc/cobol/gengen.cc | 2 +-
gcc/cobol/gengen.h | 2 +-
gcc/cobol/genmath.cc | 2 +-
gcc/cobol/genmath.h | 2 +-
gcc/cobol/genutil.cc | 2 +-
gcc/cobol/genutil.h | 2 +-
gcc/cobol/inspect.h | 2 +-
gcc/cobol/lang-specs.h | 2 +-
gcc/cobol/lexio.cc | 2 +-
gcc/cobol/lexio.h | 2 +-
gcc/cobol/messages.cc | 2 +-
gcc/cobol/parse.y | 2 +-
gcc/cobol/parse_ante.h | 2 +-
gcc/cobol/parse_util.h | 2 +-
gcc/cobol/scan.l | 2 +-
gcc/cobol/scan_ante.h | 2 +-
gcc/cobol/scan_post.h | 2 +-
gcc/cobol/show_parse.h | 2 +-
gcc/cobol/structs.cc | 2 +-
gcc/cobol/structs.h | 2 +-
gcc/cobol/symbols.cc | 2 +-
gcc/cobol/symbols.h | 2 +-
gcc/cobol/symfind.cc | 2 +-
gcc/cobol/util.cc | 2 +-
gcc/cobol/util.h | 2 +-
libgcobol/LICENSE | 2 +-
libgcobol/Makefile.am | 5 ++--
libgcobol/Makefile.in | 6 ++--
libgcobol/acinclude.m4 | 2 +-
libgcobol/charmaps.cc | 2 +-
libgcobol/charmaps.h | 2 +-
libgcobol/common-defs.h | 2 +-
libgcobol/configure.tgt | 2 +-
libgcobol/constants.cc | 2 +-
libgcobol/ec.h | 2 +-
libgcobol/encodings.h | 2 +-
libgcobol/exceptl.h | 2 +-
libgcobol/gcobolio.h | 2 +-
libgcobol/gfileio.cc | 2 +-
libgcobol/gfileio.h | 2 +-
libgcobol/gmath.cc | 63 +++++++++++++++++++++++-----------------
libgcobol/gmath.h | 2 +-
libgcobol/intrinsic.cc | 2 +-
libgcobol/io.cc | 2 +-
libgcobol/io.h | 2 +-
libgcobol/libgcobol.cc | 2 +-
libgcobol/libgcobol.h | 2 +-
libgcobol/stringbin.cc | 2 +-
libgcobol/stringbin.h | 2 +-
libgcobol/valconv.cc | 2 +-
libgcobol/valconv.h | 2 +-
libgcobol/xmlparse.cc | 2 +-
63 files changed, 102 insertions(+), 92 deletions(-)
diff --git a/gcc/cobol/cbldiag.h b/gcc/cobol/cbldiag.h
index 9167c563821..07d92c0b48d 100644
--- a/gcc/cobol/cbldiag.h
+++ b/gcc/cobol/cbldiag.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/cdf-copy.cc b/gcc/cobol/cdf-copy.cc
index 11be9b818ef..304360d5257 100644
--- a/gcc/cobol/cdf-copy.cc
+++ b/gcc/cobol/cdf-copy.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/cdf.y b/gcc/cobol/cdf.y
index 11dfcf5b6db..e4f69b1627c 100644
--- a/gcc/cobol/cdf.y
+++ b/gcc/cobol/cdf.y
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/cdfval.h b/gcc/cobol/cdfval.h
index cc474a22a48..b9d66002370 100644
--- a/gcc/cobol/cdfval.h
+++ b/gcc/cobol/cdfval.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/gcc/cobol/cobol-system.h b/gcc/cobol/cobol-system.h
index 828f4f53ec8..d0a7659a2f1 100644
--- a/gcc/cobol/cobol-system.h
+++ b/gcc/cobol/cobol-system.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/convert.cc b/gcc/cobol/convert.cc
index a0ef9d5388d..7d4bf9e16e7 100644
--- a/gcc/cobol/convert.cc
+++ b/gcc/cobol/convert.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/copybook.h b/gcc/cobol/copybook.h
index ff8c6d0ca27..2b3f0a20534 100644
--- a/gcc/cobol/copybook.h
+++ b/gcc/cobol/copybook.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/except.cc b/gcc/cobol/except.cc
index 31112d1274a..7003673d75f 100644
--- a/gcc/cobol/except.cc
+++ b/gcc/cobol/except.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/gcc/cobol/exceptg.h b/gcc/cobol/exceptg.h
index 6869f220417..80432a04eb7 100644
--- a/gcc/cobol/exceptg.h
+++ b/gcc/cobol/exceptg.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/genapi.cc b/gcc/cobol/genapi.cc
index 108fb7f38f4..6f8ce1889bd 100644
--- a/gcc/cobol/genapi.cc
+++ b/gcc/cobol/genapi.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/genapi.h b/gcc/cobol/genapi.h
index 162cb572ed7..1ae7d96bfbd 100644
--- a/gcc/cobol/genapi.h
+++ b/gcc/cobol/genapi.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/gengen.cc b/gcc/cobol/gengen.cc
index 208d4910527..922d9844cfc 100644
--- a/gcc/cobol/gengen.cc
+++ b/gcc/cobol/gengen.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/gengen.h b/gcc/cobol/gengen.h
index e785ac7819a..0a716449d07 100644
--- a/gcc/cobol/gengen.h
+++ b/gcc/cobol/gengen.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/genmath.cc b/gcc/cobol/genmath.cc
index 535a7740c09..18ba682f30b 100644
--- a/gcc/cobol/genmath.cc
+++ b/gcc/cobol/genmath.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/genmath.h b/gcc/cobol/genmath.h
index 9fc2fc3bdb2..5c52381c062 100644
--- a/gcc/cobol/genmath.h
+++ b/gcc/cobol/genmath.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/genutil.cc b/gcc/cobol/genutil.cc
index b384cd14939..a143080542d 100644
--- a/gcc/cobol/genutil.cc
+++ b/gcc/cobol/genutil.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/genutil.h b/gcc/cobol/genutil.h
index 251b1c11631..f456f203ba5 100644
--- a/gcc/cobol/genutil.h
+++ b/gcc/cobol/genutil.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/inspect.h b/gcc/cobol/inspect.h
index 96399f5dc01..fd2db6cef84 100644
--- a/gcc/cobol/inspect.h
+++ b/gcc/cobol/inspect.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/lang-specs.h b/gcc/cobol/lang-specs.h
index cd27cdf68cd..b84b6666e78 100644
--- a/gcc/cobol/lang-specs.h
+++ b/gcc/cobol/lang-specs.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/lexio.cc b/gcc/cobol/lexio.cc
index 3911dd0fc3e..fe4343e5d1d 100644
--- a/gcc/cobol/lexio.cc
+++ b/gcc/cobol/lexio.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/lexio.h b/gcc/cobol/lexio.h
index ba4ef0adb8e..03d97550f2b 100644
--- a/gcc/cobol/lexio.h
+++ b/gcc/cobol/lexio.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/gcc/cobol/messages.cc b/gcc/cobol/messages.cc
index 3f9b7735bf0..9dd73e0155c 100644
--- a/gcc/cobol/messages.cc
+++ b/gcc/cobol/messages.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/parse.y b/gcc/cobol/parse.y
index 1311797f03d..875f7cfa23d 100644
--- a/gcc/cobol/parse.y
+++ b/gcc/cobol/parse.y
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/parse_ante.h b/gcc/cobol/parse_ante.h
index 88950a95995..a89237de988 100644
--- a/gcc/cobol/parse_ante.h
+++ b/gcc/cobol/parse_ante.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/parse_util.h b/gcc/cobol/parse_util.h
index 20847e3ef46..463ade3242c 100644
--- a/gcc/cobol/parse_util.h
+++ b/gcc/cobol/parse_util.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/scan.l b/gcc/cobol/scan.l
index f730fc2dda9..d5ec34a4685 100644
--- a/gcc/cobol/scan.l
+++ b/gcc/cobol/scan.l
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/scan_ante.h b/gcc/cobol/scan_ante.h
index d2db44b1303..2f87b1a5d6d 100644
--- a/gcc/cobol/scan_ante.h
+++ b/gcc/cobol/scan_ante.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/scan_post.h b/gcc/cobol/scan_post.h
index cb729b3f9aa..71025a220e5 100644
--- a/gcc/cobol/scan_post.h
+++ b/gcc/cobol/scan_post.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/show_parse.h b/gcc/cobol/show_parse.h
index 3b4adad180a..e1a84dcf5ce 100644
--- a/gcc/cobol/show_parse.h
+++ b/gcc/cobol/show_parse.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/structs.cc b/gcc/cobol/structs.cc
index 37875d22ae0..69cfe9bf30d 100644
--- a/gcc/cobol/structs.cc
+++ b/gcc/cobol/structs.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/structs.h b/gcc/cobol/structs.h
index 47a78b45e9a..d26f13f7e1d 100644
--- a/gcc/cobol/structs.h
+++ b/gcc/cobol/structs.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/symbols.cc b/gcc/cobol/symbols.cc
index 731f51afbdb..ea686ab9c4e 100644
--- a/gcc/cobol/symbols.cc
+++ b/gcc/cobol/symbols.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/symbols.h b/gcc/cobol/symbols.h
index 511198a870e..398be73f0e1 100644
--- a/gcc/cobol/symbols.h
+++ b/gcc/cobol/symbols.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/symfind.cc b/gcc/cobol/symfind.cc
index 472d37a20b9..cefc560bf31 100644
--- a/gcc/cobol/symfind.cc
+++ b/gcc/cobol/symfind.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/gcc/cobol/util.cc b/gcc/cobol/util.cc
index 42c67cafca8..d9978e42da1 100644
--- a/gcc/cobol/util.cc
+++ b/gcc/cobol/util.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/gcc/cobol/util.h b/gcc/cobol/util.h
index d457e3ee41b..2a4e6b7091f 100644
--- a/gcc/cobol/util.h
+++ b/gcc/cobol/util.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/libgcobol/LICENSE b/libgcobol/LICENSE
index 3937993c56a..50d27a12f47 100644
--- a/libgcobol/LICENSE
+++ b/libgcobol/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2021-2025 Symas Corporation
+Copyright (c) 2021-2026 Symas Corporation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
diff --git a/libgcobol/Makefile.am b/libgcobol/Makefile.am
index ab4cb0c3908..79310647b3e 100644
--- a/libgcobol/Makefile.am
+++ b/libgcobol/Makefile.am
@@ -1,4 +1,4 @@
-# Copyright (C) 2025 Free Software Foundation, Inc.
+# Copyright (C) 2026 Free Software Foundation, Inc.
# Contributed by the Symas Corporation, 2025
# This file is part of GCC.
@@ -91,8 +91,7 @@ AM_CFLAGS = $(XCFLAGS)
AM_CXXFLAGS = $(XCFLAGS)
AM_CXXFLAGS += $(WARN_CFLAGS)
AM_CXXFLAGS += -DIN_TARGET_LIBS
-AM_CXXFLAGS += -fno-strict-aliasing
-#AM_CXXFLAGS += -fstrict-aliasing -Wstrict-aliasing -Wstrict-aliasing=3
+AM_CXXFLAGS += -fstrict-aliasing -Wstrict-aliasing -Wstrict-aliasing=3
if ENABLE_DARWIN_AT_RPATH
# Handle embedded rpaths for Darwin.
diff --git a/libgcobol/Makefile.in b/libgcobol/Makefile.in
index a72c50f1034..fa8b7bdf4eb 100644
--- a/libgcobol/Makefile.in
+++ b/libgcobol/Makefile.in
@@ -14,7 +14,7 @@
@SET_MAKE@
-# Copyright (C) 2025 Free Software Foundation, Inc.
+# Copyright (C) 2026 Free Software Foundation, Inc.
# Contributed by the Symas Corporation, 2025
# This file is part of GCC.
@@ -112,7 +112,6 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-#AM_CXXFLAGS += -fstrict-aliasing -Wstrict-aliasing -Wstrict-aliasing=3
# Handle embedded rpaths for Darwin.
@BUILD_LIBGCOBOL_TRUE@@ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 =
-Wc,-nodefaultrpaths \
@@ -459,7 +458,8 @@ gcc_version := $(shell @get_gcc_base_ver@
$(top_srcdir)/../gcc/BASE-VER)
@BUILD_LIBGCOBOL_TRUE@ /usr/include/libxml2
@BUILD_LIBGCOBOL_TRUE@AM_CFLAGS = $(XCFLAGS)
@BUILD_LIBGCOBOL_TRUE@AM_CXXFLAGS = $(XCFLAGS) $(WARN_CFLAGS) \
-@BUILD_LIBGCOBOL_TRUE@ -DIN_TARGET_LIBS -fno-strict-aliasing
+@BUILD_LIBGCOBOL_TRUE@ -DIN_TARGET_LIBS -fstrict-aliasing \
+@BUILD_LIBGCOBOL_TRUE@ -Wstrict-aliasing -Wstrict-aliasing=3
# We want to link with the c++ runtime.
@BUILD_LIBGCOBOL_TRUE@libgcobol_la_LINK = $(CXXLINK)
$(libgcobol_la_LDFLAGS)
diff --git a/libgcobol/acinclude.m4 b/libgcobol/acinclude.m4
index 0e81b108386..3b03ecff2a4 100644
--- a/libgcobol/acinclude.m4
+++ b/libgcobol/acinclude.m4
@@ -1,4 +1,4 @@
-dnl Copyright (C) 2021-2025 Free Software Foundation, Inc.
+dnl Copyright (C) 2021-2026 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
diff --git a/libgcobol/charmaps.cc b/libgcobol/charmaps.cc
index 001e29142be..8aa42e3234e 100644
--- a/libgcobol/charmaps.cc
+++ b/libgcobol/charmaps.cc
@@ -1,6 +1,6 @@
// This file is included in both the libgcobol and gcc/cobol compilations
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/libgcobol/charmaps.h b/libgcobol/charmaps.h
index 44e327227b6..c8fa82264d1 100644
--- a/libgcobol/charmaps.h
+++ b/libgcobol/charmaps.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/libgcobol/common-defs.h b/libgcobol/common-defs.h
index f4f4fca1d08..5cc341c4669 100644
--- a/libgcobol/common-defs.h
+++ b/libgcobol/common-defs.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/libgcobol/configure.tgt b/libgcobol/configure.tgt
index a23925295b6..310d7e0cdc4 100644
--- a/libgcobol/configure.tgt
+++ b/libgcobol/configure.tgt
@@ -1,5 +1,5 @@
# -*- shell-script -*-
-# Copyright (C) 2025 Free Software Foundation, Inc.
+# Copyright (C) 2026 Free Software Foundation, Inc.
#
# GCC is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/libgcobol/constants.cc b/libgcobol/constants.cc
index 75ae497be32..8db6e9a38e8 100644
--- a/libgcobol/constants.cc
+++ b/libgcobol/constants.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/libgcobol/ec.h b/libgcobol/ec.h
index 4315d19ac9d..cf92f958911 100644
--- a/libgcobol/ec.h
+++ b/libgcobol/ec.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/libgcobol/encodings.h b/libgcobol/encodings.h
index 7d92f2d7a0d..3a7e40cef83 100644
--- a/libgcobol/encodings.h
+++ b/libgcobol/encodings.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021_2025 Symas Corporation
+ * Copyright (c) 2021_2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/libgcobol/exceptl.h b/libgcobol/exceptl.h
index dcad545912d..96cba8ba847 100644
--- a/libgcobol/exceptl.h
+++ b/libgcobol/exceptl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/libgcobol/gcobolio.h b/libgcobol/gcobolio.h
index 064af5bad54..731b41079f7 100644
--- a/libgcobol/gcobolio.h
+++ b/libgcobol/gcobolio.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/libgcobol/gfileio.cc b/libgcobol/gfileio.cc
index c6813be6ef1..144111ac0a6 100644
--- a/libgcobol/gfileio.cc
+++ b/libgcobol/gfileio.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/libgcobol/gfileio.h b/libgcobol/gfileio.h
index 36df81bb2ea..1174198be4e 100644
--- a/libgcobol/gfileio.h
+++ b/libgcobol/gfileio.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/libgcobol/gmath.cc b/libgcobol/gmath.cc
index be98f7eb522..2078dbedca5 100644
--- a/libgcobol/gmath.cc
+++ b/libgcobol/gmath.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -361,6 +361,15 @@ typedef struct int256
};
}int256;
+typedef struct int128
+ {
+ union
+ {
+ uint64_t i64 [2];
+ uint128 i128;
+ };
+ }int128;
+
static int
multiply_int256_by_int64(int256 &product, const uint64_t multiplier)
{
@@ -368,11 +377,13 @@ multiply_int256_by_int64(int256 &product, const
uint64_t multiplier)
// a factor of ten. This is effectively left-shifting by decimal
// digits. See scale_int256_by_digits
uint64_t overflows[5] = {};
+ int128 temp;
for(int i=0; i<4; i++)
{
- uint128 temp = (uint128)product.i64[i] * multiplier;
- product.i64[i] = *PTRCAST(uint64_t, &temp);
- overflows[i+1] = *PTRCAST(uint64_t, PTRCAST(uint8_t, &temp) + 8);
+ // cppcheck-suppress unreadVariable // cppcheck is dumb about
unions???
+ temp.i128 = (uint128)product.i64[i] * multiplier;
+ product.i64[i] = temp.i64[0];
+ overflows[i+1] = temp.i64[1];
}
for(int i=1; i<4; i++)
@@ -450,21 +461,20 @@ static void
divide_int256_by_int64(int256 &val, uint64_t divisor)
{
// val needs to be a positive number
- uint128 temp = 0;
+ int128 temp = {};
for( int i=3; i>=0; i-- )
{
// Left shift temp 64 bits:
- *PTRCAST(uint64_t, ((PTRCAST(uint8_t, &temp))+8))
- = *PTRCAST(uint64_t, ((PTRCAST(uint8_t,
&temp))+0));
+ temp.i64[1] = temp.i64[0];
// Put the high digit of val into the bottom of temp
- *PTRCAST(uint64_t, ((PTRCAST(uint8_t, &temp))+0)) = val.i64[i];
+ temp.i64[0] = val.i64[i];
// Divide that combinary by divisor to get the new digits
- val.i64[i] = temp / divisor;
+ val.i64[i] = temp.i128 / divisor;
// And the new temp is that combination modulo divisor
- temp = temp % divisor;
+ temp.i128 = temp.i128 % divisor;
}
}
@@ -1287,10 +1297,10 @@ void multiply_int128_by_int128(int256 &ABCD,
uint128 BD;
// Let's extract the digits.
- uint64_t a = *PTRCAST(uint64_t, (PTRCAST(unsigned char,
(&ab_value))+8));
- uint64_t b = *PTRCAST(uint64_t, (PTRCAST(unsigned char,
(&ab_value))+0));
- uint64_t c = *PTRCAST(uint64_t, (PTRCAST(unsigned char,
(&cd_value))+8));
- uint64_t d = *PTRCAST(uint64_t, (PTRCAST(unsigned char,
(&cd_value))+0));
+ uint64_t a = ab_value>>64;
+ uint64_t b = ab_value;
+ uint64_t c = cd_value>>64;
+ uint64_t d = cd_value;
// multiply (a0 + b) * (c0 + d)
@@ -1703,27 +1713,28 @@ divide_int128_by_int128(int256 "ient,
// Now we multiply our 64-bit guess by the 128-bit CD to get the
// three-place value we are going to subtract from the numerator
area.
-
- uint64_t subber[3];
- subber[2] = 0;
+ // We use the bottom three i64[] places of an int256 structure to
hold
+ // that three-place value
+ int256 subber;
+ subber.i64[2] = 0;
// Start with the bottom 128 bits of the "subber"
- *PTRCAST(uint128, subber) = (uint128) divisor64[0] *
quotient.i64[q_place];
+ subber.i128[0] = (uint128) divisor64[0] * quotient.i64[q_place];
// Get the next 128 bits of subber
temp = (uint128) divisor64[1] * quotient.i64[q_place];
// Add the top of the first product to the bottom of the second:
- subber[1] += temp64[0];
+ subber.i64[1] += temp64[0];
// See if there was an overflow:
- if( subber[1] < temp64[0] )
+ if( subber.i64[1] < temp64[0] )
{
// There was an overflow
- subber[2] = 1;
+ subber.i64[2] = 1;
}
// And now put the top of the second product into place:
- subber[2] += temp64[1];
+ subber.i64[2] += temp64[1];
// "subber" is now the three-place product of the two-place divisor
times
// the one-place guess
@@ -1738,13 +1749,13 @@ divide_int128_by_int128(int256 "ient,
{
// We are subtracting from zero and we have a borrow. Leave
the
// borrow on and just do the subtraction:
- numerator.i64[q_place + j] -= subber[j];
+ numerator.i64[q_place + j] -= subber.i64[j];
}
else
{
uint64_t stash = numerator.i64[q_place + j];
numerator.i64[q_place + j] -= borrow;
- numerator.i64[q_place + j] -= subber[j];
+ numerator.i64[q_place + j] -= subber.i64[j];
if( numerator.i64[q_place + j] > stash )
{
// After subtracting, the value got bigger, which means we
have
@@ -1775,14 +1786,14 @@ divide_int128_by_int128(int256 "ient,
{
// We are at the top and have a carry. Just leave the carry
on
// and do the addition:
- numerator.i64[q_place + ii] += subber[ii];
+ numerator.i64[q_place + ii] += subber.i64[ii];
}
else
{
// We are not at the top.
uint64_t stash = numerator.i64[q_place + ii];
numerator.i64[q_place + ii] += carry;
- numerator.i64[q_place + ii] += subber[ii];
+ numerator.i64[q_place + ii] += subber.i64[ii];
if( numerator.i64[q_place + ii] < stash )
{
// The addition caused the result to get smaller, meaning
that
diff --git a/libgcobol/gmath.h b/libgcobol/gmath.h
index 9aa8f635f4a..4c022cacaca 100644
--- a/libgcobol/gmath.h
+++ b/libgcobol/gmath.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/libgcobol/intrinsic.cc b/libgcobol/intrinsic.cc
index af8f3ac42c0..680db5a5289 100644
--- a/libgcobol/intrinsic.cc
+++ b/libgcobol/intrinsic.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/libgcobol/io.cc b/libgcobol/io.cc
index 9b07309b90e..e5ce01d2ca2 100644
--- a/libgcobol/io.cc
+++ b/libgcobol/io.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/libgcobol/io.h b/libgcobol/io.h
index 0c89ad6d0c9..77cae1f3ab8 100644
--- a/libgcobol/io.h
+++ b/libgcobol/io.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/libgcobol/libgcobol.cc b/libgcobol/libgcobol.cc
index 3cc13e34589..81accd93f71 100644
--- a/libgcobol/libgcobol.cc
+++ b/libgcobol/libgcobol.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/libgcobol/libgcobol.h b/libgcobol/libgcobol.h
index e4d0ab9fd78..4c2a26d7eff 100644
--- a/libgcobol/libgcobol.h
+++ b/libgcobol/libgcobol.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/libgcobol/stringbin.cc b/libgcobol/stringbin.cc
index 713bc59f863..ed762507a65 100644
--- a/libgcobol/stringbin.cc
+++ b/libgcobol/stringbin.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/libgcobol/stringbin.h b/libgcobol/stringbin.h
index 0f30a9ff701..b4b2238884f 100644
--- a/libgcobol/stringbin.h
+++ b/libgcobol/stringbin.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/libgcobol/valconv.cc b/libgcobol/valconv.cc
index ef5faae576c..388db5aee0c 100644
--- a/libgcobol/valconv.cc
+++ b/libgcobol/valconv.cc
@@ -1,6 +1,6 @@
// This file is included in both the libgcobol and gcc/cobol compilations
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/libgcobol/valconv.h b/libgcobol/valconv.h
index 7b2c415830d..d9c4b11a44a 100644
--- a/libgcobol/valconv.h
+++ b/libgcobol/valconv.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
diff --git a/libgcobol/xmlparse.cc b/libgcobol/xmlparse.cc
index f1e0794fee7..8ad189d102a 100644
--- a/libgcobol/xmlparse.cc
+++ b/libgcobol/xmlparse.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2025 Symas Corporation
+ * Copyright (c) 2021-2026 Symas Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
--
2.34.1