public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "vk at mail dot lepp dot cornell dot edu" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/14129] New: gcc/f/lex.c buffer size limitation. Date: Thu, 12 Feb 2004 15:00:00 -0000 [thread overview] Message-ID: <20040212145952.14129.vk@mail.lepp.cornell.edu> (raw) Hi, fortran code crashed in preprocessor due to string hardcoded limit in gcc/f/lex.c. When compiled in long path (more then 128 character long) compiler crashed. Here example: /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/tradcpp0 -lang-fortran -v -I/nfs/cleo3/cleo3_rpm/development_20040204/rpms/test/stand-alone/src/ZebraCommonsModule -I/nfs/cleo3/cleo3_rpm/development_20040204/rpms/test/stand-alone/src/include -I/nfs/cleo3/cleo3_rpm/development_20040204/rpms/test/stand-alone/src/. -I/nfs/cleo3/cleo3_rpm/development_20040204/rpms/test/stand-alone/src/include/. -I/nfs/cleo3/cleo3_install/cleo3/Offline/rel/Jan13_04_P2/include -I/nfs/cleo3/cleo3_install/cleo3/Offline/rel/Jan13_04_P2/include/. -I/nfs/cleo3/cleo3_install/cleo3/Common/rel/Jan13_04_P2/include -I/nfs/cleo3/cleo3_install/cleo3/Common/rel/Jan13_04_P2/include/i686-pc-linux-gnu -I/nfs/cleo3/cleo3_install/cleo3/Offline/rel/Jan13_04_P2/other_sources -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=2 -D__GXX_ABI_VERSION=102 -D__ELF__ -Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__OPTIMIZE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i386__ -D__PIC__ -D__pic__ -DLinux -DCLEO_Linux -DDBCORBA -DMICOORB=2 -DMICOORB_MINOR=3 -DMICOORB_VERSION=7 -DHAVE_CONFIG_H /nfs/cleo3/cleo3_rpm/development_20040204/rpms/test/stand-alone/src/ZebraCommonsModule/Fortran/forceCommonsLoad.F > 1.tmp This produce code 1.tmp which has: # 1 "/nfs/cleo3/cleo3_rpm/development_20040204/rpms/test/stand-alone/src/ZebraCom monsModule/Fortran/forceCommonsLoad.F" Subroutine forceCommonsLoad # 1 "/nfs/cleo3/cleo3_rpm/development_20040204/rpms/test/stand-alone/src/ZebraCom monsModule/ZebraCommonsModule/ZebraCommonsDeclarations.h" 1 C...Zebra memory allocation variables C NWORD_GEANT - Number of words for Geant (separate Zebra bank ?) Well preprocessor string exceed 128 characters, which are defined in gcc/f/lex.c, see line 721 Then next step obviously crashed /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/f771 -quiet -dumpbase forceCommonsLoad.F -O -version -fno-second-underscore -finit-local-zero -fno-automatic -fPIC -I/nfs/cleo3/cleo3_rpm/development_20040204/rpms/test/stand-alone/src/ZebraCommonsModule -I/nfs/cleo3/cleo3_rpm/development_20040204/rpms/test/stand-alone/src/include -I/nfs/cleo3/cleo3_rpm/development_20040204/rpms/test/stand-alone/src/. -I/nfs/cleo3/cleo3_rpm/development_20040204/rpms/test/stand-alone/src/include/. -I/nfs/cleo3/cleo3_install/cleo3/Offline/rel/Jan13_04_P2/include -I/nfs/cleo3/cleo3_install/cleo3/Offline/rel/Jan13_04_P2/include/. -I/nfs/cleo3/cleo3_install/cleo3/Common/rel/Jan13_04_P2/include -I/nfs/cleo3/cleo3_install/cleo3/Common/rel/Jan13_04_P2/include/i686-pc-linux-gnu -I/nfs/cleo3/cleo3_install/cleo3/Offline/rel/Jan13_04_P2/other_sources -o - < 1.tmp > 2.tmp I think you need to follow POSIX rule and use PATH_MAX instead of hardcoded (small) 128. On Linux PATH_MAX is quite big 4K, so if you don't follow POSIX just increase buffer size to large value and if you hardcoded give people compiler option to override it. Here the patch: vk@vklaptop(09:50:12)> diff gcc-3.2.2-20030225/gcc/f/lex.c gcc-3.2.2-20030225/gcc/f/lex.c~ 721,722c721 < /*char buff[129];*/ < char buff[PATH_MAX+1]; --- > char buff[129]; 976d974 < /* 979,981d976 < */ < directive_buffer = (char *)xmalloc (PATH_MAX+1); < buffer_length = PATH_MAX+1; which fix the problem. Valentine. -- Summary: gcc/f/lex.c buffer size limitation. Product: gcc Version: 3.2.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: vk at mail dot lepp dot cornell dot edu CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14129
next reply other threads:[~2004-02-12 15:00 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-02-12 15:00 vk at mail dot lepp dot cornell dot edu [this message] 2004-02-12 16:39 ` [Bug fortran/14129] [g77] " pinskia at gcc dot gnu dot org 2004-02-15 14:27 ` cvs-commit at gcc dot gnu dot org 2004-02-15 17:16 ` cvs-commit at gcc dot gnu dot org 2004-02-15 17:43 ` pinskia at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20040212145952.14129.vk@mail.lepp.cornell.edu \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).